/// <summary> /// Default constructor. /// Creates instances of all internal classes and sets all default values. /// /// This prevents exception when client cannot load Settings instance from /// XML file - in this case default Settings instance is created. /// Default Settings instance should always contain valid default values. /// </summary> public Settings() { mainWindowStateInfo = new WindowStateInfo(); recentFilesList = new MruInfo(); initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); lineWidth = 1; objectColor = Colors.Black; textFontFamilyName = "Tahoma"; textFontStyle = FontConversions.FontStyleToString(FontStyles.Normal); textFontWeight = FontConversions.FontWeightToString(FontWeights.Normal); textFontStretch = FontConversions.FontStretchToString(FontStretches.Normal); textFontSize = 12; // Set default values for other members here // ... }
public WindowStateManager(WindowStateInfo windowStateInfo, Window ownerWindow) { if ( windowStateInfo == null ) { throw new ArgumentNullException("windowStateInfo"); } if (ownerWindow == null) { throw new ArgumentNullException("ownerWindow"); } this.windowStateInfo = windowStateInfo; this.ownerWindow = ownerWindow; // Subscribe to owner window's events to track window state changes ownerWindow.LocationChanged += new EventHandler(ownerWindow_LocationChanged); ownerWindow.SizeChanged += new SizeChangedEventHandler(ownerWindow_SizeChanged); SetInitialWindowState(); }