public void updateAccountList() { Account accountEntry = new Account("Add a new Account", 0); Account addAccountEntry = accountEntry; string[] allAccountNames = Directory.GetFiles("C:\\IronChain\\", "*.acc"); accountList = new Dictionary <string, Account>(); foreach (string s in allAccountNames) { string[] splitted = s.Split('\\'); string nameOfFile = splitted[splitted.Length - 1]; string[] onlyName = nameOfFile.Split('.'); accountEntry = Utility.loadFile <Account>("C:\\IronChain\\" + nameOfFile); accountList.Add(onlyName[0], accountEntry); } if (accountList.Count == 0) { addAccount accWindow = new addAccount(); accWindow.Show(this); return; } comboBox1.Items.Clear(); comboBox2.Items.Clear(); comboBox3.Items.Clear(); foreach (Account acc in accountList.Values) { comboBox1.Items.Add(acc); comboBox2.Items.Add(acc); comboBox3.Items.Add(acc); if (acc.name.Equals(minerAccountName)) { comboBox2.SelectedItem = acc; } if (acc.name.Equals(mainAccount)) { comboBox1.SelectedItem = acc; comboBox3.SelectedItem = acc; } } comboBox1.Items.Add(addAccountEntry); dontAnalyseYetFlag = false; }
private void onAccountChanged(object sender, EventArgs e) { if (comboBox1.Text.Equals("Add a new Account")) { addAccount window = new addAccount(); window.Show(); } else { mainAccount = comboBox1.Text; Utility.Settings set = Utility.loadFile <Utility.Settings>("C:\\IronChain\\settings.set"); set.mainAccount = mainAccount; Utility.storeFile(set, "C:\\IronChain\\settings.set"); analyseChain(); label3.Text = returnCoinBalance(accountList[comboBox1.Text].publicKey, latestBlock) + " Iron"; } }
private void addAccountToolStripMenuItem_Click(object sender, EventArgs e) { addAccount window = new addAccount(); window.Show(); }