Ejemplo n.º 1
0
        private static WPFMessageBoxResult displayMessageBox(string title, string message, string details, WPFMessageBoxButtons buttonOption, WPFMessageBoxImage image)
        {
            try
            {
                MessageBoxWindow wnd = new MessageBoxWindow();
                if (title == string.Empty)
                {
                    title = "TRACTOR SHOWROOM";
                }
                else if (title.ToUpper().Trim() == "TRACTORSHOWROOM")
                {
                    title = "TRACTOR SHOWROOM";
                }
                wnd.Title = title;
                //  wnd.SizeToContent = SizeToContent.WidthAndHeight;
                bool setWidth = DisplayErrorMessageInCustomWindow(message);
                if (setWidth == false)
                {
                    wnd.SizeToContent = SizeToContent.WidthAndHeight;
                }
                else
                {
                    wnd.Width         = 500;
                    wnd.SizeToContent = SizeToContent.Height;
                }

                wnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                wnd.ResizeMode            = ResizeMode.NoResize;
                ___MessageBox             = new WPFMessageBox();
                MessageBoxViewModel __ViewModel = new MessageBoxViewModel(___MessageBox, title, message, details, buttonOption, image);
                ___MessageBox.DataContext = __ViewModel;
                wnd.Content = ___MessageBox;
                wnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                wnd.ShowDialog();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(___MessageBox.Result);
        }
Ejemplo n.º 2
0
        private static WPFMessageBoxResult displayMessageBox(string title, string message, string details, WPFMessageBoxButtons buttonOption, WPFMessageBoxImage image)
        {
            try
            {
                MessageBoxWindow wnd = new MessageBoxWindow();
                if (title == string.Empty)
                {
                    title = "TRACTOR SHOWROOM";
                }
                else if (title.ToUpper().Trim() == "TRACTORSHOWROOM")
                {
                    title = "TRACTOR SHOWROOM";
                }
                wnd.Title = title;
                //  wnd.SizeToContent = SizeToContent.WidthAndHeight;
                bool setWidth = DisplayErrorMessageInCustomWindow(message);
                if (setWidth == false)
                {
                    wnd.SizeToContent = SizeToContent.WidthAndHeight;
                }
                else
                {
                    wnd.Width = 500;
                    wnd.SizeToContent = SizeToContent.Height;

                }

                wnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                wnd.ResizeMode = ResizeMode.NoResize;
                ___MessageBox = new WPFMessageBox();
                MessageBoxViewModel __ViewModel = new MessageBoxViewModel(___MessageBox, title, message, details, buttonOption, image);
                ___MessageBox.DataContext = __ViewModel;
                wnd.Content = ___MessageBox;
                wnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                wnd.ShowDialog();             
            }
            catch(Exception ex)
            {
                throw ex;
            }
            return ___MessageBox.Result;
        }
Ejemplo n.º 3
0
 public MessageBoxViewModel(WPFMessageBox view,
     string title, string message, string innerMessage,
     WPFMessageBoxButtons buttonOption, WPFMessageBoxImage image)
 {
     Title = title;
     Message = message;
     InnerMessageDetails = innerMessage;
     SetButtonVisibility(buttonOption);
     SetImageSource(image);
     ___View = view;
 }