Ejemplo n.º 1
0
        private void ReloadLocation(FormStateConfigElement lastFormState)
        {
            if (this.form.StartPosition != FormStartPosition.Manual)
            {
                return;
            }

            this.form.Location = lastFormState.Location;
            this.EnsureVisibleScreenArea();
            this.lastNormalLocation = this.form.Location;
        }
Ejemplo n.º 2
0
        private void ReloadSize(FormStateConfigElement lastFormState)
        {
            if (this.form.FormBorderStyle != FormBorderStyle.Sizable &&
                this.form.FormBorderStyle != FormBorderStyle.SizableToolWindow)
            {
                return;
            }

            this.form.Size      = lastFormState.Size;
            this.lastNormalSize = this.form.Size;
        }
Ejemplo n.º 3
0
        private FormStateConfigElement PrepareStateToSave()
        {
            var formSettings = new FormStateConfigElement(this.form.Name);

            this.SetFormSizeAndLocation(formSettings);

            if (this.form.WindowState != FormWindowState.Minimized)
            {
                formSettings.State = this.form.WindowState;
            }
            return(formSettings);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Consider dont use on move and resize because of performance
        /// </summary>
        private void SaveFormState()
        {
            if (!this.saveSettings || !this.Enabled)
            {
                return;
            }

            FormStateConfigElement formSettings = this.PrepareStateToSave();

            this.Settings.AddForm(formSettings);
            settings.SaveAndFinishDelayedUpdate();
        }
Ejemplo n.º 5
0
 private void SetFormSizeAndLocation(FormStateConfigElement formSettings)
 {
     if (this.form.WindowState != FormWindowState.Normal)
     {
         formSettings.Size     = this.lastNormalSize;
         formSettings.Location = this.lastNormalLocation;
     }
     else
     {
         formSettings.Size     = this.form.Size;
         formSettings.Location = this.form.Location;
     }
 }
Ejemplo n.º 6
0
        internal void LoadFormSize()
        {
            if (this.loadCalled)
            {
                return;
            }

            this.loadCalled = true;
            FormStateConfigElement lastFormState = this.SavedState;

            if (this.Enabled && lastFormState != null)
            {
                this.LoadFormState();
                this.ReloadSize(lastFormState);
                this.ReloadLocation(lastFormState);
            }
            this.saveSettings = true;
        }
Ejemplo n.º 7
0
        private void LoadFormState()
        {
            if (!this.Enabled)
            {
                return;
            }

            FormStateConfigElement lastFormState = this.SavedState;

            if (lastFormState != null)
            {
                this.form.WindowState = lastFormState.State;
            }

            if (this.form.WindowState == FormWindowState.Minimized)
            {
                this.form.WindowState = FormWindowState.Normal;
            }
        }
Ejemplo n.º 8
0
 private void SetFormSizeAndLocation(FormStateConfigElement formSettings)
 {
     if (this.form.WindowState != FormWindowState.Normal)
     {
         formSettings.Size = this.lastNormalSize;
         formSettings.Location = this.lastNormalLocation;
     }
     else
     {
         formSettings.Size = this.form.Size;
         formSettings.Location = this.form.Location;
     }
 }
Ejemplo n.º 9
0
        private void ReloadSize(FormStateConfigElement lastFormState)
        {
            if (this.form.FormBorderStyle != FormBorderStyle.Sizable &&
                this.form.FormBorderStyle != FormBorderStyle.SizableToolWindow)
                return;

            this.form.Size = lastFormState.Size;
            this.lastNormalSize = this.form.Size;
        }
Ejemplo n.º 10
0
        private void ReloadLocation(FormStateConfigElement lastFormState)
        {
            if (this.form.StartPosition != FormStartPosition.Manual)
                return;

            this.form.Location = lastFormState.Location;
            this.EnsureVisibleScreenArea();
            this.lastNormalLocation = this.form.Location;
        }
Ejemplo n.º 11
0
        private FormStateConfigElement PrepareStateToSave()
        {
            var formSettings = new FormStateConfigElement(this.form.Name);
            this.SetFormSizeAndLocation(formSettings);

            if (this.form.WindowState != FormWindowState.Minimized)
            {
                formSettings.State = this.form.WindowState;
            }
            return formSettings;
        }