Exemple #1
0
        private bool?ShowMessage(string question, MessageBoxIcon_e img, MessageBoxButtons_e btns)
        {
            var res = m_App.ShowMessageBox(question, img, btns);

            switch (res)
            {
            case MessageBoxResult_e.Yes:
            case MessageBoxResult_e.Ok:
                return(true);

            case MessageBoxResult_e.No:
                return(false);

            case MessageBoxResult_e.Cancel:
                return(null);

            default:
                throw new NotSupportedException();
            }
        }
Exemple #2
0
        public MessageBoxResult_e ShowMessageBox(string msg, MessageBoxIcon_e icon = MessageBoxIcon_e.Info, MessageBoxButtons_e buttons = MessageBoxButtons_e.Ok)
        {
            swMessageBoxBtn_e  swBtn  = 0;
            swMessageBoxIcon_e swIcon = 0;

            switch (icon)
            {
            case MessageBoxIcon_e.Info:
                swIcon = swMessageBoxIcon_e.swMbInformation;
                break;

            case MessageBoxIcon_e.Question:
                swIcon = swMessageBoxIcon_e.swMbQuestion;
                break;

            case MessageBoxIcon_e.Error:
                swIcon = swMessageBoxIcon_e.swMbStop;
                break;

            case MessageBoxIcon_e.Warning:
                swIcon = swMessageBoxIcon_e.swMbWarning;
                break;
            }

            switch (buttons)
            {
            case MessageBoxButtons_e.Ok:
                swBtn = swMessageBoxBtn_e.swMbOk;
                break;

            case MessageBoxButtons_e.YesNo:
                swBtn = swMessageBoxBtn_e.swMbYesNo;
                break;

            case MessageBoxButtons_e.OkCancel:
                swBtn = swMessageBoxBtn_e.swMbOkCancel;
                break;

            case MessageBoxButtons_e.YesNoCancel:
                swBtn = swMessageBoxBtn_e.swMbYesNoCancel;
                break;
            }

            var swRes = (swMessageBoxResult_e)Sw.SendMsgToUser2(msg, (int)swIcon, (int)swBtn);

            switch (swRes)
            {
            case swMessageBoxResult_e.swMbHitOk:
                return(MessageBoxResult_e.Ok);

            case swMessageBoxResult_e.swMbHitCancel:
                return(MessageBoxResult_e.Cancel);

            case swMessageBoxResult_e.swMbHitYes:
                return(MessageBoxResult_e.Yes);

            case swMessageBoxResult_e.swMbHitNo:
                return(MessageBoxResult_e.No);

            default:
                return(0);
            }
        }