Exemple #1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="width">Width of the card in device independent units</param>
        /// <param name="height">Height of the card in device independent units</param>
        /// <param name="isInDesignMode">Boolean to indicate if this image is to be displayed
        /// in design mode</param>
        public Card(double width, double height, bool isInDesignMode)
            : base(new Rect(0, 0, width, height), isInDesignMode)
        {
            userPreferences = ((App)Application.Current).UserPreferences;
            // card properties
            // background image
            BackImage = new BackgroundImage(isInDesignMode);
            BackImage.QslCard = this;
            // call text item
            TextItem call = new TextItem(isInDesignMode);
            call.QslCard = this;
            foreach(TextPart part in userPreferences.Callsign)
            {
                call.Text.Add(part);
            }
            call.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            call.TextFontWeight = FontWeights.Black;
            call.FontSize = 72.0;
            call.DisplayX = -70;
            call.DisplayY = 0;
            call.DisplayWidth = 0;
            call.DisplayHeight = 0;
            TextItems.Add(call);
            // name Qth text item
            TextItem nameQth = new TextItem(isInDesignMode);
            nameQth.QslCard = this;
            foreach(TextPart part in userPreferences.NameQth)
            {
                nameQth.Text.Add(part);
            }
            nameQth.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            nameQth.TextFontWeight = FontWeights.Normal;
            nameQth.FontSize = 12.0;
            nameQth.DisplayX = DisplayWidth / 2;
            nameQth.DisplayY = 15;
            nameQth.DisplayWidth = 0;
            nameQth.DisplayHeight = 0;
            TextItems.Add(nameQth);
            // salutation
            TextItem salutation = new TextItem(isInDesignMode);
            salutation.QslCard = this;
            foreach(TextPart part in userPreferences.Salutation)
            {
                salutation.Text.Add(part);
            }
            salutation.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            salutation.FontSize = 12.0;
            salutation.DisplayX = 5;
            salutation.DisplayY = DisplayHeight - 25;
            salutation.DisplayWidth = 0;
            salutation.DisplayHeight = 0;
            TextItems.Add(salutation);

            // QsosBox
            qsosBox = new QsosBox(isInDesignMode);
            qsosBox.QslCard = this;
            // more card properties
            QslCard = this;
            IsDirty = false;
        }
Exemple #2
0
 /// <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);
     }
 }