public override void EditItem(BaseDetailDirective oldItem, BaseDetailDirective modifiedItem) { string[] itemsString = GetItemString(modifiedItem); BaseDetailDirective detail = GetDirectiveReferenceByDirectiveID(modifiedItem.ID); if (detail == null) { return; } ListViewItem listViewItem = ItemsHash[detail]; listViewItem.SubItems.Clear(); if (!modifiedItem.Closed) { listViewItem.ForeColor = Color.Black; } listViewItem.Text = itemsString[0]; for (int i = 1; i < itemsString.Length; i++) { listViewItem.SubItems.Add(itemsString[i]); } listViewItem.BackColor = UsefulMethods.GetDirectiveColor(modifiedItem); listViewItem.Tag = modifiedItem; ItemsHash.Remove(modifiedItem); ItemsHash.Add(modifiedItem, listViewItem); ItemsListView.Refresh(); SetTotalText(); }
/// <summary> /// Добавляет элемент с указанием группы в которой он находится /// </summary> /// <param name="item">Добавляемый элемент</param> protected override ListViewItem AddItem(BaseDetailDirective item) { string[] itemsString = GetItemString(item); ListViewItem listViewItem = new ListViewItem(itemsString); if (!item.Closed) { listViewItem.ForeColor = Color.Black; } listViewItem.BackColor = UsefulMethods.GetDirectiveColor(item); listViewItem.Tag = item; ItemsHash.Add(item, listViewItem); ListViewItemList.Add(listViewItem); return(listViewItem); }
private void LoadListViewItem(BaseDetailDirective item, ref ListViewItem listViewItem) { if (item.AtaChapter != null) { listViewItem.SubItems.Add(item.AtaChapter.FullName); } else { listViewItem.SubItems.Add("0"); } if (!item.Closed) { listViewItem.ForeColor = Color.Black; } listViewItem.BackColor = UsefulMethods.GetDirectiveColor(item); listViewItem.Tag = item; }