Esempio n. 1
0
        private void ModifyItem()
        {
            string strSource = this.textBoxSourceValue.Text;
            string strTarget = this.textBoxTargetValue.Text;

            if (strSource.Length < 1 && strTarget.Length < 1)
            {
                return;
            }

            if (this.listViewLUTList.SelectedItems.Count < 1)
            {
                return;
            }
            LUTItemMgt lut = this.listViewLUTList.SelectedItems[0].Tag as LUTItemMgt;

            if (lut == null)
            {
                return;
            }

            if (this.listViewLUTItem.SelectedItems.Count < 1)
            {
                return;
            }
            LUTItem item = this.listViewLUTItem.SelectedItems[0].Tag as LUTItem;

            if (item == null)
            {
                return;
            }

            LUTItem newItem = new LUTItem();

            newItem.SourceValue = strSource;
            newItem.TargetValue = strTarget;

            if (!CheckRepeat(newItem))
            {
                return;
            }

            item.SourceValue = strSource;
            item.TargetValue = strTarget;

            if (lut.Update(item))
            {
                lut.ReloadLUT();
                RefreshItemList(lut);
                ListViewSelectItem(item);
            }
            else
            {
                MessageBox.Show(this, "Modify look up table item failed.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void DeleteItem()
        {
            if (this.listViewLUTList.SelectedItems.Count < 1)
            {
                return;
            }
            LUTItemMgt lut = this.listViewLUTList.SelectedItems[0].Tag as LUTItemMgt;

            if (lut == null)
            {
                return;
            }

            if (this.listViewLUTItem.SelectedItems.Count < 1)
            {
                return;
            }
            LUTItem item = this.listViewLUTItem.SelectedItems[0].Tag as LUTItem;

            if (item == null)
            {
                return;
            }

            if (lut.Delete(item))
            {
                lut.ReloadLUT();
                RefreshItemList(lut);
                RefreshItemButton();
            }
            else
            {
                MessageBox.Show(this, "Delete look up table item failed.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }