private async Task V2LE_RefreshListEntryEditor() { int lb5_index = listBox5.SelectedIndex; int lb3_index = listBox3.SelectedIndex; ResetListEntryEditor(); if (lb3_index > -1 && V2LE_UsersInCurrentList != null && V2LE_UsersInCurrentList.Count() > 0) { UInt64 selected_list_id = V2LE_ViewingLists.ElementAt(lb5_index).Key; UInt64 selected_user_id = V2LE_UsersInCurrentList.ElementAt(lb3_index).Key; List <Object> list_row = await DatabaseUtilities.GetV2ListEntry(selected_list_id, selected_user_id); if (list_row == null) { return; } string tb6_text = ""; if (ListEntryUtilities.TryParseV2EntryDays((string)list_row[0])) { tb6_text = ListEntryUtilities.ConvertBoolToDOWString(ListEntryUtilities.ConvertDOWStringToBools((string)list_row[0])); } else { tb6_text = "Sunday - Saturday"; } Invoke((MethodInvoker)(() => { textBox5.Text = selected_user_id.ToString(); textBox5.Enabled = true; checkBox2.Checked = (byte)list_row[2] == 0 ? false : true; checkBox2.Enabled = true; textBox6.Text = tb6_text; textBox6.Enabled = true; checkedListBox1.Enabled = true; textBox7.Text = ListEntryUtilities.TryParseV2EntryTime((string)list_row[1]) ? (string)list_row[1] : "00:00 - 23:59"; textBox7.Enabled = true; dateTimePicker1.Enabled = true; dateTimePicker2.Enabled = true; Refresh(); })); } }
//to be called from a non ui thread private async Task V2LE_UA_ListUsers_Refresh(ulong selected_list, string list_user_filter) { if (selected_list != 0) { //use all lists in the search var sqlconn = await ARDBConnectionManager.default_manager.CheckOut(); V2LE_UsersInCurrentList = await DatabaseUtilities.GetDictionaryDescriptionForAllUsersInListWithLimiter(sqlconn.Connection, selected_list, list_user_filter); ARDBConnectionManager.default_manager.CheckIn(sqlconn); //V2LE_UsersInCurrentList = (Dictionary<ulong, string>)V2LE_UsersInCurrentList.OrderBy(x => x.Value); lock (ui_access_lock) Invoke((MethodInvoker)(() => { if (V2LE_UsersInCurrentList == null || V2LE_UsersInCurrentList.Count() == 0) { listBox3.DataSource = null; listBox3.Enabled = false; textBox2.BackColor = Color.LightGray; } else { listBox3.DataSource = V2LE_UsersInCurrentList.Values.ToList(); listBox3.Enabled = true; textBox2.BackColor = SystemColors.Window; } textBox2.Enabled = true; button12.Enabled = true; Refresh(); })); } }