Esempio n. 1
0
        private void InnerSave()
        {
            if (maximized)
            {
                MaximizedSchema.Set(true);
                return;
            }

            if (x < 0 || y < 0 || width <= 0 || height <= 0)
            {
                return;
            }

            MaximizedSchema.Set(false);
            XPosSchema.Set(x);
            YPosSchema.Set(y);
            WidthSchema.Set(width);
            HeightSchema.Set(height);
        }
Esempio n. 2
0
        public void Restore()
        {
            if ((options & WindowPersistOptions.Size) != 0)
            {
                int width  = WidthSchema.Get();
                int height = HeightSchema.Get();

                if (width != 0 && height != 0)
                {
                    window.Resize(width, height);
                }
            }

            if ((options & WindowPersistOptions.Position) != 0)
            {
                int x = XPosSchema.Get();
                int y = YPosSchema.Get();

                if (x == 0 && y == 0)
                {
                    window.SetPosition(Gtk.WindowPosition.Center);
                }
                else
                {
                    window.Move(x, y);
                }
            }

            if ((options & WindowPersistOptions.Size) != 0)
            {
                if (MaximizedSchema.Get())
                {
                    window.Maximize();
                }
                else
                {
                    window.Unmaximize();
                }
            }
        }