Exemplo n.º 1
0
 //-------------------------------------------------------------------
 /// <summary>
 /// Show a dlg Box containing a message, an icon and some buttons.
 /// </summary>
 /// <param name="dlgTitle"></param>
 /// <param name="message"></param>
 /// <param name="icon"></param>
 /// <param name="button"></param>
 /// <returns></returns>
 public CommonDlgResult ShowDlg(string dlgTitle, string message, CommonDlgIcon icon, CommonDlgButtons buttons)
 {
     return(ShowDlg(WHSize.Default, dlgTitle, message, icon, buttons));
 }
Exemplo n.º 2
0
        // Set the default title of the dlg.
        // SetTitle(CommonDlgIcons dlgType, string title)

        // SetTitle(Cultureinfo cultInf, CommonDlgIcons dlgType, string title)

        // define the text of the button code
        // SetBtnText(CommonDlgButtons btn, string text)
        // SetBtnText(CultureInfo cultInf, CommonDlgButtons btn, string text)

        // multilingue!, comment?
        // define the default cultureInfo/translation code, associated to default/defined titles and texts
        // SetDefaultCultureInfo(CultureInfo cultInf)

        // definir/ajouter un cultureInfo
        // TODO:

        // Activer un cultureInfo
        // TODO:

        // change default icons
        // TODO:

        #endregion

        //=====================================================================
        #region Public methods: Show Dlg Message.

        //-------------------------------------------------------------------
        /// <summary>
        /// Show a dlg Box containing a message, an icon and some buttons.
        /// </summary>
        /// <param name="dlgTitle"></param>
        /// <param name="message"></param>
        /// <param name="icon"></param>
        /// <param name="button"></param>
        /// <returns></returns>
        public CommonDlgResult ShowDlg(WHSize whSize, string dlgTitle, string message, CommonDlgIcon icon, CommonDlgButtons buttons)
        {
            if (dlgTitle == null)
            {
                dlgTitle = "";
            }
            if (string.IsNullOrWhiteSpace(message))
            {
                message = "(null)";
            }

            // create and define the dlgBox
            DlgMsgVM dlgVM = new DlgMsgVM(_coreSystem);

            dlgVM.Title   = dlgTitle;
            dlgVM.Message = message;

            // set the icon and the buttons
            dlgVM.Icon    = icon;
            dlgVM.Buttons = buttons;

            // to close the dlgBox, like this, because its a WPF/MVVM implementation
            dlgVM.DoCloseView = () => DoCloseDlgMsg();

            _dlgMsg             = new DlgMsg();
            _dlgMsg.DataContext = dlgVM;
            _dlgMsg.Owner       = _parent;

            SetWindowWHSize(_dlgMsg, whSize);
            //ici();
            //// default values
            //_dlgMsg.Width = 300;
            //_dlgMsg.Height = 160;

            //if (whSize == WHSize.HL)
            //    _dlgMsg.Height = 250;

            //if (whSize == WHSize.HXL)
            //    _dlgMsg.Height = 300;

            //if (whSize == WHSize.HXXL)
            //    _dlgMsg.Height = 500;

            //if (whSize == WHSize.WL)
            //    _dlgMsg.Width= 400;

            //if (whSize == WHSize.WL_HL)
            //{
            //    _dlgMsg.Width = 400;
            //    _dlgMsg.Height = 250;
            //}

            //if (whSize == WHSize.WL_HXL)
            //{
            //    _dlgMsg.Width = 400;
            //    _dlgMsg.Height = 300;
            //}

            //if (whSize == WHSize.WL_HXXL)
            //{
            //    _dlgMsg.Width = 400;
            //    _dlgMsg.Height = 500;
            //}

            //if (whSize == WHSize.WXL)
            //{
            //    _dlgMsg.Width = 500;
            //}

            //if (whSize == WHSize.WXL_HL)
            //{
            //    _dlgMsg.Width = 500;
            //    _dlgMsg.Height = 250;
            //}

            //if (whSize == WHSize.WXL_HXL)
            //{
            //    _dlgMsg.Width = 500;
            //    _dlgMsg.Height = 300;
            //}

            //if (whSize == WHSize.WXL_HXXL)
            //{
            //    _dlgMsg.Width = 500;
            //    _dlgMsg.Height = 500;
            //}

            //if (whSize == WHSize.WXXL)
            //{
            //    _dlgMsg.Width = 700;
            //}

            //if (whSize == WHSize.WXXL_HL)
            //{
            //    _dlgMsg.Width = 700;
            //    _dlgMsg.Height = 250;
            //}

            //if (whSize == WHSize.WXXL_HXL)
            //{
            //    _dlgMsg.Width = 700;
            //    _dlgMsg.Height = 300;
            //}

            //if (whSize == WHSize.WXXL_HXXL)
            //{
            //    _dlgMsg.Width = 700;
            //    _dlgMsg.Height = 500;
            //}

            // open the dlgBox, is modal/synchronized, wait the close of the dlg
            _dlgMsg.ShowDialog();
            _dlgMsg = null;

            // get the result
            return(dlgVM.DlgResult);
        }