Exemple #1
0
 /// <summary>
 /// Save the Window Size, Location and State to the settings object
 /// </summary>
 protected virtual void SaveWindowState()
 {
     UserOptions.WindowProperties _props = null;
     if (FileManager.Configuration.Options.WindowsOptions.Windows.ContainsKey(this.window.GetType().FullName))
     {
         _props = FileManager.Configuration.Options.WindowsOptions.Windows[this.window.GetType().FullName];
     }
     else
     {
         _props = new UserOptions.WindowProperties();
         FileManager.Configuration.Options.WindowsOptions.Windows.Add(this.window.GetType().FullName, _props);
     }
     //_props.Position = this.window.RestoreBounds;
     _props.Position = new Rect(this.window.Left + m_Left_Correction, this.window.Top + m_Top_Correction, this.window.ActualWidth, this.window.ActualHeight);
     _props.State    = this.window.WindowState;
 }
Exemple #2
0
        /// <summary>
        /// Load the Window Size Location and State from the settings object
        /// </summary>
        protected virtual void LoadWindowState()
        {
            if (FileManager.Configuration.Options.WindowsOptions.Windows.ContainsKey(this.window.GetType().FullName))
            {
                UserOptions.WindowProperties _props = FileManager.Configuration.Options.WindowsOptions.Windows[this.window.GetType().FullName];
                if (_props.Position != Rect.Empty)
                {
                    this.window.WindowState = _props.State;

                    this.window.Left   = Math.Max(-16, _props.Position.X);
                    this.window.Top    = Math.Max(-16, _props.Position.Y);
                    m_Left_Correction  = Math.Max(-16, _props.Position.X - this.window.Left);
                    m_Top_Correction   = Math.Max(-16, _props.Position.Y - this.window.Top);
                    this.window.Width  = _props.Position.Width;
                    this.window.Height = _props.Position.Height;

                    this.window.WindowStartupLocation = WindowStartupLocation.Manual;
                }
            }
        }