/// <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; }
/// <summary> /// default constructor (called when loading Card from XML) /// </summary> public Card() { userPreferences = ((App)Application.Current).UserPreferences; DisplayX = 0; DisplayY = 0; DisplayWidth = 0; DisplayHeight = 0; QslCard = this; }
private static int BEEPFREQUENCY = 800; // Hz #endregion Fields #region Constructors public UserPreferencesDialog() { InitializeComponent(); printPropertiesPanel.printerPropertiesGroupBox.Header = "Default Printer Properties"; printPropertiesPanel.printPropertiesGroupBox.Header = "Default Print Properties"; printPropertiesPanel.cardsLayoutGroupBox.Visibility = Visibility.Collapsed; printPropertiesPanel.PrintPropertiesChanged += OnPrintPropertiesChanged; Mouse.OverrideCursor = Cursors.Arrow; // create a clone of the UserPreferences object UserPrefs = new UserPreferences(((App)Application.Current).UserPreferences); propertiesDisplay.DataContext = UserPrefs; if(UserPrefs.Callsign.Count == 1 && UserPrefs.Callsign[0].GetType() == typeof(StaticText)) { CallsignTextBox.DataContext = (StaticText)UserPrefs.Callsign[0]; } else { CallsignTextBox.Visibility = Visibility.Collapsed; } if(UserPrefs.NameQth.Count == 1 && UserPrefs.NameQth[0].GetType() == typeof(StaticText)) { NameQthTextBox.DataContext = (StaticText)UserPrefs.NameQth[0]; } else { NameQthTextBox.Visibility = Visibility.Collapsed; } if(UserPrefs.Salutation.Count == 1 && UserPrefs.Salutation[0].GetType() == typeof(StaticText)) { SalutationTextBox.DataContext = (StaticText)UserPrefs.Salutation[0]; } else { SalutationTextBox.Visibility = Visibility.Collapsed; } if(UserPrefs.ConfirmingText.Count == 1 && UserPrefs.ConfirmingText[0].GetType() == typeof(StaticText)) { ConfirmingTextBox.DataContext = (StaticText)UserPrefs.ConfirmingText[0]; } else { ConfirmingTextBox.Visibility = Visibility.Collapsed; } // load list of font names that are available to Windows Forms System.Drawing.Text.InstalledFontCollection fontCol = new System.Drawing.Text.InstalledFontCollection(); foreach(System.Drawing.FontFamily family in fontCol.Families) { DefaultTextItemsFontFaceComboBox.Items.Add(family.Name); DefaultQsosBoxFontFaceComboBox.Items.Add(family.Name); } }
/// <summary> /// Create the user preferences object. Actual work is done in UserPreferences class /// </summary> /// <param name="userPrefsIntialized">boolean indicating whether the prefs obejct was /// initialized.</param> /// <param name="userPrefsError">boolean indicating if an error occurred while loading /// the prefs object</param> internal void GetUserPreferences( out bool userPrefsIntialized, out bool userPrefsError) { userPrefs = UserPreferences.CreateUserPreferences(false, out userPrefsIntialized, out userPrefsError); }
/// <summary> /// Constructor used to create a clone of a UserPrefs object /// </summary> /// <param name="userPrefs">UserPreferences object to clone</param> public UserPreferences(UserPreferences prefs) { CheckForNewVersions = prefs.CheckForNewVersions; CheckForDevelopmentVersions = prefs.CheckForDevelopmentVersions; HttpProxyServer = prefs.HttpProxyServer; HttpProxyServerPortNumber = prefs.HttpProxyServerPortNumber; DefaultAdifFilesFolder = prefs.DefaultAdifFilesFolder; AdifReloadOnStartup = prefs.AdifReloadOnStartup; AdifFiles = prefs.AdifFiles; DefaultImagesFolder = prefs.DefaultImagesFolder; CardsReloadOnStartup = prefs.CardsReloadOnStartup; CardFiles = prefs.CardFiles; DefaultCardFilesFolder = prefs.DefaultCardFilesFolder; DefaultPrinterName = prefs.DefaultPrinterName; DefaultPaperSize = prefs.DefaultPaperSize; DefaultPrinterResolution = prefs.DefaultPrinterResolution; DefaultPaperSource = prefs.DefaultPaperSource; InsideMargins = prefs.InsideMargins; PrintCardOutlines = prefs.PrintCardOutlines; FillLastPage = prefs.FillLastPage; SetCardMargins = prefs.SetCardMargins; DefaultTextItemsFontFace = prefs.DefaultTextItemsFontFace; SetValue(CallsignPropertyKey, new TextParts()); foreach(TextPart part in prefs.Callsign) { Callsign.Add(part); } SetValue(NameQthPropertyKey, new TextParts()); foreach(TextPart part in prefs.NameQth) { NameQth.Add(part); } SetValue(SalutationPropertyKey, new TextParts()); foreach(TextPart part in prefs.Salutation) { Salutation.Add(part); } DefaultQsosBoxFontFace = prefs.DefaultQsosBoxFontFace; SetValue(ConfirmingTextPropertyKey, new TextParts()); foreach(TextPart part in prefs.ConfirmingText) { ConfirmingText.Add(part); } SetValue(ConfirmingTextPropertyKey, new TextParts()); foreach(TextPart part in prefs.ConfirmingText) { ConfirmingText.Add(part); } ViaText = prefs.ViaText; YYYYMMDDText = prefs.YYYYMMDDText; DDMMMYYText = prefs.DDMMMYYText; DDMMYYText = prefs.DDMMYYText; DefaultDateFormat = prefs.DefaultDateFormat; TimeText = prefs.TimeText; ModeText = prefs.ModeText; BandText = prefs.BandText; FrequencyText = prefs.FrequencyText; RSTText = prefs.RSTText; QSLText = prefs.QSLText; PseText = prefs.PseText; TnxText = prefs.TnxText; JanuaryText = prefs.JanuaryText; FebruaryText = prefs.FebruaryText; MarchText = prefs.MarchText; AprilText = prefs.AprilText; MayText = prefs.MayText; JuneText = prefs.JuneText; JulyText = prefs.JulyText; AugustText = prefs.AugustText; SeptemberText = prefs.SeptemberText; OctoberText = prefs.OctoberText; NovemberText = prefs.NovemberText; DecemberText = prefs.DecemberText; Frequency2190m = prefs.Frequency2190m; Frequency630m = prefs.Frequency630m; Frequency560m = prefs.Frequency560m; Frequency160m = prefs.Frequency160m; Frequency80m = prefs.Frequency80m; Frequency60m = prefs.Frequency60m; Frequency40m = prefs.Frequency40m; Frequency30m = prefs.Frequency30m; Frequency20m = prefs.Frequency20m; Frequency17m = prefs.Frequency17m; Frequency15m = prefs.Frequency15m; Frequency12m = prefs.Frequency12m; Frequency10m = prefs.Frequency10m; Frequency6m = prefs.Frequency6m; Frequency4m = prefs.Frequency4m; Frequency2m = prefs.Frequency2m; Frequency1p25m = prefs.Frequency1p25m; Frequency70cm = prefs.Frequency70cm; Frequency33cm = prefs.Frequency33cm; Frequency23cm = prefs.Frequency23cm; Frequency13cm = prefs.Frequency13cm; Frequency9cm = prefs.Frequency9cm; Frequency6cm = prefs.Frequency6cm; Frequency3cm = prefs.Frequency3cm; Frequency1p25cm = prefs.Frequency1p25cm; Frequency6mm = prefs.Frequency6mm; Frequency4mm = prefs.Frequency4mm; Frequency2p5mm = prefs.Frequency2p5mm; Frequency2mm = prefs.Frequency2mm; Frequency1mm = prefs.Frequency1mm; DebugPrinting = prefs.DebugPrinting; DebugLogging = prefs.DebugLogging; }
/// <summary> /// Helper method that creates a default UserPrefs object /// </summary> /// <param name="prefsInitialized">boolean indicating that the prefs object was created</param> /// <returns></returns> private static UserPreferences CreateDefaultUserPreferences( out bool prefsInitialized) { UserPreferences prefs = new UserPreferences(); prefsInitialized = true; App.Logger.Log("User Preferences have been initialized"); return prefs; }
/// <summary> /// Event handler for DependencyProperty Changed event /// </summary> /// <param name="e">DependencyPropertyChangedEventArgs object</param> protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if(e.Property ==UserPrefsProperty) { // pass the print properties on to printPropertiesPanel UserPreferences prefs = new UserPreferences(UserPrefs); printPropertiesPanel.PrinterName = prefs.DefaultPrinterName; printPropertiesPanel.PrinterPaperSize = prefs.DefaultPaperSize; printPropertiesPanel.Resolution = prefs.DefaultPrinterResolution; printPropertiesPanel.Source = prefs.DefaultPaperSource; printPropertiesPanel.InsideMargins = prefs.InsideMargins; printPropertiesPanel.PrintCardOutlines = prefs.PrintCardOutlines; printPropertiesPanel.FillLastPage = prefs.FillLastPage; printPropertiesPanel.SetCardMargins = prefs.SetCardMargins; } }
public void FixtureSetup() { prefs = new UserPreferences(); prefsType = prefs.GetType(); }