/// <summary> /// Create a deep clone of this ManagerExistsMacro /// </summary> /// <returns>ManagerExistsMacro that is a deep copy of this one</returns> public override TextPart Clone() { ManagerExistsMacro meMacro = new ManagerExistsMacro(); meMacro.DesignText.Clear(); foreach(TextPart part in DesignText) { meMacro.DesignText.Add(part.Clone()); } meMacro.ExistsText.Clear(); foreach(TextPart part in ExistsText) { meMacro.ExistsText.Add(part.Clone()); } meMacro.DoesntExistText.Clear(); foreach(TextPart part in DoesntExistText) { meMacro.DoesntExistText.Add(part.Clone()); } return meMacro; }
/// <summary> /// Executed event handler for the InsertManagerExistsMacroBefore menu item /// </summary> /// <param name="sender">not used</param> /// <param name="e">not used</param> private void OnInsertManagerExistsMacroBeforeCommand_Executed(object sender, ExecutedRoutedEventArgs e) { // create a new ManagerExistsMacro object and add it to the TextItems. ManagerExistsMacro mMacro = new ManagerExistsMacro(); int position = GetPosition(); if(position != -1) { PartItems.Insert(position, mMacro); UpdateDialog(); // redraw the Dialog contents } }