提交 7d055604 authored 作者: Mitch Capper's avatar Mitch Capper

Make accounts default to 0 last rather than after 1, add a proper remove…

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.
上级 9c4002cb
......@@ -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;
}
}
}
......@@ -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;
......
......@@ -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);
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论