private void cb_profile_list_SelectedIndexChanged(object sender, EventArgs e) { string value = cb_profile_list.SelectedItem.GetType().GetProperty("Value") .GetValue(cb_profile_list.SelectedItem).ToString(); var ch = charList[value]; List_Task.BeginUpdate(); List_Task.Items.Clear(); foreach (var quest in ch.Quests) { if (quest.status.ToLower() == "started") { List_Task.Items.Add(new { Text = GetQuestName(quest.qid), Status = quest.status, Id = quest.qid }); } } List_Task.DisplayMember = "Text"; List_Task.ValueMember = "Id"; List_Task.EndUpdate(); }
private void List_Task_MouseUp(object sender, MouseEventArgs e) { int posindex = List_Task.IndexFromPoint(new Point(e.X, e.Y)); List_Task.ContextMenuStrip = null; if (posindex >= 0 && posindex < List_Task.Items.Count) { List_Task.SelectedIndex = posindex; } if (e.Button == MouseButtons.Right) { CMS_ListTask.Show(List_Task, new Point(e.X, e.Y)); } List_Task.Refresh(); }
private void btn_load_Click(object sender, EventArgs e) { var dirName = cb_profile_list.Text; var profileDir = Path.Combine(ProfilePath, dirName); var characterFilePath = Path.Combine(profileDir, "character.json"); if (File.Exists(characterFilePath)) { var charString = File.ReadAllText(characterFilePath); Character ch = JsonConvert.DeserializeObject <Character>(charString); List_Task.BeginUpdate(); foreach (var chQuest in ch.Quests) { List_Task.Items.Add(new { chQuest.qid, qname = GetTransName(chQuest.qid), chQuest.status }); } List_Task.EndUpdate(); } }