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