private async void account_switcher_cmb_SelectionChangeCommitted(object sender, System.EventArgs e) { Acc_key = ((ComboBox)sender).SelectedItem as Account_m; history_cmb.Enabled = false; account_switcher_cmb.Enabled = false; refresh_btn.Enabled = false; pictureBox1.Visible = true; await Program.InnerAccount.DoLoad_ObligList(Acc_key); }
public void LoadSettings() { account_switcher_cmb.SelectionChangeCommitted -= account_switcher_cmb_SelectionChangeCommitted; history_cmb.SelectionChangeCommitted -= history_cmb_SelectionChangeCommitted; Account_m Load_m = null; if (!string.IsNullOrEmpty(Settings.Default.SelectedAcc)) { Account Load = JsonConvert.DeserializeObject <Account>(Settings.Default.SelectedAcc); Load_m = new Account_m(Load.BrokerAccountType, Load.BrokerAccountId); } if (Load_m != null) { foreach (var item in account_switcher_cmb.Items) { if (((Account_m)item).BrokerAccountId == Load_m.BrokerAccountId) { account_switcher_cmb.SelectedItem = item; break; } } } if (account_switcher_cmb.SelectedIndex == -1) { account_switcher_cmb.SelectedIndex = 0; } Mode = (SeeHistory)Settings.Default.SelectedHistoryMode; if ((int)Mode == 0) { history_cmb.SelectedIndex = 0; Mode = SeeHistory.NoHistrory; } else { history_cmb.SelectedIndex = (int)Mode - 1; } account_switcher_cmb.SelectionChangeCommitted += account_switcher_cmb_SelectionChangeCommitted; history_cmb.SelectionChangeCommitted += history_cmb_SelectionChangeCommitted; account_switcher_cmb_SelectionChangeCommitted(account_switcher_cmb, null); }