/// <summary>
        /// Binds a <see cref="ConditionalTypePattern"/> to the list displaying the
        /// <see cref="ConditionalOptionTypeResolver"/>'s patterns.
        /// </summary>
        /// <param name="p_ctpPattern">The <see cref="ConditionalTypePattern"/> to bind.</param>
        protected void AddConditionalTypePattern(ConditionalTypePattern p_ctpPattern)
        {
            ListViewItem lviType = new ListViewItem(p_ctpPattern.Type.ToString());

            lviType.SubItems[0].Name = "Type";
            lviType.SubItems.Add(ViewModel.GetConditionString(p_ctpPattern.Condition));
            lviType.SubItems[1].Name = "Condition";
            lviType.Tag = p_ctpPattern;
            lvwConditionalTypes.Items.Add(lviType);
        }
		/// <summary>
		/// Binds the <see cref="ConditionalTypePattern"/> being edited to the UI.
		/// </summary>
		/// <param name="p_ctpPattern">The <see cref="ConditionalTypePattern"/> being edited.</param>
		protected void BindConditionalTypePattern(ConditionalTypePattern p_ctpPattern)
		{
			erpErrors.SetError(butSave, null);
			if (p_ctpPattern == null)
			{
				butSave.Text = "Add";
				return;
			}
			else
				butSave.Text = "Save";
			cbxType.SelectedItem = p_ctpPattern.Type;
		}
        /// <summary>
        /// Handles the <see cref="NodeEditors.ConditionalTypeEditorVM.PatternDeleted"/> event of the view model.
        /// </summary>
        /// <remarks>
        /// This removes the deleted <see cref="ConditionalTypePattern"/> from the list of patterns.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="EventArgs{ConditionalTypePattern}"/> describing the event arguments.</param>
        private void PatternDeleted(object sender, EventArgs <ConditionalTypePattern> e)
        {
            ConditionalTypePattern ctpPattern = e.Argument;

            for (Int32 i = lvwConditionalTypes.Items.Count - 1; i >= 0; i--)
            {
                if (lvwConditionalTypes.Items[i].Tag == ctpPattern)
                {
                    lvwConditionalTypes.Items.RemoveAt(i);
                    break;
                }
            }
            AdjustColumnWidths();
        }
 /// <summary>
 /// Binds the <see cref="ConditionalTypePattern"/> being edited to the UI.
 /// </summary>
 /// <param name="p_ctpPattern">The <see cref="ConditionalTypePattern"/> being edited.</param>
 protected void BindConditionalTypePattern(ConditionalTypePattern p_ctpPattern)
 {
     erpErrors.SetError(butSave, null);
     if (p_ctpPattern == null)
     {
         butSave.Text = "Add";
         return;
     }
     else
     {
         butSave.Text = "Save";
     }
     cbxType.SelectedItem = p_ctpPattern.Type;
 }
        /// <summary>
        /// Handles the <see cref="NodeEditors.ConditionalTypeEditorVM.PatternEdited"/> event of the view model.
        /// </summary>
        /// <remarks>
        /// This updates the binding to the list of patterns of the edited <see cref="ConditionalTypePattern"/>.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="EventArgs{ConditionalTypePattern}"/> describing the event arguments.</param>
        private void PatternEdited(object sender, EventArgs <ConditionalTypePattern> e)
        {
            ConditionalTypePattern ctpPattern = e.Argument;
            ListViewItem           lviPattern = null;

            for (Int32 i = lvwConditionalTypes.Items.Count - 1; i >= 0; i--)
            {
                if (lvwConditionalTypes.Items[i].Tag == ctpPattern)
                {
                    lviPattern = lvwConditionalTypes.Items[i];
                    break;
                }
            }

            lviPattern.SubItems["Type"].Text      = ctpPattern.Type.ToString();
            lviPattern.SubItems["Condition"].Text = ViewModel.GetConditionString(ctpPattern.Condition);
            AdjustColumnWidths();
        }
Пример #6
0
 /// <summary>
 /// Performs the <see cref="DeleteCommand"/> work.
 /// </summary>
 /// <remarks>
 /// This removes the given pattern from the <see cref="ConditionalOptionTypeResolver"/> being edited. This
 /// also raises the <see cref="PatternDeleted"/> event.
 /// </remarks>
 /// <param name="p_ctpArgument">The conditional type pattern to delete.</param>
 private void DeleteConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
 {
     TypeResolver.ConditionalTypePatterns.Remove(p_ctpArgument);
     PatternDeleted(this, new EventArgs <ConditionalTypePattern>(p_ctpArgument));
 }
Пример #7
0
 /// <summary>
 /// Performs the <see cref="AddCommand"/> work.
 /// </summary>
 /// <remarks>
 /// This sets the currently edited <see cref="ConditionalTypePattern"/> on the
 /// <see cref="NodeEditors.ConditionalTypePatternEditorVM"/> view model to a new pattern.
 /// </remarks>
 /// <param name="p_ctpArgument">The conditional type pattern to add. This is always ignored.</param>
 private void AddConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
 {
     ConditionalTypePatternEditorVM.ConditionalTypePattern = null;
 }
Пример #8
0
 /// <summary>
 /// Performs the <see cref="EditCommand"/> work.
 /// </summary>
 /// <remarks>
 /// This sets the given <see cref="ConditionalTypePattern"/> to be the currently edited pattern on the
 /// <see cref="NodeEditors.ConditionalTypePatternEditorVM"/> view model.
 /// </remarks>
 /// <param name="p_ctpArgument">The conditional type pattern to edit.</param>
 private void EditConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
 {
     ConditionalTypePatternEditorVM.ConditionalTypePattern = p_ctpArgument;
 }
		/// <summary>
		/// Binds a <see cref="ConditionalTypePattern"/> to the list displaying the
		/// <see cref="ConditionalOptionTypeResolver"/>'s patterns.
		/// </summary>
		/// <param name="p_ctpPattern">The <see cref="ConditionalTypePattern"/> to bind.</param>
		protected void AddConditionalTypePattern(ConditionalTypePattern p_ctpPattern)
		{
			ListViewItem lviType = new ListViewItem(p_ctpPattern.Type.ToString());

			lviType.SubItems[0].Name = "Type";
			lviType.SubItems.Add(ViewModel.GetConditionString(p_ctpPattern.Condition));
			lviType.SubItems[1].Name = "Condition";
			lviType.Tag = p_ctpPattern;
			lvwConditionalTypes.Items.Add(lviType);
		}
		/// <summary>
		/// Performs the <see cref="DeleteCommand"/> work.
		/// </summary>
		/// <remarks>
		/// This removes the given pattern from the <see cref="ConditionalOptionTypeResolver"/> being edited. This
		/// also raises the <see cref="PatternDeleted"/> event.
		/// </remarks>
		/// <param name="p_ctpArgument">The conditional type pattern to delete.</param>
		private void DeleteConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
		{
			TypeResolver.ConditionalTypePatterns.Remove(p_ctpArgument);
			PatternDeleted(this, new EventArgs<ConditionalTypePattern>(p_ctpArgument));
		}
		/// <summary>
		/// Performs the <see cref="AddCommand"/> work.
		/// </summary>
		/// <remarks>
		/// This sets the currently edited <see cref="ConditionalTypePattern"/> on the
		/// <see cref="NodeEditors.ConditionalTypePatternEditorVM"/> view model to a new pattern. 
		/// </remarks>
		/// <param name="p_ctpArgument">The conditional type pattern to add. This is always ignored.</param>
		private void AddConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
		{
			ConditionalTypePatternEditorVM.ConditionalTypePattern = null;
		}
		/// <summary>
		/// Performs the <see cref="EditCommand"/> work.
		/// </summary>
		/// <remarks>
		/// This sets the given <see cref="ConditionalTypePattern"/> to be the currently edited pattern on the
		/// <see cref="NodeEditors.ConditionalTypePatternEditorVM"/> view model.
		/// </remarks>
		/// <param name="p_ctpArgument">The conditional type pattern to edit.</param>
		private void EditConditionalTypePattern(ConditionalTypePattern p_ctpArgument)
		{
			ConditionalTypePatternEditorVM.ConditionalTypePattern = p_ctpArgument;
		}
		/// <summary>
		/// A simple constructor that initializes the view model with its dependencies.
		/// </summary>
		/// <param name="p_cemConditionEditorVM">The <see cref="NodeEditors.ConditionEditorVM"/> that encapsulates the data
		/// and operations for diaplying the <see cref="ICondition"/> editor.</param>
		/// <param name="p_ctpConditionalTypePattern">The <see cref="ConditionalTypePattern"/> being edited.</param>
		public ConditionalTypePatternEditorVM(ConditionEditorVM p_cemConditionEditorVM, ConditionalTypePattern p_ctpConditionalTypePattern)
		{
			ConditionEditorVM = p_cemConditionEditorVM;
			ConditionalTypePattern = p_ctpConditionalTypePattern;
			OptionTypes = Enum.GetValues(typeof(OptionType));
		}
 /// <summary>
 /// A simple constructor that initializes the view model with its dependencies.
 /// </summary>
 /// <param name="p_cemConditionEditorVM">The <see cref="NodeEditors.ConditionEditorVM"/> that encapsulates the data
 /// and operations for diaplying the <see cref="ICondition"/> editor.</param>
 /// <param name="p_ctpConditionalTypePattern">The <see cref="ConditionalTypePattern"/> being edited.</param>
 public ConditionalTypePatternEditorVM(ConditionEditorVM p_cemConditionEditorVM, ConditionalTypePattern p_ctpConditionalTypePattern)
 {
     ConditionEditorVM      = p_cemConditionEditorVM;
     ConditionalTypePattern = p_ctpConditionalTypePattern;
     OptionTypes            = Enum.GetValues(typeof(OptionType));
 }