/// <summary> /// Create a deep clone of this card /// </summary> /// <returns>Card that is a deep clone of this one</returns> public Card Clone() { Card card = new Card(); card.BackImage = new BackgroundImage(); card.CopyCardProperties(this); card.BackImage = new BackgroundImage(); card.BackImage.CopyImageProperties(card, BackImage); foreach(SecondaryImage si in SecondaryImages) { SecondaryImage si2 = new SecondaryImage(); si2.CopyImageProperties(card, si); card.SecondaryImages.Add(si2); } foreach(TextItem ti in TextItems) { TextItem ti2 = new TextItem(); ti2.CopyTextItem(card, ti); card.TextItems.Add(ti2); } if(QsosBox != null) { card.QsosBox = new QsosBox(); card.QsosBox.CopyQsosBoxProperties(card, QsosBox); } return card; }
/// <summary> /// Load values for this Card from QslDnP card file contents /// </summary> /// <param name="itemNode">The Card node</param> /// <param name="culture">CultureInfo that the card was created in</param> private void LoadCard(XmlNode cardNode, CultureInfo culture) { XmlNode node = XmlProcs.GetFirstChildElement(cardNode); while(node != null) { switch(node.Name) { case "CardItem": base.Load(node, culture); QslCard = this; // upper left corner of hamqsler cards always 0, 0 QslCard.DisplayX = 0; QslCard.DisplayY = 0; break; case "BackgroundImage": BackImage = new BackgroundImage(true); BackImage.Load(node, culture); BackImage.QslCard = this; break; case "SecondaryImage": SecondaryImage sImage = new SecondaryImage(); sImage.Load(node, culture); SecondaryImages.Add(sImage); sImage.QslCard = this; break; case "TextItem": TextItem ti = new TextItem(); ti.Load(node, culture); TextItems.Add(ti); ti.QslCard = this; break; case "QsosBox": QsosBox = new QsosBox(true); QsosBox.Load(node, culture); QsosBox.QslCard = this; break; } node = XmlProcs.GetNextSiblingElement(node); } }
/// <summary> /// Adds a SecondaryImage to the card. No image is actually loaded; this must be done /// from the SecondaryImageProperties panel. /// </summary> public void AddImage() { SecondaryImage si = new SecondaryImage(); SecondaryImages.Add(si); si.QslCard = this; CardItem ci = GetHighlighted(); if(ci != null) { ci.IsHighlighted = false; } si.IsSelected = true; IsDirty = true; }