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