예제 #1
0
        private void NewMI_Click(object sender, EventArgs e)
        {
            try {
                FilterOperand operand = new FilterOperandEditDlg().ShowDialog(m_session, m_elements, m_index, null);

                if (operand == null)
                {
                    return;
                }

                // insert after the current selection.
                int index = ItemsLV.SelectedIndices.Count;

                if (ItemsLV.SelectedIndices.Count > 0)
                {
                    index = ItemsLV.SelectedIndices[0] + 1;
                }

                AddItem(operand, "SimpleItem", index);

                // must update index for all items.
                for (int ii = 0; ii < ItemsLV.Items.Count; ii++)
                {
                    UpdateItem(ItemsLV.Items[ii], ItemsLV.Items[ii].Tag, ii);
                }

                AdjustColumns();

                m_elements[m_index].FilterOperands.Clear();
                m_elements[m_index].SetOperands(GetOperands());
            } catch (Exception exception) {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
        private void NewMI_Click(object sender, EventArgs e)
        {
            try
            {
                FilterOperand operand = new FilterOperandEditDlg().ShowDialog(m_session, m_elements, m_index, null);

                if (operand == null)
                {
                    return;
                }              

                // insert after the current selection.
                int index = ItemsLV.SelectedIndices.Count;

                if (ItemsLV.SelectedIndices.Count > 0)
                {
                    index = ItemsLV.SelectedIndices[0]+1;
                }

                AddItem(operand, "SimpleItem", index);

                // must update index for all items.
                for (int ii = 0; ii < ItemsLV.Items.Count; ii++)
                {
                    UpdateItem(ItemsLV.Items[ii], ItemsLV.Items[ii].Tag, ii);
                }
                
                AdjustColumns();

                m_elements[m_index].FilterOperands.Clear();
                m_elements[m_index].SetOperands(GetOperands());
            }
            catch (Exception exception)
            {
				GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }