/// <summary> /// Checks the MainWindow for visibility when re-starting application /// (with different screen configuration). /// </summary> /// <param name="SystemParameters_VirtualScreenLeft"></param> /// <param name="SystemParameters_VirtualScreenTop"></param> public void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop) { var defaultWindow = new ViewPosSizeModel(100, 100, 600, 500); if (WindowPosSz == null) { WindowPosSz = new SerializableDictionary <string, ViewPosSizeModel>(); WindowPosSz.Add("MainWindow", defaultWindow); } else { ViewPosSizeModel win; if (WindowPosSz.TryGetValue(MainWindowName, out win) == true) { if (win.DefaultConstruct == true) { WindowPosSz.Remove(MainWindowName); WindowPosSz.Add(MainWindowName, defaultWindow); } } } defaultWindow.SetValidPos(SystemParameters_VirtualScreenLeft, SystemParameters_VirtualScreenTop); }
/// <summary> /// Checks the MainWindow for visibility when re-starting application /// (with different screen configuration). /// </summary> /// <param name="SystemParameters_VirtualScreenLeft"></param> /// <param name="SystemParameters_VirtualScreenTop"></param> public void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop) { var defaultWindow = new ViewPosSizeModel(ViewPosSizeModel.DefaultSize); if (WindowPosSz == null) { WindowPosSz = new SerializableDictionary <string, ViewPosSizeModel>(); WindowPosSz.Add(MainWindowName, defaultWindow); } else { ViewPosSizeModel win; if (WindowPosSz.TryGetValue(MainWindowName, out win) == true) { if (win.DefaultConstruct == true) { WindowPosSz.Remove(MainWindowName); WindowPosSz.Add(MainWindowName, defaultWindow); } } } // Ensure window visibility on different screens and sizes... defaultWindow.SetValidPos(SystemParameters_VirtualScreenLeft, SystemParameters_VirtualScreenTop); }
/// <summary> /// Updates or inserts the requested window pos size item in the collection. /// </summary> /// <param name="windowName"></param> /// <param name="model"></param> /// <returns></returns> public void UpdateInsertWindowPosSize(string windowName, ViewPosSizeModel model) { ViewPosSizeModel checkModel; if (WindowPosSz.TryGetValue(windowName, out checkModel) == true) WindowPosSz.Remove(windowName); WindowPosSz.Add(windowName, model); }