예제 #1
0
 private void DisposeForm()
 {
     if (_form != null)
     {
         _form.Dispose();
         _form = null;
     }
 }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="dialogBox"></param>
        /// <param name="owner"></param>
        protected internal DialogBoxView(DialogBox dialogBox, DesktopWindowView owner)
        {
            IApplicationComponentView componentView = (IApplicationComponentView)ViewFactory.CreateAssociatedView(dialogBox.Component.GetType());

            componentView.SetComponent((IApplicationComponent)dialogBox.Component);

            // cache the app component - we'll need it later to get the ExitCode
            _component = (IApplicationComponent)dialogBox.Component;

            _form              = CreateDialogBoxForm(dialogBox, (Control)componentView.GuiElement);
            _form.FormClosing += new FormClosingEventHandler(_form_FormClosing);

            _owner = owner.DesktopForm;
        }
        protected override ExceptionDialogAction Show()
        {
            var control = new ExceptionDialogControl(Exception, Message, Actions, CloseForm, CloseForm);

            _form = new DialogBoxForm(Title, control, Size.Empty, DialogSizeHint.Auto);

            var screen    = ScreenFromActiveForm() ?? ScreenFromMousePosition();
            int xdiff     = screen.Bounds.Width - _form.Bounds.Width;
            int ydiff     = screen.Bounds.Height - _form.Bounds.Height;
            int locationX = screen.WorkingArea.Left + Math.Max(0, (xdiff) / 2);
            int locationY = screen.WorkingArea.Top + Math.Max(0, (ydiff) / 2);

            _form.StartPosition = FormStartPosition.Manual;
            _form.Location      = new Point(locationX, locationY);
            //_form.TopMost = true;
            _form.ShowDialog();

            return(control.Result);
        }