public FramelessManager(SatelliteApplicationForm form)
        {
            _alwaysShowFrame = AlwaysShowFrame;

            _form = form;

            minMaxClose = new MinMaxClose();
            minMaxClose.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            _form.Controls.Add(minMaxClose);

            _mouseFrameTimer = new Timer();
            _mouseFrameTimer.Interval = 100;
            _mouseFrameTimer.Tick += new EventHandler(_mouseFrameTimer_Tick);

            _commandShowMenu = new Command(CommandId.ShowMenu);
            _commandShowMenu.Latched = AlwaysShowFrame;
            _commandShowMenu.Execute += new EventHandler(commandShowMenu_Execute);
            // JJA: no longer provide a frameless option
            //ApplicationManager.CommandManager.Add(_commandShowMenu);

            ColorizedResources.GlobalColorizationChanged += new EventHandler(ColorizedResources_GlobalColorizationChanged);

            _form.Layout += new LayoutEventHandler(_form_Layout);
            _form.Activated += new EventHandler(_form_Activated);
            _form.Deactivate += new EventHandler(_form_Deactivate);
            _form.SizeChanged += new EventHandler(_form_SizeChanged);
            _form.MouseDown +=new MouseEventHandler(_form_MouseDown);
            _form.DoubleClick +=new EventHandler(_form_DoubleClick);
            _form.Disposed += new EventHandler(_form_Disposed);

            AlwaysShowFrameChanged += new EventHandler(FramelessManager_AlwaysShowFrameChanged);

            _uiTheme = new UITheme(form);
        }
예제 #2
0
            private void ThreadMain(object[] parameters)
            {
                IDisposable splashScreen = null;

                if (parameters.Length > 0)
                {
                    splashScreen = parameters[parameters.Length - 1] as IDisposable;
                }

                ProcessKeepalive pk = null;

                try
                {
                    try
                    {
                        pk = ProcessKeepalive.Open();
                    }
                    finally
                    {
                        object signalIncremented = parameters[0];
                        lock (signalIncremented)
                            Monitor.Pulse(parameters[0]);
                    }

                    // housekeeping initialization
                    Application.OleRequired();
                    UnexpectedErrorDelegate.RegisterWindowsHandler();

                    // Create and run the form
                    SatelliteApplicationForm applicationForm = (SatelliteApplicationForm)Activator.CreateInstance(_formType, _parameters);
                    Application.Run(applicationForm);
                }
                catch (Exception ex)
                {
                    UnexpectedErrorMessage.Show(ex);
                }
                finally
                {
                    if (pk != null)
                    {
                        pk.Dispose();
                    }
                    if (splashScreen != null)
                    {
                        Debug.Assert(splashScreen is FormSplashScreen);
                        splashScreen.Dispose();
                    }
                }
            }
        public HiddenMenuFrameManager(SatelliteApplicationForm form)
        {
            _alwaysShowMenu = AlwaysShowMenu;

            _form = form;
            _form.Load +=new EventHandler(_form_Load);

            _mouseFrameTimer = new Timer();
            _mouseFrameTimer.Interval = 100;
            _mouseFrameTimer.Tick += new EventHandler(_mouseFrameTimer_Tick);

            _commandShowMenu = new Command(CommandId.ShowMenu);
            _commandShowMenu.Latched = AlwaysShowMenu;
            _commandShowMenu.Execute += new EventHandler(commandShowMenu_Execute);
            ApplicationManager.CommandManager.Add(_commandShowMenu);

            ColorizedResources.GlobalColorizationChanged += new EventHandler(ColorizedResources_GlobalColorizationChanged);
            _form.Disposed += new EventHandler(_form_Disposed);

            AlwaysShowMenuChanged += new EventHandler(HiddenMenuFrameManager_AlwaysShowMenuChanged);
        }