//save the editor values private void button3_Click_1(object sender, EventArgs e) { if (!FileChecks(label10.Text)) { return; } try { ListUtilities.WriteMemberToList(new ListMember ( label10.Text, Convert.ToInt32(label11.Text), Convert.ToBoolean(label12.Text), Convert.ToInt32(textBox2.Text.Trim()), //Convert.ToUInt64(textBox3.Text.Trim()), new Func <UInt64>(() => { string tbt = textBox3.Text.Trim(); if (tbt.Length > 1) { if (tbt[0] == '*' && tbt[1] == 'h') { tbt = UInt64.Parse(tbt.Substring(2), System.Globalization.NumberStyles.HexNumber) + ""; } } return(Convert.ToUInt64(tbt)); }).Invoke(), textBox4.Text.Trim(), textBox5.Text.Trim(), textBox6.Text.Trim(), textBox7.Text.Trim() )); } catch (Exception ex) { return; } tabControl1.TabPages.Remove(tabPage3); tabControl1.SelectedTab = tabPage2; }
private async Task ModifyLM() { //public ListMember(string source_filename, int source_row, bool is_active, int serial, UInt64 uid, string name, string description, string active_days, string active_times) string table_name = GetSelectedTableName(); if (table_name == null) { MessageBox.Show(this, "A table must be selected to continue."); return; } //if (MessageBox.Show(this, "Are you sure that you want to add this card?", "Prompt", MessageBoxButtons.OKCancel) == DialogResult.Cancel) // return; UInt64 uid = GetUIDFromTextBox(); if (uid > 0) { textBox1.Text = ""; } else { MessageBox.Show(this, "Invalid UID"); return; } int uid_search_result = ListUtilities.FindUID(table_name, uid); if (uid_search_result > -1 && prompt_if_exists) { if (MessageBox.Show(this, "The UID was found in the selected list. Do you want to continue?", "Prompt", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } ListMember to_update = uid_search_result == -1 ? null : (await ListUtilities.GetListMembers(new string[] { table_name })).Where(x => x.UID.CompareTo(uid) == 1).First(); string[] default_values = GenerateDefaults(selected_default); if (to_update != null) { to_update.ActiveDays = default_values[0]; to_update.ActiveTimes = default_values[1]; ListUtilities.WriteMemberToList(to_update); } else { int next_row_index = ListUtilities.GetRowRange(table_name) + 1; int next_list_serial = ListUtilities.GetSerialRange(table_name) + 1; ListUtilities.WriteMemberToList(new ListMember( table_name, next_row_index, false, next_list_serial, uid, "", "", default_values[0], default_values[1])); } }