コード例 #1
0
        private string GetTitle(MessageWindowType type)
        {
            string title = "";

            switch (type)
            {
            case MessageWindowType.Error:
                title = "Error";
                break;

            case MessageWindowType.Info:
                title = "Info";
                break;

            case MessageWindowType.Other:
                title = "Message";
                break;

            case MessageWindowType.Question:
                title = "Question";
                break;

            case MessageWindowType.Warning:
                title = "Warning";
                break;
            }
            return(title);
        }
コード例 #2
0
        public static MessageBoxResult Show
            (string caption, string msg, MessageWindowType type)
        {
            switch (type)
            {
            case MessageWindowType.ConfirmationWithYesNo:
                return(Show(caption, msg, MessageWindowButton.YesNo,
                            MessageWindowImage.Question));

            case MessageWindowType.ConfirmationWithYesNoCancel:
                return(Show(caption, msg, MessageWindowButton.YesNoCancel,
                            MessageWindowImage.Question));

            case MessageWindowType.Information:
                return(Show(caption, msg, MessageWindowButton.OK,
                            MessageWindowImage.Information));

            case MessageWindowType.Error:
                return(Show(caption, msg, MessageWindowButton.OK,
                            MessageWindowImage.Error));

            case MessageWindowType.Warning:
                return(Show(caption, msg, MessageWindowButton.OK,
                            MessageWindowImage.Warning));

            default:
                return(MessageBoxResult.No);
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a <see cref="MessageWindow"/> of the specified type and displays it.
        /// </summary>
        /// <param name="type">The type of message window.</param>
        /// <param name="message">The message to display</param>
        /// <param name="owner">The window that owns the <see cref="MessageWindow"/>, or null for auto owner (if <paramref name="autoOwner"/> is true)</param>
        /// <param name="autoOwner">true (default) to set owner automatically if <paramref name="owner"/> is null</param>
        /// <returns>true if affirmative selected by user; otherwise, false.</returns>
        private static bool Show(MessageWindowType type, string message, Window owner, bool autoOwner = true)
        {
            var modal = new MessageWindow(type, message, owner, autoOwner);

            modal.ShowDialog();
            return(modal.DialogResult == true);
        }
コード例 #4
0
        public static MessageBoxResult Show(string Message, MessageWindowType tp)
        {
            MessageWindow messageWindow = new MessageWindow(tp);

            messageWindow.Message.Text = Message;
            messageWindow.ShowDialog();
            return(messageWindow.result);
        }
コード例 #5
0
        /// <summary>
        /// 显示一个消息窗
        /// </summary>
        /// <param name="caption">窗口标题</param>
        /// <param name="message">内容</param>
        /// <param name="icon">图标类型.为<see cref="MessageIcon"/>类型</param>
        /// <param name="type">窗口类型.为<see cref="MessageWindowType"/>类型
        /// Default为默认窗口.Flow为浮动窗口
        /// </param>
        public static void Show(string caption, string message, MessageIcon icon, MessageWindowType type)
        {
            switch (type)
            {
            case MessageWindowType.Default: MessageWindow.Show(caption, message, icon);
                break;

            case MessageWindowType.Flow: ShowFlowWindow(message, icon);
                break;

            default:
                break;
            }
        }
コード例 #6
0
        public static NSAlertStyle GetWinType(MessageWindowType typ)
        {
            switch (typ)
            {
            case MessageWindowType.Error:
                return(NSAlertStyle.Critical);

            case MessageWindowType.Warning:
                return(NSAlertStyle.Warning);

            case MessageWindowType.Info:
            default:
                return(NSAlertStyle.Informational);
            }
        }
コード例 #7
0
ファイル: CocoaHelper.cs プロジェクト: ivynetca/lapsestudio
        public static NSAlertStyle GetWinType(MessageWindowType typ)
        {
            switch(typ)
            {
                case MessageWindowType.Error:
                    return NSAlertStyle.Critical;

                case MessageWindowType.Warning:
                    return NSAlertStyle.Warning;

                case MessageWindowType.Info:
                default:
                    return NSAlertStyle.Informational;
            }
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageWindow"/> class
 /// </summary>
 private MessageWindow(MessageWindowType type, string message, Window owner, bool autoOwner)
 {
     MessageWindowType = type;
     ResizeMode        = ResizeMode.NoResize;
     SizeToContent     = SizeToContent.Height;
     Topmost           = true;
     Owner             = owner;
     if (owner == null && autoOwner)
     {
         Owner = Application.Current.MainWindow;
     }
     WindowStartupLocation = Owner == null ? WindowStartupLocation.CenterScreen : WindowStartupLocation.CenterOwner;
     Message          = message;
     ButtonYesCommand = RelayCommand.Create((p) => Close(true));
     ButtonNoCommand  = RelayCommand.Create((p) => Close(false));
 }
コード例 #9
0
        public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
        {
            NSAlert al = new NSAlert();
            al.AlertStyle = CocoaHelper.GetWinType(type);
            al.MessageText = title;
            al.InformativeText = message;

            switch (bType)
            {
                case MessageWindowButtons.AbortRetryIgnore:
                    al.AddButton(Message.GetString("Abort"));
                    al.AddButton(Message.GetString("Retry"));
                    al.AddButton(Message.GetString("Ignore"));
                    break;
                case MessageWindowButtons.Cancel:
                    al.AddButton(Message.GetString("Cancel"));
                    break;
                case MessageWindowButtons.Close:
                    al.AddButton(Message.GetString("Close"));
                    break;
                case  MessageWindowButtons.Ok:
                    al.AddButton(Message.GetString("Ok"));
                    break;
                case MessageWindowButtons.OkCancel:
                    al.AddButton(Message.GetString("Ok"));
                    al.AddButton(Message.GetString("Cancel"));
                    break;
                case MessageWindowButtons.RetryCancel:
                    al.AddButton(Message.GetString("Retry"));
                    al.AddButton(Message.GetString("Cancel"));
                    break;
                case MessageWindowButtons.YesNo:
                    al.AddButton(Message.GetString("Yes"));
                    al.AddButton(Message.GetString("No"));
                    break;
                case MessageWindowButtons.YesNoCancel:
                    al.AddButton(Message.GetString("Yes"));
                    al.AddButton(Message.GetString("No"));
                    al.AddButton(Message.GetString("Cancel"));
                    break;
            }

            WindowResponse resp = CocoaHelper.GetResponse(al.RunModal(), bType);
            al.Dispose();
            return resp;
        }
コード例 #10
0
        public MessageWindow(MessageWindowType type)
        {
            MessageType = type;
            InitializeComponent();
            switch (MessageType)
            {
            case MessageWindowType.OK:
                button_ok.Visibility     = Visibility.Visible;
                button_cancel.Visibility = Visibility.Collapsed;
                button_yes.Visibility    = Visibility.Collapsed;
                button_no.Visibility     = Visibility.Collapsed;
                break;

            case MessageWindowType.OKCancel:
                button_ok.Visibility     = Visibility.Visible;
                button_cancel.Visibility = Visibility.Visible;
                button_yes.Visibility    = Visibility.Collapsed;
                button_no.Visibility     = Visibility.Collapsed;
                break;

            case MessageWindowType.YesNo:
                button_ok.Visibility     = Visibility.Collapsed;
                button_cancel.Visibility = Visibility.Collapsed;
                button_yes.Visibility    = Visibility.Visible;
                button_no.Visibility     = Visibility.Visible;
                break;

            case MessageWindowType.YesNoCancel:
                button_ok.Visibility     = Visibility.Collapsed;
                button_cancel.Visibility = Visibility.Visible;
                button_yes.Visibility    = Visibility.Visible;
                button_no.Visibility     = Visibility.Visible;
                break;

            case MessageWindowType.TextInput:
                button_ok.Visibility      = Visibility.Visible;
                button_cancel.Visibility  = Visibility.Visible;
                button_yes.Visibility     = Visibility.Collapsed;
                button_no.Visibility      = Visibility.Collapsed;
                TextInputField.Visibility = Visibility.Visible;
                break;
            }
        }
コード例 #11
0
        public static MessageBoxIcon GetWinType(MessageWindowType typ)
        {
            switch (typ)
            {
            case MessageWindowType.Error:
                return(MessageBoxIcon.Error);

            case MessageWindowType.Question:
                return(MessageBoxIcon.Question);

            case MessageWindowType.Warning:
                return(MessageBoxIcon.Warning);

            case MessageWindowType.Info:
                return(MessageBoxIcon.Information);

            case MessageWindowType.Other:
            default:
                return(MessageBoxIcon.None);
            }
        }
コード例 #12
0
ファイル: GtkHelper.cs プロジェクト: ivynetca/lapsestudio
        public static MessageType GetWinType(MessageWindowType typ)
        {
            switch(typ)
            {
                case MessageWindowType.Error:
                    return MessageType.Error;

                case MessageWindowType.Other:
                    return MessageType.Other;

                case MessageWindowType.Question:
                    return MessageType.Question;

                case MessageWindowType.Warning:
                    return MessageType.Warning;

                case MessageWindowType.Info:
                default:
                    return MessageType.Info;
            }
        }
コード例 #13
0
ファイル: GtkHelper.cs プロジェクト: ivynetca/lapsestudio
        public static MessageType GetWinType(MessageWindowType typ)
        {
            switch (typ)
            {
            case MessageWindowType.Error:
                return(MessageType.Error);

            case MessageWindowType.Other:
                return(MessageType.Other);

            case MessageWindowType.Question:
                return(MessageType.Question);

            case MessageWindowType.Warning:
                return(MessageType.Warning);

            case MessageWindowType.Info:
            default:
                return(MessageType.Info);
            }
        }
コード例 #14
0
ファイル: GtkMessageBox.cs プロジェクト: ivynetca/lapsestudio
        public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
        {
            Window p = (Window)parent;
            MessageType t = GtkHelper.GetWinType(type);

            MessageDialog md = new MessageDialog(p, DialogFlags.Modal, t, ButtonsType.None, message);
            md.Title = title;
            if (p != null && p.Icon != null) { md.Icon = p.Icon; }
            md.WindowPosition = WindowPosition.CenterOnParent;

            if (bType == MessageWindowButtons.Ok || bType == MessageWindowButtons.OkCancel) md.AddButton(Message.GetString("Ok"), ResponseType.Ok);
            if (bType == MessageWindowButtons.Close) md.AddButton(Message.GetString("Close"), ResponseType.Close);
            if (bType == MessageWindowButtons.YesNo || bType == MessageWindowButtons.YesNoCancel) { md.AddButton(Message.GetString("Yes"), ResponseType.Yes); md.AddButton(Message.GetString("No"), ResponseType.No); }
            if (bType == MessageWindowButtons.AbortRetryIgnore || bType == MessageWindowButtons.RetryCancel) md.AddButton(Message.GetString("Retry"), ResponseType.Accept);
            if (bType == MessageWindowButtons.AbortRetryIgnore) md.AddButton(Message.GetString("Ignore"), ResponseType.Reject);
            if (bType == MessageWindowButtons.Cancel || bType == MessageWindowButtons.OkCancel || bType == MessageWindowButtons.RetryCancel || bType == MessageWindowButtons.YesNoCancel || bType == MessageWindowButtons.AbortRetryIgnore) md.AddButton(Message.GetString("Cancel"), ResponseType.Cancel);

            ResponseType result = (ResponseType)md.Run();
            md.Destroy();
            return GtkHelper.GetResponse(result);
        }
コード例 #15
0
 public MessageWindow(MessageWindowType type)
 {
     MessageType = type;
     InitializeComponent();
     switch (MessageType)
     {
         case MessageWindowType.OK:
             button_ok.Visibility = Visibility.Visible;
             button_cancel.Visibility = Visibility.Collapsed;
             button_yes.Visibility = Visibility.Collapsed;
             button_no.Visibility = Visibility.Collapsed;
             break;
         case MessageWindowType.OKCancel:
             button_ok.Visibility = Visibility.Visible;
             button_cancel.Visibility = Visibility.Visible;
             button_yes.Visibility = Visibility.Collapsed;
             button_no.Visibility = Visibility.Collapsed;
             break;
         case MessageWindowType.YesNo:
             button_ok.Visibility = Visibility.Collapsed;
             button_cancel.Visibility = Visibility.Collapsed;
             button_yes.Visibility = Visibility.Visible;
             button_no.Visibility = Visibility.Visible;
             break;
         case MessageWindowType.YesNoCancel:
             button_ok.Visibility = Visibility.Collapsed;
             button_cancel.Visibility = Visibility.Visible;
             button_yes.Visibility = Visibility.Visible;
             button_no.Visibility = Visibility.Visible;
             break;
         case MessageWindowType.TextInput:
             button_ok.Visibility = Visibility.Visible;
             button_cancel.Visibility = Visibility.Visible;
             button_yes.Visibility = Visibility.Collapsed;
             button_no.Visibility = Visibility.Collapsed;
             TextInputField.Visibility = Visibility.Visible;
             break;
     }
 }
コード例 #16
0
        public MessageWindow(MessageWindowType Type)
        {
            InitializeComponent();

            this.Type = Type;

            switch (this.Type)
            {
            case MessageWindowType.EMail:
                Title = "E-Mail";
                break;

            case MessageWindowType.SMS:
                Title = "SMS";
                break;
            }

            SourceInitialized += (_, __) =>
            {
                DavuxLib2.Platform.DwmApi.DwmExtendFrameIntoClientArea(this, new Thickness(0, 0, 0, btnSend.ActualHeight + 9 * this.GetDPI()));
            };
        }
コード例 #17
0
 public abstract WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType);
コード例 #18
0
 public WindowResponse Show(string message, MessageWindowType type)
 {
     return(this.Show(null, message, GetTitle(type), type, MessageWindowButtons.Ok));
 }
コード例 #19
0
 public static MessageBoxResult Show(string Message, MessageWindowType tp)
 {
     MessageWindow messageWindow = new MessageWindow(tp);
     messageWindow.Message.Text = Message;
     messageWindow.ShowDialog();
     return messageWindow.result;
 }
コード例 #20
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
 public WindowResponse Show(object parent, string message, MessageWindowType type, MessageWindowButtons bType)
 {
     return this.Show(parent, message,  GetTitle(type), type, bType);
 }
コード例 #21
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
 public WindowResponse Show(string message, string title, MessageWindowType type, MessageWindowButtons bType)
 {
     return this.Show(null, message,  title, type, bType);
 }
コード例 #22
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
 public abstract WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType);
コード例 #23
0
 public WindowResponse Show(object parent, string message, string title, MessageWindowType type)
 {
     return(this.Show(parent, message, title, type, MessageWindowButtons.Ok));
 }
コード例 #24
0
 public WindowResponse Show(object parent, string message, MessageWindowType type, MessageWindowButtons bType)
 {
     return(this.Show(parent, message, GetTitle(type), type, bType));
 }
コード例 #25
0
ファイル: GtkMessageBox.cs プロジェクト: ivynetca/lapsestudio
        public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
        {
            Window      p = (Window)parent;
            MessageType t = GtkHelper.GetWinType(type);

            MessageDialog md = new MessageDialog(p, DialogFlags.Modal, t, ButtonsType.None, message);

            md.Title = title;
            if (p != null && p.Icon != null)
            {
                md.Icon = p.Icon;
            }
            md.WindowPosition = WindowPosition.CenterOnParent;

            if (bType == MessageWindowButtons.Ok || bType == MessageWindowButtons.OkCancel)
            {
                md.AddButton(Message.GetString("Ok"), ResponseType.Ok);
            }
            if (bType == MessageWindowButtons.Close)
            {
                md.AddButton(Message.GetString("Close"), ResponseType.Close);
            }
            if (bType == MessageWindowButtons.YesNo || bType == MessageWindowButtons.YesNoCancel)
            {
                md.AddButton(Message.GetString("Yes"), ResponseType.Yes); md.AddButton(Message.GetString("No"), ResponseType.No);
            }
            if (bType == MessageWindowButtons.AbortRetryIgnore || bType == MessageWindowButtons.RetryCancel)
            {
                md.AddButton(Message.GetString("Retry"), ResponseType.Accept);
            }
            if (bType == MessageWindowButtons.AbortRetryIgnore)
            {
                md.AddButton(Message.GetString("Ignore"), ResponseType.Reject);
            }
            if (bType == MessageWindowButtons.Cancel || bType == MessageWindowButtons.OkCancel || bType == MessageWindowButtons.RetryCancel || bType == MessageWindowButtons.YesNoCancel || bType == MessageWindowButtons.AbortRetryIgnore)
            {
                md.AddButton(Message.GetString("Cancel"), ResponseType.Cancel);
            }

            ResponseType result = (ResponseType)md.Run();

            md.Destroy();
            return(GtkHelper.GetResponse(result));
        }
コード例 #26
0
 public static MessageBoxResult Show(string msg, MessageWindowType type)
 {
     return(Show(string.Empty, msg, type));
 }
コード例 #27
0
ファイル: WinFormHelper.cs プロジェクト: ivynetca/lapsestudio
        public static MessageBoxIcon GetWinType(MessageWindowType typ)
        {
            switch (typ)
            {
                case MessageWindowType.Error:
                    return MessageBoxIcon.Error;

                case MessageWindowType.Question:
                    return MessageBoxIcon.Question;

                case MessageWindowType.Warning:
                    return MessageBoxIcon.Warning;

                case MessageWindowType.Info:
                    return MessageBoxIcon.Information;

                case MessageWindowType.Other:
                default:
                    return MessageBoxIcon.None;
            }
        }
コード例 #28
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
        private string GetTitle(MessageWindowType type)
        {
            string title = "";
            switch (type)
            {
                case MessageWindowType.Error:
                    title = "Error";
                    break;

                case MessageWindowType.Info:
                    title = "Info";
                    break;

                case MessageWindowType.Other:
                    title = "Message";
                    break;

                case MessageWindowType.Question:
                    title = "Question";
                    break;

                case MessageWindowType.Warning:
                    title = "Warning";
                    break;
            }
            return title;
        }
コード例 #29
0
 public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
 {
     if (parent != null) return WinFormHelper.GetResponse(MessageBox.Show(message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type)));
     else return WinFormHelper.GetResponse(MessageBox.Show((IWin32Window)parent, message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type)));
 }
コード例 #30
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
 public WindowResponse Show(string message, MessageWindowType type)
 {
     return this.Show(null, message, GetTitle(type), type, MessageWindowButtons.Ok);
 }
コード例 #31
0
 public WindowResponse Show(string message, string title, MessageWindowType type, MessageWindowButtons bType)
 {
     return(this.Show(null, message, title, type, bType));
 }
コード例 #32
0
ファイル: MessageBox.cs プロジェクト: ivynetca/lapsestudio
 public WindowResponse Show(object parent, string message, string title, MessageWindowType type)
 {
     return this.Show(parent, message,  title, type, MessageWindowButtons.Ok);
 }
コード例 #33
0
        public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
        {
            NSAlert al = new NSAlert();

            al.AlertStyle      = CocoaHelper.GetWinType(type);
            al.MessageText     = title;
            al.InformativeText = message;

            switch (bType)
            {
            case MessageWindowButtons.AbortRetryIgnore:
                al.AddButton(Message.GetString("Abort"));
                al.AddButton(Message.GetString("Retry"));
                al.AddButton(Message.GetString("Ignore"));
                break;

            case MessageWindowButtons.Cancel:
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.Close:
                al.AddButton(Message.GetString("Close"));
                break;

            case  MessageWindowButtons.Ok:
                al.AddButton(Message.GetString("Ok"));
                break;

            case MessageWindowButtons.OkCancel:
                al.AddButton(Message.GetString("Ok"));
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.RetryCancel:
                al.AddButton(Message.GetString("Retry"));
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.YesNo:
                al.AddButton(Message.GetString("Yes"));
                al.AddButton(Message.GetString("No"));
                break;

            case MessageWindowButtons.YesNoCancel:
                al.AddButton(Message.GetString("Yes"));
                al.AddButton(Message.GetString("No"));
                al.AddButton(Message.GetString("Cancel"));
                break;
            }

            WindowResponse resp = CocoaHelper.GetResponse(al.RunModal(), bType);

            al.Dispose();
            return(resp);
        }
コード例 #34
0
ファイル: LuaWINDOW.cs プロジェクト: tech-ticks/RTDXTools
    }                                                  // 0x00C00C20-0x00C00CA0

    private static void ChangeMessageWindowType_(MessageWindowType eMessageWindowType)
    {
    }                                                                                         // 0x00C00CA0-0x00C00DE0
コード例 #35
0
 public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
 {
     if (parent != null)
     {
         return(WinFormHelper.GetResponse(MessageBox.Show(message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type))));
     }
     else
     {
         return(WinFormHelper.GetResponse(MessageBox.Show((IWin32Window)parent, message, title, WinFormHelper.GetButtons(bType), WinFormHelper.GetWinType(type))));
     }
 }