via: 7896938aefaf21adc42a01b4d8e9dd3d42ffbc82 (commit)
from: 9c0deb98bbc4aa6a9e5e6f792e911b550f4db83f (commit)
= COMMIT LOG ===========================================================
committer: Mitch Capper
comments:
Make accounts default to 0 last rather than after 1, add a proper remove account function and kill it out of sofia first, don't add a new account if a user clicks cancel.
diff --git a/mitchcapper/FSClient/Account.cs b/mitchcapper/FSClient/Account.cs
index d987ced..59f0197 100644
--- a/mitchcapper/FSClient/Account.cs
+++ b/mitchcapper/FSClient/Account.cs
@@ -125,7 +125,11 @@ namespace FSClient {
account.guid = "";
account.guid = old_guid;
}
-
+ public static void RemoveAccount(Account account){
+ account.KillGateway();
+ accounts.Remove(account);
+ ReloadSofia();
+ }
public static void create_gateway_nodes(XmlNode gateways_node) {
foreach (Account account in accounts) {
@@ -170,9 +174,10 @@ namespace FSClient {
_guid.PropertyChanged += (s, e) => {
if (!guid_ok(this, _guid.value) || String.IsNullOrEmpty(_guid.value)) {
- for (int i = 0; i < 10; i++) {
- if (guid_ok(this, i.ToString())) {
- _guid.value = i.ToString();
+ for (int i = 1; i <= 10; i++){
+ int val = i == 10 ? 0 : i; // want 0 checked last.
+ if (guid_ok(this, val.ToString())) {
+ _guid.value = val.ToString();
return;
}
}
@@ -329,13 +334,16 @@ namespace FSClient {
KillGateway();
ReloadSofia();
}
- public void edit() {
+ public bool edit() {
current_editing_account = this;
GenericEditor editor = new GenericEditor();
editor.Init("Editing Account", values);
editor.ShowDialog();
if (editor.DialogResult == true)
ReloadAccount();
+ else
+ return false;
+ return true;
}
}
}
diff --git a/mitchcapper/FSClient/Broker.cs b/mitchcapper/FSClient/Broker.cs
index b774695..58d6d91 100644
--- a/mitchcapper/FSClient/Broker.cs
+++ b/mitchcapper/FSClient/Broker.cs
@@ -228,7 +228,7 @@ namespace FSClient {
}
public void DialString(String str){
if (string.IsNullOrWhiteSpace(str))
- return;
+ return;
MainWindowRemoveFocus(true);
if (str.StartsWith("#") && str.Length > 2) {
@@ -572,8 +572,8 @@ namespace FSClient {
public OurAutoCompleteBox GetContactSearchBox() {
return MainWindow.get_instance().GetContactSearchBox();
}
- public void MainWindowRemoveFocus(bool ResetContactSearchText=false){
- MainWindow.get_instance().RemoveFocus(ResetContactSearchText);
+ public void MainWindowRemoveFocus(bool ResetContactSearchText=false){
+ MainWindow.get_instance().RemoveFocus(ResetContactSearchText);
}
private delegate void BroadcastEventDel(FSEvent evt);
BroadcastEventDel BroadcastHandler;
diff --git a/mitchcapper/FSClient/MainWindow.xaml.cs b/mitchcapper/FSClient/MainWindow.xaml.cs
index 2201cf0..1ea68a4 100644
--- a/mitchcapper/FSClient/MainWindow.xaml.cs
+++ b/mitchcapper/FSClient/MainWindow.xaml.cs
@@ -365,7 +365,8 @@ namespace FSClient {
private void AccountNew_Click(object sender, RoutedEventArgs e) {
Account acct = new Account();
Account.AddAccount(acct);
- acct.edit();
+ if (!acct.edit())
+ Account.RemoveAccount(acct);
}
@@ -387,7 +388,7 @@ namespace FSClient {
Account acct = gridAccounts.SelectedItem as Account;
if (acct == null)
return;
- Account.accounts.Remove(acct);
+ Account.RemoveAccount(acct);
}
Summary of changes: mitchcapper/FSClient/Account.cs | 18 +++++++++++++----- mitchcapper/FSClient/Broker.cs | 6 +++--- mitchcapper/FSClient/MainWindow.xaml.cs | 5 +++-- 3 files changed, 19 insertions(+), 10 deletions(-)
this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630
--
FreeSWITCH user-contributed scripts, etc