private void biImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.openFileDialog1.ShowDialog() != DialogResult.OK) { return; } AccountsData data = new AccountsData(); data.FileName = this.saveFileDialog1.FileName; data.RestoreFromXml(); int count = 0; foreach (AccountInfo account in data.Accounts) { if (Keys.FirstOrDefault(a => a.ApiKey == account.ApiKey) != null) { continue; } count++; account.Exchange = Exchange.Registered.FirstOrDefault(ee => ee.Type == account.Type); Keys.Add(account); } if (count < data.Accounts.Count) { XtraMessageBox.Show("Api Keys successfully imported. However some Api Keys skipped, because they are already added."); } else { XtraMessageBox.Show("All Api Keys successfully imported."); } }
private void btExportToFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.saveFileDialog1.ShowDialog() != DialogResult.OK) { return; } AccountsData data = new AccountsData(); data.Accounts.AddRange(Keys); data.FileName = this.saveFileDialog1.FileName; data.SaveToXml(); System.Diagnostics.Process.Start(Path.GetDirectoryName(data.FileName)); }