private void button_save_Click(object sender, EventArgs e) { //account.api if (account.api.key.Length > 0 && account.api.secret.Length > 0) { EarnGG.EarnGGAccount listItem = PreferenceManager.EarnGGPreferences.EarnGGAccounts.FirstOrDefault(item => item.api.key == account.api.key && item.api.secret == account.api.secret); if (listItem == null) { PreferenceManager.EarnGGPreferences.EarnGGAccounts.Add(account); //PreferenceManager.UpdatePreferenceSnapshots(); PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.EarnGG); EarnGG.UpdateUI(); ParentForm.Close(); } } }
private void button_load_Click(object sender, EventArgs e) { try { EarnGG.EarnGGAccount newAccount = EarnGG.GetAccount(textBox_key.Text, textBox_secret.Text); if (newAccount != null) { //LogManager.AddLogMessage(Name, "button_load_Click", "account=" + account.email, LogManager.LogMessageType.DEBUG); account = newAccount; List <PropertyItem> list = new List <PropertyItem>(); PropertyInfo[] properties = typeof(EarnGG.EarnGGAccount).GetProperties(); foreach (PropertyInfo property in properties) { ///LogManager.AddLogMessage(Name, "button_load_Click", property.Name + " | " + property.GetValue(account), LogManager.LogMessageType.DEBUG); PropertyItem item = new PropertyItem() { Name = property.Name }; if (property.GetValue(account) != null && item.Name != "api") { item.Value = property.GetValue(account).ToString(); list.Add(item); } } listView.SetObjects(list); UpdateUI(true); } } catch (Exception ex) { LogManager.AddLogMessage(Name, "button_load_Click", ex.Message, LogManager.LogMessageType.EXCEPTION); } }