private MessageBoxDialog(string text, MessageType msgType, MessageBoxButton btns, MessageBoxClosedEventHandler onClosedHandler)
 {
     DefaultStyleKey = typeof(MessageBoxDialog);
     Text = text;
     MessageType = msgType;
     MessageBoxButton = btns;
     OnClosedHandler = onClosedHandler;
 }
 private MessageBoxDialog(string text, MessageType msgType, MessageBoxButton btns, MessageBoxClosedEventHandler onClosedHandler)
 {
     DefaultStyleKey  = typeof(MessageBoxDialog);
     Text             = text;
     MessageType      = msgType;
     MessageBoxButton = btns;
     OnClosedHandler  = onClosedHandler;
 }
Example #3
0
 public static void Show( string title, string text, MessageBoxClosedEventHandler onClosed) {
     Control rootControl = ConsoleApplication.Instance.RootControl;
     if (!(rootControl is WindowsHost)) 
         throw new InvalidOperationException("Default windows host not found, create MessageBox manually");
     WindowsHost windowsHost = ( WindowsHost ) rootControl;
     MessageBox messageBox = new MessageBox(  );
     messageBox.Title = title;
     messageBox.Text = text;
     messageBox.AddHandler( ClosedEvent, new EventHandler(( sender, args ) => {
         onClosed(MessageBoxResult.Button1);
     }) );
     //messageBox.X =
     windowsHost.ShowModal( messageBox );
 }
        public static void Show(string title, string text, MessageBoxClosedEventHandler onClosed)
        {
            Control rootControl = ConsoleApplication.Instance.RootControl;

            if (!(rootControl is WindowsHost))
            {
                throw new InvalidOperationException("Default windows host not found, create MessageBox manually");
            }
            WindowsHost windowsHost = ( WindowsHost )rootControl;
            MessageBox  messageBox  = new MessageBox(  );

            messageBox.Title = title;
            messageBox.Text  = text;
            messageBox.AddHandler(ClosedEvent, new EventHandler((sender, args) => {
                onClosed(MessageBoxResult.Button1);
            }));
            //messageBox.X =
            windowsHost.ShowModal(messageBox);
        }
        public static void Show(string message, string caption, MessageType messageType, MessageBoxButton messageButtons, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
        {
            MessageBoxDialog control = new MessageBoxDialog(message, messageType, messageButtons, onClosedHandler);
            Size maxSize = WindowSizeUtility.GetWindowMaxSize();
            if (maxSize != Size.Empty)
            {
                control.MaxWidth = maxSize.Width;
                control.MaxHeight = maxSize.Height;
            }

            WindowType windowType = MapApplication.Current != null && MapApplication.Current.IsEditMode ?
                WindowType.DesignTimeFloating : WindowType.Floating;
            if (MapApplication.Current != null)
                MapApplication.Current.ShowWindow(caption, control, isModal, null, 
                    delegate { OnMessageBoxClosed(control); }, windowType);
            else
                WindowManager.ShowWindow(caption, control, isModal, null, 
                    delegate { OnMessageBoxClosed(control); }, windowType);
        }
 public static void Show(string message, string caption, MessageBoxButton messageButtons, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
 {
     Show(message, caption, MessageType.None, messageButtons, onClosedHandler, isModal);
 }
 public static void Show(string message, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
 {
     Show(message, "", MessageBoxButton.OK, onClosedHandler, isModal);
 }
        public static void Show(string message, string caption, MessageType messageType, MessageBoxButton messageButtons, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
        {
            MessageBoxDialog control = new MessageBoxDialog(message, messageType, messageButtons, onClosedHandler);
            Size             maxSize = WindowSizeUtility.GetWindowMaxSize();

            if (maxSize != Size.Empty)
            {
                control.MaxWidth  = maxSize.Width;
                control.MaxHeight = maxSize.Height;
            }

            WindowType windowType = MapApplication.Current != null && MapApplication.Current.IsEditMode ?
                                    WindowType.DesignTimeFloating : WindowType.Floating;

            if (MapApplication.Current != null)
            {
                MapApplication.Current.ShowWindow(caption, control, isModal, null,
                                                  delegate { OnMessageBoxClosed(control); }, windowType);
            }
            else
            {
                WindowManager.ShowWindow(caption, control, isModal, null,
                                         delegate { OnMessageBoxClosed(control); }, windowType);
            }
        }
 public static void Show(string message, string caption, MessageBoxButton messageButtons, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
 {
     Show(message, caption, MessageType.None, messageButtons, onClosedHandler, isModal);
 }
 public static void Show(string message, MessageBoxClosedEventHandler onClosedHandler = null, bool isModal = true)
 {
     Show(message, "", MessageBoxButton.OK, onClosedHandler, isModal);
 }