Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="window"></param>
        protected internal DesktopWindowView(DesktopWindow window)
        {
            _desktopWindow            = window;
            _form                     = CreateDesktopForm();
            _workspaceActivationOrder = new OrderedSet <WorkspaceView>();

            // listen to some events on the form
            _form.VisibleChanged += FormVisibleChangedEventHandler;
            _form.Activated      += FormActivatedEventHandler;
            _form.Deactivate     += FormDeactivateEventHandler;
            _form.FormClosing    += FormFormClosingEventHandler;
            _form.TabbedGroups.PageCloseRequest += TabbedGroupPageClosePressedEventHandler;
            _form.TabbedGroups.PageChanged      += TabbedGroupPageChangedEventHandler;

            // NY: We subscribe to ContentHiding instead of ContentHidden because ContentHidden
            // is fired when the user double clicks the caption bar of a docking window, which
            // results in a crash. (Ticket #144)
            _form.DockingManager.ContentHiding          += DockingManagerContentHidingEventHandler;
            _form.DockingManager.ContentShown           += DockingManagerContentShownEventHandler;
            _form.DockingManager.ContentAutoHideOpening += DockingManagerContentAutoHideOpeningEventHandler;
            _form.DockingManager.ContentAutoHideClosed  += DockingManagerContentAutoHideClosedEventHandler;
            _form.DockingManager.WindowActivated        += DockingManagerWindowActivatedEventHandler;
            _form.DockingManager.WindowDeactivated      += FormDockingManagerWindowDeactivatedEventHandler;

            // init notification dialogs
            _infoNotificationDialog = new AlertNotificationForm(_form, Application.Name)
            {
                AutoDismiss = true
            };
            _infoNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked;
            _errorNotificationDialog = new AlertNotificationForm(_form, Application.Name);
            _errorNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked;
            _errorNotificationDialog.Dismissed      += ErrorDialogDismissed;
        }
Example #2
0
		private void ErrorDialogDismissed(object sender, AlertNotificationForm.DismissedEventArgs e)
		{
			// if the error dialog was manually dismissed by the user, consider that an acknowledgement of all alerts
			if(!e.AutoDismissed)
			{
				_alertContext.AcknowledgeAll();
			}
		}
Example #3
0
        /// <summary>
        /// Disposes of this object, closing the form.
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && _form != null)
            {
				if(_infoNotificationDialog != null)
				{
					_infoNotificationDialog.Dispose();
					_infoNotificationDialog = null;
				}
				if (_errorNotificationDialog != null)
				{
					_errorNotificationDialog.Dispose();
					_errorNotificationDialog = null;
				}


				_form.VisibleChanged -= FormVisibleChangedEventHandler;
				_form.Activated -= FormActivatedEventHandler;
				_form.Deactivate -= FormDeactivateEventHandler;
				_form.FormClosing -= FormFormClosingEventHandler;
				_form.TabbedGroups.PageCloseRequest -= TabbedGroupPageClosePressedEventHandler;
				_form.TabbedGroups.PageChanged -= TabbedGroupPageChangedEventHandler;
				_form.DockingManager.ContentHiding -= DockingManagerContentHidingEventHandler;
				_form.DockingManager.ContentShown -= DockingManagerContentShownEventHandler;
				_form.DockingManager.ContentAutoHideOpening -= DockingManagerContentAutoHideOpeningEventHandler;
				_form.DockingManager.ContentAutoHideClosed -= DockingManagerContentAutoHideClosedEventHandler;
				_form.DockingManager.WindowActivated -= DockingManagerWindowActivatedEventHandler;
				_form.DockingManager.WindowDeactivated -= FormDockingManagerWindowDeactivatedEventHandler;

                try
                {
                    SaveWindowSettings();
                }
                catch (Exception e)
                {
                    // if the window settings can't be saved for any reason,
                    // just log it and move on
                    Platform.Log(LogLevel.Error, e);
                }

                // bug #1171: if this window is the active window and there are other windows,
                // select the previously active one before destroying this one
                if (_desktopWindowActivationOrder.LastElement == this && _desktopWindowActivationOrder.Count > 1)
                {
                    _desktopWindowActivationOrder.SecondLastElement.Activate();
                }

                // remove this window from the activation order
                _desktopWindowActivationOrder.Remove(this);


                // now that we've cleaned up the activation,
                // we can destroy the form safely without worrying 
                // about the OS triggering activation events

                // this will close the form without firing any events
                _form.Dispose();
                _form = null;

                // notify that we are no longer visible
                SetVisibleStatus(false);
            }

            base.Dispose(disposing);
        }
Example #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="window"></param>
        protected internal DesktopWindowView(DesktopWindow window)
        {
        	_desktopWindow = window;
            _form = CreateDesktopForm();
            _workspaceActivationOrder = new OrderedSet<WorkspaceView>();

            // listen to some events on the form
            _form.VisibleChanged += FormVisibleChangedEventHandler;
            _form.Activated += FormActivatedEventHandler;
            _form.Deactivate += FormDeactivateEventHandler;
            _form.FormClosing += FormFormClosingEventHandler;
            _form.TabbedGroups.PageCloseRequest += TabbedGroupPageClosePressedEventHandler;
            _form.TabbedGroups.PageChanged += TabbedGroupPageChangedEventHandler;

            // NY: We subscribe to ContentHiding instead of ContentHidden because ContentHidden
            // is fired when the user double clicks the caption bar of a docking window, which
            // results in a crash. (Ticket #144)
            _form.DockingManager.ContentHiding += DockingManagerContentHidingEventHandler;
            _form.DockingManager.ContentShown += DockingManagerContentShownEventHandler;
            _form.DockingManager.ContentAutoHideOpening += DockingManagerContentAutoHideOpeningEventHandler;
            _form.DockingManager.ContentAutoHideClosed += DockingManagerContentAutoHideClosedEventHandler;
            _form.DockingManager.WindowActivated += DockingManagerWindowActivatedEventHandler;
            _form.DockingManager.WindowDeactivated += FormDockingManagerWindowDeactivatedEventHandler;

			// init notification dialogs
			_infoNotificationDialog = new AlertNotificationForm(_form, Application.Name) {AutoDismiss = true};
			_infoNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked;
			_errorNotificationDialog = new AlertNotificationForm(_form, Application.Name);
			_errorNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked;
			_errorNotificationDialog.Dismissed += ErrorDialogDismissed;
       }
Example #5
0
        /// <summary>
        /// Disposes of this object, closing the form.
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && _form != null)
            {
                if (_infoNotificationDialog != null)
                {
                    _infoNotificationDialog.Dispose();
                    _infoNotificationDialog = null;
                }
                if (_errorNotificationDialog != null)
                {
                    _errorNotificationDialog.Dispose();
                    _errorNotificationDialog = null;
                }


                _form.VisibleChanged -= FormVisibleChangedEventHandler;
                _form.Activated      -= FormActivatedEventHandler;
                _form.Deactivate     -= FormDeactivateEventHandler;
                _form.FormClosing    -= FormFormClosingEventHandler;
                _form.TabbedGroups.PageCloseRequest         -= TabbedGroupPageClosePressedEventHandler;
                _form.TabbedGroups.PageChanged              -= TabbedGroupPageChangedEventHandler;
                _form.DockingManager.ContentHiding          -= DockingManagerContentHidingEventHandler;
                _form.DockingManager.ContentShown           -= DockingManagerContentShownEventHandler;
                _form.DockingManager.ContentAutoHideOpening -= DockingManagerContentAutoHideOpeningEventHandler;
                _form.DockingManager.ContentAutoHideClosed  -= DockingManagerContentAutoHideClosedEventHandler;
                _form.DockingManager.WindowActivated        -= DockingManagerWindowActivatedEventHandler;
                _form.DockingManager.WindowDeactivated      -= FormDockingManagerWindowDeactivatedEventHandler;

                try
                {
                    SaveWindowSettings();
                }
                catch (Exception e)
                {
                    // if the window settings can't be saved for any reason,
                    // just log it and move on
                    Platform.Log(LogLevel.Error, e);
                }

                // bug #1171: if this window is the active window and there are other windows,
                // select the previously active one before destroying this one
                if (_desktopWindowActivationOrder.LastElement == this && _desktopWindowActivationOrder.Count > 1)
                {
                    _desktopWindowActivationOrder.SecondLastElement.Activate();
                }

                // remove this window from the activation order
                _desktopWindowActivationOrder.Remove(this);


                // now that we've cleaned up the activation,
                // we can destroy the form safely without worrying
                // about the OS triggering activation events

                // this will close the form without firing any events
                _form.Dispose();
                _form = null;

                // notify that we are no longer visible
                SetVisibleStatus(false);
            }

            base.Dispose(disposing);
        }