Exemplo n.º 1
0
        protected override void ShowWidget(IUIDataParams data)
        {
            MessageBoxDataParam messageData = data as MessageBoxDataParam;

            {
                MessageBoxType = messageData.MessageBoxType;

                // ok button
                UIModuleButton okButton = GetButton(0);
                if (okButton != null)
                {
                    okButton.SetActive(true);
                    okButton.Set(OnOkButtonClick);
                }

                // cancel button
                UIModuleButton cancelButton = GetButton(1);
                if (cancelButton != null)
                {
                    cancelButton.SetActive(MessageBoxType == eMessageBoxType.OKAndCancel ? true : false);
                    cancelButton.Set(OnCancelButtonClick);
                }

                // close button
                SetButton(2, OnCancelButtonClick);
            }

            SetText(Title, messageData.TitleText);
            SetText(Message, messageData.MessageText);

            m_completed = messageData.CompletedAction;
        }
Exemplo n.º 2
0
        public void ShowMessageBox(string title, string message, eMessageBoxType messageBoxType,
                                   System.Action <bool> completed = null, float activeTime = 0.0f)
        {
            MessageBoxWidget widget =
                m_widgetRepositories.FindWidget("MessageBoxWidget") as MessageBoxWidget;

            if (widget == null)
            {
                widget = m_widgetRepositories.CreateWidget <MessageBoxWidget>("System/MessageBoxWidget");
            }

            if (widget != null)
            {
                if (widget.IsActive == true)
                {
                    m_messageBoxQueue.Enqueue(
                        new MessageBoxDataParam(title, message, messageBoxType, completed, activeTime));
                }
                else
                {
                    MessageBoxDataParam messageBoxDataParam =
                        new MessageBoxDataParam(title, message, messageBoxType, completed, activeTime);
                    widget.Show(activeTime, messageBoxDataParam);
                }
            }
        }
 private void ShowMessageBox(eMessageBoxType Type, string title, string text)
 {
     Messenger.Default.Send <ShowMsgBxMessage>(new ShowMsgBxMessage()
     {
         Type  = Type,
         Title = title,
         Text  = text
     });
 }
Exemplo n.º 4
0
 public MessageBoxDataParam(string title, string message, eMessageBoxType messageBoxType,
                            System.Action <bool> completed, float activeTime)
 {
     m_title          = title;
     m_message        = message;
     m_messageBoxType = messageBoxType;
     m_completed      = completed;
     m_activeTime     = activeTime;
 }
Exemplo n.º 5
0
 public static DialogResult Show(string message, eMessageBoxStyle style, eMessageBoxType type, int lineLength = DEFAULT_LINE_LENGTH)
 {
     using (var frm = new MRMessageBox(message, style, lineLength)
     {
         MessageBoxType = type
     })
     {
         return(frm.ShowDialog());
     }
 }
Exemplo n.º 6
0
        public eDialogResult ShowMessageBox(string text, string title, eMessageBoxType type, eMessageBoxIcon icon)
        {
            MessageBoxButton button = MessageBoxButton.OK;
            MessageBoxImage  micon  = MessageBoxImage.None;

            switch (type)
            {
            case eMessageBoxType.Ok:
                button = MessageBoxButton.OK;
                break;

            case eMessageBoxType.YesNo:
                button = MessageBoxButton.YesNo;
                break;

            case eMessageBoxType.OkCancel:
                button = MessageBoxButton.OKCancel;
                break;

            case eMessageBoxType.YesNoCancel:
                button = MessageBoxButton.YesNoCancel;
                break;

            default:
                button = MessageBoxButton.OK;
                break;
            }
            switch (icon)
            {
            case eMessageBoxIcon.Error:
                micon = MessageBoxImage.Error;
                break;

            case eMessageBoxIcon.Info:
                micon = MessageBoxImage.Information;
                break;

            case eMessageBoxIcon.Warning:
                micon = MessageBoxImage.Warning;
                break;

            case eMessageBoxIcon.Question:
                micon = MessageBoxImage.Question;
                break;

            default:
                micon = MessageBoxImage.None;
                break;
            }

            var ret = System.Windows.MessageBox.Show(text, title, button, micon);

            switch (ret)
            {
            case MessageBoxResult.Yes:
                return(eDialogResult.Yes);

            case MessageBoxResult.OK:
                return(eDialogResult.OK);

            case MessageBoxResult.No:
                return(eDialogResult.No);

            case MessageBoxResult.Cancel:
                return(eDialogResult.Cancel);

            case MessageBoxResult.None:
                return(eDialogResult.Nothing);

            default:
                return(eDialogResult.Nothing);
            }
        }
Exemplo n.º 7
0
    private void ShowMessageBoxWithPluginNotifyInfo(string message, eMessageBoxType boxType = eMessageBoxType.OK, System.Action <bool> completed = null)
    {
        string title = StringUtil.Format("<color=#{0}>{1}</color>", ColorUtility.ToHtmlStringRGBA(Color.blue), "System Info Message");

        Global.WidgetMgr.ShowMessageBox(title, message, boxType, completed);
    }
Exemplo n.º 8
0
 public MessageBoxDataParam(string title, string message, eMessageBoxType messageBoxType) : this(title, message,
                                                                                                 messageBoxType, null, 0.0f)
 {
 }