private PhraseDescriptor GetPhraseByListViewItem(ListViewItem listViewItem)
        {
            PhraseDescriptor    result = null;
            ConditionDescriptor conditionDescriptor = this.conditionListView.GetRowFromItem(listViewItem) as ConditionDescriptor;

            if (conditionDescriptor != null)
            {
                result = this.GetPhraseByIndex(conditionDescriptor.Index);
            }
            return(result);
        }
        private void conditionListView_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ConditionDescriptor conditionDescriptor = this.conditionListView.GetRowFromItem(this.conditionListView.Items[e.Index]) as ConditionDescriptor;

            if (conditionDescriptor != null)
            {
                PhraseDescriptor phraseByIndex = this.GetPhraseByIndex(conditionDescriptor.Index);
                if (phraseByIndex != null)
                {
                    phraseByIndex.Used = (e.NewValue == CheckState.Checked);
                }
            }
            base.UpdateError();
        }
 private void UpdateConditionItem(PhraseDescriptor phraseDescriptor)
 {
     if (this.ConditionDescriptors != null && phraseDescriptor != null)
     {
         ConditionDescriptor conditionByIndex = this.GetConditionByIndex(phraseDescriptor.Index);
         if (conditionByIndex != null)
         {
             ListViewItem itemFromRow = this.conditionListView.GetItemFromRow(conditionByIndex);
             if (itemFromRow != null)
             {
                 itemFromRow.Checked = phraseDescriptor.Used;
             }
         }
     }
 }
        private ConditionDescriptor GetConditionByIndex(int index)
        {
            ConditionDescriptor result = null;

            if (this.ConditionDescriptors != null)
            {
                foreach (ConditionDescriptor conditionDescriptor in this.ConditionDescriptors)
                {
                    if (conditionDescriptor.Index == index)
                    {
                        result = conditionDescriptor;
                        break;
                    }
                }
            }
            return(result);
        }