/// <summary> /// Set the status of window. /// </summary> /// <param name="window"></param> /// <param name="windowState"></param> private static void SetWindowStatus(MainWindow window, WindowStateStruct windowState) { window.WindowState = windowState.WindowState; window.Left = windowState.Left; window.Top = windowState.Top; window.Width = windowState.Width; window.Height = windowState.Height; NormalizeFormScreen(window, windowState.Screen); }
/// <summary> /// Parse WindowState. /// </summary> /// <param name="xmlIn"></param> /// <returns></returns> private static WindowStateStruct LoadWindowState(XmlTextReader xmlIn) { while (!xmlIn.Name.Equals("Form")) { if (!MoveToNextElement(xmlIn)) throw new ArgumentException(); } EnumConverter windowStateConverter = new EnumConverter(typeof(FormWindowState)); WindowStateStruct windowState = new WindowStateStruct(); windowState.WindowState = (FormWindowState)windowStateConverter.ConvertFrom(xmlIn.GetAttribute("WindowState")); windowState.Left = Convert.ToInt32(xmlIn.GetAttribute("Left"), CultureInfo.InvariantCulture); windowState.Top = Convert.ToInt32(xmlIn.GetAttribute("Top"), CultureInfo.InvariantCulture); windowState.Height = Convert.ToInt32(xmlIn.GetAttribute("Height"), CultureInfo.InvariantCulture); windowState.Width = Convert.ToInt32(xmlIn.GetAttribute("Width"), CultureInfo.InvariantCulture); windowState.Screen = Convert.ToInt32(xmlIn.GetAttribute("Screen"), CultureInfo.InvariantCulture); return windowState; }