Exemplo n.º 1
0
        public WpfWindowBorder(IShiftOSWindow ctrl)
        {
            InitializeComponent();
            if (ctrl is UserControl)
            {
                _parent = ctrl as UserControl;
                _isWPF  = true;
            }
            else if (ctrl is System.Windows.Forms.UserControl)
            {
                _isWPF   = false;
                _wParent = ctrl as System.Windows.Forms.UserControl;
                _wParent.Show();
            }
            Shiftorium.Installed += () =>
            {
                SetupUpgradeables();
                ParentWindow.OnUpgrade();
            };
            SkinEngine.SkinLoaded += () =>
            {
                SetupSkin();
                ParentWindow.OnSkinLoad();
            };
            SaveSystem.GameReady += () =>
            {
                Dispatcher.Invoke(() =>
                {
                    SetupUpgradeables();
                    SetupSkin();
                });
            };
            if (_isWPF)
            {
                this.Width         = borderleft.Width + _parent.Width + borderright.Width;
                this.Height        = titlemaster.Height + _parent.Height + borderbottom.Height;
                pgcontents.Content = _parent;
            }
            else
            {
                pgcontents.Width  = _wParent.Width;
                pgcontents.Height = _wParent.Height;

                this.Width         = borderleft.Width + _wParent.Width + borderright.Width;
                this.Height        = titlemaster.Height + _wParent.Height + borderbottom.Height;
                pgcontents.Content = new WindowsFormsHost();
                (pgcontents.Content as WindowsFormsHost).Child = _wParent;
                _wParent.DoWinformsSkinningMagicOnWpf();
            }
            Desktop.ShowWindow(this);
            SetupUpgradeables();
            Loaded += (o, a) =>
            {
                SetupSkin();
                ParentWindow.OnSkinLoad();
                ParentWindow.OnLoad();
            };

            if (!_isWPF)
            {
                _wParent.TextChanged += (o, a) =>
                {
                    this.Text = _wParent.Text;
                };
                this.Text = _wParent.Text;
            }
        }
Exemplo n.º 2
0
 public void Close()
 {
     Desktop.RemoveWindow(this);
 }