示例#1
0
 /// <summary>
 /// Save card to new file
 /// <param name="cti">CardTabItem containing card to save</param>
 /// </summary>
 private void SaveCardAs(CardTabItem cti)
 {
     CardWF qslCard = cti.cardPanel.QslCard;
     string fileName = qslCard.FileName;
     SaveFileDialog sDialog = new SaveFileDialog();
     sDialog.Filter = "QSL Card(*.xq1)|*.xq1";
     sDialog.InitialDirectory =
         ((App)Application.Current).UserPreferences.DefaultCardFilesFolder;
     if(fileName != null)
     {
         sDialog.FileName = fileName;
     }
     if(sDialog.ShowDialog() == true)
     {
         qslCard.SaveAsXml(sDialog.FileName);
         cti.SetTabLabel();
         SetTitle(sDialog.FileName, qslCard.IsDirty);
         UserPreferences prefs = ((App)App.Current).UserPreferences;
         if(prefs.CardsReloadOnStartup)
         {
             if(fileName != sDialog.FileName)
             {
                 prefs.CardFiles.Remove(fileName);
                 prefs.CardFiles.Add(sDialog.FileName);
                 prefs.SerializeAsXml();
             }
         }
         // If the last property control changed was a color button, then the background
         // color of the button will cycle from 0 to 100% opacity. By moving focus to a
         // different control, this will not happen
         cti.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
     }
 }
示例#2
0
 /// <summary>
 /// Save card to file named in Card.FileName
 /// <param name="cti">CardTabItem containing card to save</param>
 /// </summary>
 private void SaveCard(CardTabItem cti)
 {
     CardWF qslCard = cti.cardPanel.QslCard;
     if(qslCard.FileName != null)
     {
         qslCard.SaveAsXml(qslCard.FileName);
         cti.SetTabLabel();
         SetTitle(qslCard.FileName, qslCard.IsDirty);
         // If the last property control changed was a color button, then the background
         // color of the button will cycle from 0 to 100% opacity. By moving focus to a
         // different control, this will not happen
         cti.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
     }
     else
     {
         SaveCardAs(cti);
     }
 }