/// <summary> /// Show a dialog box to input a multi-lines text, with ok/cancel buttons. /// /// The WHsize is not used! /// </summary> /// <param name="whSize"></param> /// <param name="dlgTitle"></param> /// <param name="textTitle"></param> /// <param name="initialtext"></param> /// <param name="text"></param> /// <returns></returns> public CommonDlgResult ShowDlgInputTextMulti(WHSize whSize, string dlgTitle, string textTitle, string initialtext, out string text) { if (dlgTitle == null) { dlgTitle = ""; } if (string.IsNullOrWhiteSpace(textTitle)) { textTitle = ""; } // create and define the dlgBox DlgInputTextMultiVM dlgVM = new DlgInputTextMultiVM(_coreSystem); dlgVM.Title = dlgTitle; dlgVM.TextTitle = textTitle; dlgVM.TextInput = initialtext; // to close the dlgBox, like this, because its a WPF/MVVM implementation dlgVM.DoCloseView = () => DoCloseDlgInputTextMulti(); _dlgInputTextMulti = new DlgInputTextMulti(); _dlgInputTextMulti.Owner = _parent; _dlgInputTextMulti.DataContext = dlgVM; // TODO: need to use special size for this dialogbox type! //SetWindowWHSize(_dlgInputTextMulti, whSize); // open the dlgBox, is modal/synchronized, wait the close of the dlg _dlgInputTextMulti.ShowDialog(); _dlgInputTextMulti = null; // get the text text = dlgVM.TextInput; // get the result return(dlgVM.DlgResult); }
//===================================================================== #region Private methods. private void SetWindowWHSize(Window window, WHSize whSize) { // default values window.Width = 300; window.Height = 160; if (whSize == WHSize.HL) { window.Height = 250; } if (whSize == WHSize.HXL) { window.Height = 300; } if (whSize == WHSize.HXXL) { window.Height = 500; } if (whSize == WHSize.WL) { window.Width = 400; } if (whSize == WHSize.WL_HL) { window.Width = 400; window.Height = 250; } if (whSize == WHSize.WL_HXL) { window.Width = 400; window.Height = 300; } if (whSize == WHSize.WL_HXXL) { window.Width = 400; window.Height = 500; } if (whSize == WHSize.WXL) { window.Width = 500; } if (whSize == WHSize.WXL_HL) { window.Width = 500; window.Height = 250; } if (whSize == WHSize.WXL_HXL) { window.Width = 500; window.Height = 300; } if (whSize == WHSize.WXL_HXXL) { window.Width = 500; window.Height = 500; } if (whSize == WHSize.WXXL) { window.Width = 700; } if (whSize == WHSize.WXXL_HL) { window.Width = 700; window.Height = 250; } if (whSize == WHSize.WXXL_HXL) { window.Width = 700; window.Height = 300; } if (whSize == WHSize.WXXL_HXXL) { window.Width = 700; window.Height = 500; } }
/// <summary> /// Shows a question message with a Yes/No buttons. /// The result can be: Yes, No or Cancel (when closed by the X). /// </summary> /// <param name="message">The information message</param> public CommonDlgResult ShowQuestion(WHSize whSize, string message) { string title = _coreSystem.TranslationMgr.GetTranslation(StringCode.DlgQuestionTitle); return(ShowDlg(whSize, title, message, CommonDlgIcon.Question, CommonDlgButtons.YesNo)); }
/// <summary> /// Shows an information message with an Ok button. /// </summary> /// <param name="message">The information message</param> public void ShowInformation(WHSize whSize, string message) { string title = _coreSystem.TranslationMgr.GetTranslation(StringCode.DlgInformationTitle); ShowDlg(whSize, title, message, CommonDlgIcon.Information, CommonDlgButtons.Ok); }
//------------------------------------------------------------------- /// <summary> /// Shows a question message with a Yes/No buttons. /// The result can be: Yes, No or Cancel (when closed by the X). /// </summary> /// <param name="message">The information message</param> public CommonDlgResult ShowQuestion(WHSize whSize, string title, string message) { return(ShowDlg(whSize, title, message, CommonDlgIcon.Question, CommonDlgButtons.YesNo)); }
//------------------------------------------------------------------- /// <summary> /// Shows an information message with an Ok button. /// </summary> /// <param name="message">The information message</param> public void ShowInformation(WHSize whSize, string title, string message) { ShowDlg(title, message, CommonDlgIcon.Information, CommonDlgButtons.Ok); }
//------------------------------------------------------------------- /// <summary> /// Shows a warning message with an Ok button. /// </summary> /// <param name="message">The warning message</param> public void ShowWarning(WHSize whSize, string title, string message) { ShowDlg(whSize, title, message, CommonDlgIcon.Warning, CommonDlgButtons.Ok); }
/// <summary> /// Shows an error message with an Ok button. /// </summary> /// <param name="message">The error message</param> public CommonDlgResult ShowError(WHSize whSize, string message) { string title = _coreSystem.TranslationMgr.GetTranslation(StringCode.DlgErrorTitle); return(ShowDlg(whSize, title, message, CommonDlgIcon.Error, CommonDlgButtons.Ok)); }
//------------------------------------------------------------------- /// <summary> /// Shows an error message with an Ok button. /// </summary> /// <param name="message">The error message</param> public CommonDlgResult ShowError(WHSize whSize, string title, string message) { return(ShowDlg(whSize, title, message, CommonDlgIcon.Error, CommonDlgButtons.Ok)); }
// 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); }