Пример #1
0
        public static DialogResult Show(string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            DialogResult defaultResult = DialogResult.None;

              switch (buttons)
              {
            case MessageBoxButtons.AbortRetryIgnore:
              defaultResult = DialogResult.Abort;
              break;
            case MessageBoxButtons.OK:
              defaultResult = DialogResult.OK;
              break;
            case MessageBoxButtons.OKCancel:
              defaultResult = DialogResult.OK;
              break;
            case MessageBoxButtons.RetryCancel:
              defaultResult = DialogResult.Cancel;
              break;
            case MessageBoxButtons.YesNo:
              defaultResult = DialogResult.No;
              break;
            case MessageBoxButtons.YesNoCancel:
              defaultResult = DialogResult.Cancel;
              break;
            default:
              defaultResult = DialogResult.None;
              break;
              }

              return Show(message, title, buttons, icon, defaultResult);
        }
Пример #2
0
		internal MessageBoxEx(String instruction, String details, String commit1, String commit2, MessageBoxIcon icon)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			lblInstruction.Text = instruction;
			lblDetails.Text = details;
			btnCommit1.Text = commit1;
			btnCommit2.Text = commit2;
			switch (icon)
			{
				case MessageBoxIcon.Asterisk:
					pictureBox.Image = (Image)SystemIcons.Asterisk.ToBitmap();
					break;
				case MessageBoxIcon.Error:
					pictureBox.Image = (Image)SystemIcons.Error.ToBitmap();
					break;
				case MessageBoxIcon.Exclamation:
					pictureBox.Image = (Image)SystemIcons.Exclamation.ToBitmap();
					break;
				case MessageBoxIcon.Question:
					pictureBox.Image = (Image)SystemIcons.Question.ToBitmap();
					break;
				default:
					break;
			}
		}
Пример #3
0
 public MiserugeErrorException(string message, string dialogTitle, MessageBoxIcon icon, MessageBoxButtons buttons)
     : base(message)
 {
     this.DialogTitle = dialogTitle;
     this.Icon = icon;
     this.Buttons = buttons;
 }
Пример #4
0
        // **********************************
        // Output an error or warning message
        // **********************************
        public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false)
        {
            // If we are running in SebWindowsClient we need to activate it before showing the password dialog
            if (SEBClientInfo.SebWindowsClientForm != null) SebWindowsClientMain.SEBToForeground();

            DialogResult messageBoxResult;
            if (!neverShowTouchOptimized && (Boolean) SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] == true)
            {
                messageBoxResult =
                    MetroMessageBox.Show(
                        new Form()
                        {
                            TopMost = true,
                            Top = 0,
                            Left = 0,
                            Width = Screen.PrimaryScreen.Bounds.Width,
                            Height = Screen.PrimaryScreen.Bounds.Height
                        }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }
            else
            {
                messageBoxResult = MessageBox.Show(new Form() { TopMost = true }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }

            return messageBoxResult;
        }
Пример #5
0
        /// <summary>
        /// 获取显示确认对话框的客户端脚本
        /// </summary>
        /// <param name="message">对话框消息</param>
        /// <param name="title">对话框标题</param>
        /// <param name="icon">对话框图标</param>
        /// <param name="okScriptstring">点击确定按钮执行的客户端脚本</param>
        /// <param name="cancelScript">点击取消按钮执行的客户端脚本</param>
        /// <param name="target">弹出对话框的目标页面</param>
        /// <returns>客户端脚本</returns>
        public static string GetShowReference(string message, string title, MessageBoxIcon icon, string okScriptstring, string cancelScript, Target target)
        {
            //string msgBoxScript = "var msgBox=Ext.MessageBox;";
            //msgBoxScript += "if(parent!=window){msgBox=parent.window.Ext.MessageBox;}";
            if (String.IsNullOrEmpty(title))
            {
                title = "X.util.confirmTitle";
            }
            else
            {
                title = JsHelper.GetJsString(title.Replace("\r\n", "\n").Replace("\n", "<br/>"));
            }
            message = message.Replace("\r\n", "\n").Replace("\n", "<br/>");

            JsObjectBuilder ob = new JsObjectBuilder();
            ob.AddProperty("title", title, true);
            ob.AddProperty("msg", JsHelper.GetJsStringWithScriptTag(message), true);
            ob.AddProperty("buttons", "Ext.MessageBox.OKCANCEL", true);
            ob.AddProperty("icon", String.Format("{0}", MessageBoxIconHelper.GetName(icon)), true);
            ob.AddProperty("fn", String.Format("function(btn){{if(btn=='cancel'){{{0}}}else{{{1}}}}}", cancelScript, okScriptstring), true);

            string targetName = "window";
            if (target != Target.Self)
            {
                targetName = TargetHelper.GetScriptName(target);
            }
            return String.Format("{0}.Ext.MessageBox.show({1});", targetName, ob.ToString());
        }
 /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show6"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Displays a message box with specified text, caption, and style.
 ///       Makes the dialog RTL if the resources for this dll have been localized to a RTL language.
 ///    </para>
 /// </devdoc>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, 
                                 MessageBoxDefaultButton defaultButton, MessageBoxOptions options) {
     if (RTLAwareMessageBox.IsRTLResources) {
         options |= (MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
     }
     return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
 }
Пример #7
0
		public static DialogResult Show(string msg, string title, MessageBoxButtons btns, MessageBoxIcon icon)
		{
			// Create a callback delegate
			_hookProcDelegate = new Win32.WindowsHookProc(HookCallback);

			// Remember the title & message that we'll look for.
			// The hook sees *all* windows, so we need to make sure we operate on the right one.
			_msg = msg;
			_title = title;

			// Set the hook.
			// Suppress "GetCurrentThreadId() is deprecated" warning. 
			// It's documented that Thread.ManagedThreadId doesn't work with SetWindowsHookEx()
#pragma warning disable 0618
			_hHook = Win32.SetWindowsHookEx(Win32.WH_CBT, _hookProcDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
#pragma warning restore 0618

			// Pop a standard MessageBox. The hook will center it.
			DialogResult rslt = MessageBox.Show(msg, title, btns, icon);

			// Release hook, clean up (may have already occurred)
			Unhook();

			return rslt;
		}
        /// <summary>
        /// Draws a MessageBox that always stays on top with a title, selectable buttons and an icon
        /// </summary>
        static public DialogResult Show(string message, string title,
            MessageBoxButtons buttons,MessageBoxIcon icon)
        {
            // Create a host form that is a TopMost window which will be the 

            // parent of the MessageBox.

            Form topmostForm = new Form();
            // We do not want anyone to see this window so position it off the 

            // visible screen and make it as small as possible

            topmostForm.Size = new System.Drawing.Size(1, 1);
            topmostForm.StartPosition = FormStartPosition.Manual;
            System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
            topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10,
                rect.Right + 10);
            topmostForm.Show();
            // Make this form the active form and make it TopMost

            topmostForm.Focus();
            topmostForm.BringToFront();
            topmostForm.TopMost = true;
            // Finally show the MessageBox with the form just created as its owner

            DialogResult result = MessageBox.Show(topmostForm, message, title,
                buttons,icon);
            topmostForm.Dispose(); // clean it up all the way


            return result;
        }
Пример #9
0
        public static string GetName(MessageBoxIcon type)
        {
            string result = String.Empty;

            switch (type)
            {
                case MessageBoxIcon.Information:
                    //result = "ext-mb-info";
                    result = "Ext.MessageBox.INFO";
                    break;
                case MessageBoxIcon.Warning:
                    //result = "ext-mb-warning";
                    result = "Ext.MessageBox.WARNING";
                    break;
                case MessageBoxIcon.Question:
                    //result = "ext-mb-question";
                    result = "Ext.MessageBox.QUESTION";
                    break;
                case MessageBoxIcon.Error:
                    //result = "ext-mb-error";
                    result = "Ext.MessageBox.ERROR";
                    break;
            }

            return result;
        }
Пример #10
0
 protected void internalShowDialog(string text, string caption, MessageBoxIcon icon)
 {
     try
     {
         MessageBoxParameters mbp = new MessageBoxParameters();
         mbp.Buttons = MessageBoxButtons.OK;
         mbp.Caption = caption;
         mbp.Text = text;
         mbp.Icon = icon;
         this.Console.ShowDialog(mbp);
     }
     catch (Exception ex)
     {
         // set up the update authorizationType pane when scope node selected
         MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
         mvd.DisplayName = caption;
         mvd.BodyText = String.Format("{0}\r\n\r\n{1}", text, ex.Message);
         switch (icon)
         {
             case MessageBoxIcon.Warning: mvd.IconId = MMC.MessageViewIcon.Warning; break;
             case MessageBoxIcon.Information: mvd.IconId = MMC.MessageViewIcon.Information; break;
             case MessageBoxIcon.Question: mvd.IconId = MMC.MessageViewIcon.Question; break;
             case MessageBoxIcon.None: mvd.IconId = MMC.MessageViewIcon.None; break;
             default: mvd.IconId = MMC.MessageViewIcon.Error; break;
         }
         // attach the view and set it as the default to show
         this.RootNode.ViewDescriptions.Add(mvd);
     }
 }
		public DialogResult showMessage(IWin32Window owner, string message, string title, MessageBoxIcon icon, MessageBoxButtons buttons) {

			//Wenn kein Owner mitgegeben wurde, dann Versuchen das Hauptfenster anzuzeigen
			if (owner == null || owner.Handle == IntPtr.Zero)
				owner = new dummyWindow(Process.GetCurrentProcess().MainWindowHandle);

			const string appTitle = "updateSystem.NET Administration";

			//Nachricht loggen
			logLevel lLevel;
			switch (icon) {
				case MessageBoxIcon.Error:
					lLevel = logLevel.Error;
					break;
				case MessageBoxIcon.Exclamation:
					lLevel = logLevel.Warning;
					break;
				default:
					lLevel = logLevel.Info;
					break;
			}
			Log.writeState(lLevel,
			                        string.Format("{0}{1}", string.IsNullOrEmpty(title) ? "" : string.Format("{0} -> ", title),
			                                      message));

			var dlgResponse = Environment.OSVersion.Version.Major >= 6
			       	? showTaskDialog(owner, appTitle, title, message, buttons, icon)
			       	: showMessageBox(owner, appTitle, title, message, icon, buttons);

			Log.writeKeyValue(lLevel, "Messagedialogresult", dlgResponse.ToString());

			return dlgResponse;
		}
Пример #12
0
 protected void ShowMessage(string text, string caption, MessageBoxIcon icon = MessageBoxIcon.None)
 {
     if (XMasterPage != null)
     {
         XMasterPage.ShowMessage(text, caption, icon);
     }
 }
Пример #13
0
        public static int? ShowMessageBox(string title, string text, IEnumerable<string> buttons, int focusButton, MessageBoxIcon icon)
        {
            // don't do anything if the guide is visible - one issue this handles is showing dialogs in quick
            // succession, we have to wait for the guide to go away before the next dialog can display
            if (Guide.IsVisible) return null;

            // if we have a result then we're all done and we want to return it
            if (dialogResult != null)
            {
                // preserve the result
                int? saveResult = dialogResult;

                // reset everything for the next message box
                dialogResult = null;
                Showing = false;

                // return the result
                return saveResult;
            }

            // return nothing if the message box is still being displayed
            if (Showing) return null;

            // otherwise show it
            Showing = true;
            Guide.BeginShowMessageBox(title, text, buttons, focusButton, icon, MessageBoxEnd, null);
            return null;
        }
Пример #14
0
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
 {
     _owner = owner;
     Initialize();
     return MessageBox.Show(owner, text, caption, buttons, icon,
                            defButton, options);
 }
Пример #15
0
        /// <summary>
        /// Shows the alert dialog.
        /// </summary>
        /// <param name="core">
        /// The StyleCop core instance.
        /// </param>
        /// <param name="parent">
        /// The parent control.
        /// </param>
        /// <param name="message">
        /// The message to display on the dialog.
        /// </param>
        /// <param name="title">
        /// The title of the dialog.
        /// </param>
        /// <param name="buttons">
        /// The dialog buttons.
        /// </param>
        /// <param name="icon">
        /// The dialog icon.
        /// </param>
        /// <returns>
        /// Returns the dialog result.
        /// </returns>
        public static DialogResult Show(StyleCopCore core, Control parent, string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            Param.RequireNotNull(core, "core");
            Param.Ignore(parent);
            Param.RequireValidString(message, "message");
            Param.RequireValidString(title, "title");
            Param.Ignore(buttons);
            Param.Ignore(icon);

            if (core.DisplayUI)
            {
                return DisplayMessageBox(parent, message, title, buttons, icon);
            }
            else
            {
                // Alert Dialogs which provide options other than OK cannot be handled when the 
                // program is running in a non-UI mode.
                if (buttons != MessageBoxButtons.OK)
                {
                    throw new InvalidOperationException(Strings.AlertDialogWithOptionsInNonUIState);
                }

                SendToOutput(core, message, icon);
                return DialogResult.OK;
            }
        }
Пример #16
0
        /// <summary>
        /// 异常日志信息
        /// </summary>
        /// <param name="text"></param>
        /// <param name="caption"></param>
        /// <param name="buttons"></param>
        /// <param name="icon"></param>
        /// <param name="ex"></param>
        /// <param name="FormType"></param>
        /// <returns></returns>
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, Exception ex,Type FormType)
        {
            log = LogManager.GetLogger(FormType);
            log.Error(ex);

            return DevExpress.XtraEditors.XtraMessageBox.Show(text, caption, buttons, icon);
        }
Пример #17
0
 // Token: 0x06002C9D RID: 11421
 // RVA: 0x0012157C File Offset: 0x0011F77C
 public static DialogResult smethod_8(string string_0, MessageBoxButtons messageBoxButtons_0, MessageBoxIcon messageBoxIcon_0)
 {
     Class115.smethod_6(true);
     DialogResult result = MessageBox.Show(string_0, "osu!", messageBoxButtons_0, messageBoxIcon_0);
     Class115.smethod_6(false);
     return result;
 }
Пример #18
0
 public static DialogResult Show(IWin32Window owner, string caption, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     using (RepositionableMessageBox rmb = new RepositionableMessageBox(caption, title, buttons, icon))
     {
         return rmb.ShowDialog(owner);
     }
 }
Пример #19
0
 public void Show(string message, MessageBoxIcon icon)
 {
     Message = message;
     this.Icon = GetSystemIcon(icon);
     autoClose.Enabled = true;
     Animate(false);
 }
Пример #20
0
 public static void ShowMessage(string message, string title = "HLSL Tools",
     MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK,
     MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning,
     MessageBoxDefaultButton messageBoxDefaultButton = MessageBoxDefaultButton.Button1)
 {
     MessageBox.Show(message, title, messageBoxButtons, messageBoxIcon, messageBoxDefaultButton);
 }
Пример #21
0
        public static DialogResult Show(string Caption,MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            Msgbox = new extramessage_frm();
            Msgbox.txt.Text = Caption;

            if (icon == MessageBoxIcon.Information)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.info;
                Msgbox.Text = "پیام";
            }
            else if (icon == MessageBoxIcon.Error)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.error;
                Msgbox.Text = "اخطار";
            }
            else if (icon == MessageBoxIcon.Warning)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.warning;
                Msgbox.Text = "هشدار";
            }

            if (buttons == MessageBoxButtons.OK)
            {
                Msgbox.panel1.Visible = true;
                Msgbox.panel2.Visible = false;
            }
            else if (buttons == MessageBoxButtons.YesNo)
            {
                Msgbox.panel2.Visible = true;
                Msgbox.panel1.Visible = false;
            }
            Msgbox.ShowDialog();
            return result;
        }
Пример #22
0
        public void Log(string Message,MessageBoxIcon WarrningLevel,string StackInfo)
        {
            if (InvokeRequired) {
                // We're not in the UI thread, so we need to call BeginInvoke
                Invoke(new LogDelegate(Log), new object[]{Message,WarrningLevel,StackInfo});
                return;
            }
            //from forms thread
            DateTime date = DateTime.Now;
            string TimeString = date.ToString("H:mm:ss.fff");

            //to file
            string FileName = OutMgfBox.Text+Path.DirectorySeparatorChar+"RawtoMgf.log";
            StreamWriter sw = new StreamWriter(FileName,true);
            string FileMessage = "Info:";
            if (WarrningLevel == MessageBoxIcon.Warning) FileMessage = "Warning!";
            if (WarrningLevel == MessageBoxIcon.Error)   FileMessage = "ERROR!";
            FileMessage += "\t"+TimeString;
            FileMessage += "\t"+Message;
            if (StackInfo != null){
                FileMessage += "\n StackInfo:"+StackInfo;
            }
            sw.WriteLine(FileMessage);
            sw.Close();
            Application.DoEvents();
        }
 private frmExceptionHandler(Exception exceptionToPublish, bool restartAllowed, MessageBoxIcon iconType)
     : this()
 {
     this.ExceptionToPublish = exceptionToPublish;
     this.AllowContinueButton = restartAllowed;
     this.m_mode = iconType;
     if (iconType == MessageBoxIcon.Asterisk)
         this.pbIcon.Image = System.Drawing.SystemIcons.Asterisk.ToBitmap();
     else if (iconType == MessageBoxIcon.Error)
         this.pbIcon.Image = System.Drawing.SystemIcons.Error.ToBitmap();
     else if (iconType == MessageBoxIcon.Exclamation)
         this.pbIcon.Image = System.Drawing.SystemIcons.Exclamation.ToBitmap();
     else if (iconType == MessageBoxIcon.Hand)
         this.pbIcon.Image = System.Drawing.SystemIcons.Hand.ToBitmap();
     else if (iconType == MessageBoxIcon.Information)
         this.pbIcon.Image = System.Drawing.SystemIcons.Information.ToBitmap();
     else if (iconType == MessageBoxIcon.None)
         this.pbIcon.Image = null;
     else if (iconType == MessageBoxIcon.Question)
         this.pbIcon.Image = System.Drawing.SystemIcons.Question.ToBitmap();
     else if (iconType == MessageBoxIcon.Stop)
         this.pbIcon.Image = System.Drawing.SystemIcons.Shield.ToBitmap();
     else if (iconType == MessageBoxIcon.Warning)
         this.pbIcon.Image = System.Drawing.SystemIcons.Warning.ToBitmap();
 }
Пример #24
0
        public override void ShowMessage(string text, string caption, MessageBoxIcon icon)
        {
            var @class = String.Empty;

            switch (icon)
            {
                case MessageBoxIcon.Error:
                    @class = "alert alert-danger";
                    break;
                case MessageBoxIcon.Information:
                    @class = "alert alert-success";
                    break;
                case MessageBoxIcon.None:
                    @class = "alert alert-info";
                    break;
                case MessageBoxIcon.Question:
                    @class = "alert alert-warning";
                    break;
                case MessageBoxIcon.Warning:
                    @class = "alert alert-warning";
                    break;
            }

            message_container.InnerHtml += RenderMessage(caption, text, @class);

            message_container.Visible = true;
        }
		/// <summary>
		/// Displays a message box containing information about an exception, for the currently executing application, plus optional additional information.
		/// </summary>
		/// <param name="owner">The window owning the dialog</param>
		/// <param name="caption">The caption to display on the dialog</param>
		/// <param name="icon">The icon to display on the dialog</param>
		/// <param name="buttons">The buttons to display on the dialog</param>
		/// <param name="ex">The exception to display on the dialog</param>
		/// <param name="infoLines">Optional additional information to display on the dialog</param>
		/// <returns>The result of the dialog</returns>
		public static DialogResult DisplayException(IWin32Window owner, string caption, MessageBoxIcon icon, MessageBoxButtons buttons, Exception ex, params string[] infoLines)
		{
			bool hasAdditionalInfo = false;
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			
			/// begin with the application information that generated the exception
			sb.Append(string.Format("The application '{0}' has encountered the following exception or condition.\n\n", Path.GetFileName(System.Windows.Forms.Application.ExecutablePath)));
			
			/// append the additional information if any was supplied
			if (infoLines != null)
			{
				hasAdditionalInfo = true;
				sb.Append("Additional Information:\n\n");
				foreach(string line in infoLines)
					sb.Append(string.Format("{0}\n", line));
			}
						
			if (ex != null)
			{
				/// append the information contained in the exception
				sb.Append(string.Format("{0}Exception Information:\n\n", (hasAdditionalInfo ? "\n" : null)));
				sb.Append(ex.ToString());
			}

			/// display a message and return the result
			return MessageBox.Show(owner, sb.ToString(), caption, buttons, icon);
		}
Пример #26
0
 public static DialogResult Mes(string descr, MessageBoxIcon icon = MessageBoxIcon.Information, MessageBoxButtons butt = MessageBoxButtons.OK)
 {
     if (descr.Length > 0)
         return MessageBox.Show(descr, Application.ProductName, butt, icon);
     else
         return DialogResult.OK;
 }
Пример #27
0
        /// <summary>
        /// Displays a message box.
        /// </summary>
        /// <param name="owner">Owner window.</param>
        /// <param name="text">Text to display.</param>
        /// <param name="caption">Text to display in the title bar.</param>
        /// <param name="cdText">Text to display near check box.</param>
        /// <param name="buttons">Buttons to display in the message box.</param>
        /// <param name="icon">Icon to display in the mesage box.</param>
        /// <returns>One of the <see cref="DialogResult"/> values.</returns>
        public DialogResult Show(IWin32Window owner, string text, string caption, string cdText, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            button1.Click += new EventHandler(OnButtonClick);
            button2.Click += new EventHandler(OnButtonClick);
            button3.Click += new EventHandler(OnButtonClick);

            this.Text = caption;
            msgText.Text = text;
            cbOption.Text = cdText;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                NativeMethods.EnableMenuItem(NativeMethods.GetSystemMenu(this.Handle, false), 
                    NativeMethods.SC_CLOSE, NativeMethods.MF_BYCOMMAND | NativeMethods.MF_GRAYED);
            }
            else this.ControlBox = false;

            SetButtonsToDisplay(buttons);

            SetIconToDisplay(icon);
            
            MessageBeep(icon);

            ShowDialog(owner);

            return m_dialogResult;
        }
Пример #28
0
        /// <summary>
        /// Provides a more customisable MessageBox with 3 buttons available. 
        /// DialogResults: Button1 = OK, button2 = Abort, button3 = Cancel.
        /// </summary>
        /// <param name="Title"></param>
        /// <param name="Message"></param>
        /// <param name="Button1Text"></param>
        /// <param name="Button2Text"></param>
        /// <param name="Button3Text"></param>
        /// <param name="icon"></param>
        public KFreonMessageBox(string Title, string Message, string Button1Text, MessageBoxIcon icon, string Button2Text = null, string Button3Text = null)
        {
            InitializeComponent();
            this.Text = Title;
            label1.Text = Message;
            button1.Text = Button1Text;

            if (Button2Text != null)
                button2.Text = Button2Text;
            button2.Visible = Button2Text != null;

            if (Button3Text != null)
                button3.Text = Button3Text;
            button3.Visible = Button3Text != null;

            // KFreon: Reset positions?
            //166, 500 = 330


            // KFreon: Deal with icon/picture
            if (pictureBox1.Image != null)
                pictureBox1.Image.Dispose();

            if (icon != 0)
                pictureBox1.Image = GetSystemImageForMessageBox(icon);
            else
                pictureBox1.Image = new Bitmap(1, 1);
        }
Пример #29
0
        private KryptonMessageBox(string text, string caption,
                                  MessageBoxButtons buttons, MessageBoxIcon icon,
                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
                                  HelpInfo helpInfo)
        {
            // Store incoming values
            _text = text;
            _caption = caption;
            _buttons = buttons;
            _icon = icon;
            _defaultButton = defaultButton;
            _options = options;
            _helpInfo = helpInfo;

            // Create the form contents
            InitializeComponent();

            // Update contents to match requirements
            UpdateText();
            UpdateIcon();
            UpdateButtons();
            UpdateDefault();
            UpdateHelp();

            // Finally calculate and set form sizing
            UpdateSizing();
        }
Пример #30
0
 public QuickBooksException(string displayMessage, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     _displayMessage = displayMessage;
     _caption = caption;
     _buttons = buttons;
     _icon = icon;
 }
 /// <summary>
 /// Shows the specified message box.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <returns></returns>
 public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     return(FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1));
 }
Пример #32
0
        /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show16"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Displays a message box with specified text, caption, style, Help file Path and keyword for a IWin32Window.
        ///    </para>
        /// </devdoc>
        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
                                        MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, string keyword)
        {
            HelpInfo hpi = new HelpInfo(helpFilePath, keyword);

            return(ShowCore(owner, text, caption, buttons, icon, defaultButton, options, hpi));
        }
Пример #33
0
        /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show13"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Displays a message box with specified text, caption, style and Help file Path .
        ///    </para>
        /// </devdoc>
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
                                        MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath)
        {
            HelpInfo hpi = new HelpInfo(helpFilePath);

            return(ShowCore(null, text, caption, buttons, icon, defaultButton, options, hpi));
        }
Пример #34
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //START WHIDBEY ADDS                                                                                           //
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show12"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Displays a message box with specified text, caption, and style with Help Button.
        ///    </para>
        /// </devdoc>
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
                                        MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)
        {
            return(ShowCore(null, text, caption, buttons, icon, defaultButton, options, displayHelpButton));
        }
            /// <summary>
            /// Shows the specified message box.
            /// </summary>
            /// <param name="owner">The owner.</param>
            /// <param name="text">The text.</param>
            /// <param name="caption">The caption.</param>
            /// <param name="buttons">The buttons.</param>
            /// <param name="icon">The icon.</param>
            /// <param name="defaultButton">The default button.</param>
            /// <returns>The dialog result.</returns>
            public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
            {
                //Create a new instance of the FlexibleMessageBox form
                var flexibleMessageBoxForm = new FlexibleMessageBoxForm();

                flexibleMessageBoxForm.ShowInTaskbar = false;

                //Bind the caption and the message text
                flexibleMessageBoxForm.CaptionText = caption;
                flexibleMessageBoxForm.MessageText = text;
                flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;

                //Set the buttons visibilities and texts. Also set a default button.
                SetDialogButtons(flexibleMessageBoxForm, buttons, defaultButton);

                //Set the dialogs icon. When no icon is used: Correct placement and width of rich text box.
                SetDialogIcon(flexibleMessageBoxForm, icon);

                //Set the font for all controls
                flexibleMessageBoxForm.Font = FONT;
                flexibleMessageBoxForm.richTextBoxMessage.Font = FONT;

                //Calculate the dialogs start size (Try to auto-size width to show longest text row). Also set the maximum dialog size.
                SetDialogSizes(flexibleMessageBoxForm, text, caption);

                //Set the dialogs start position when given. Otherwise center the dialog on the current screen.
                SetDialogStartPosition(flexibleMessageBoxForm, owner);

                //Show the dialog
                return(flexibleMessageBoxForm.ShowDialog(owner));
            }
            /// <summary>
            /// Set the dialogs icon.
            /// When no icon is used: Correct placement and width of rich text box.
            /// </summary>
            /// <param name="flexibleMessageBoxForm">The FlexibleMessageBox dialog.</param>
            /// <param name="icon">The MessageBoxIcon.</param>
            private static void SetDialogIcon(FlexibleMessageBoxForm flexibleMessageBoxForm, MessageBoxIcon icon)
            {
                switch (icon)
                {
                case MessageBoxIcon.Information:
                    flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Information.ToBitmap();
                    break;

                case MessageBoxIcon.Warning:
                    flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Warning.ToBitmap();
                    break;

                case MessageBoxIcon.Error:
                    flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Error.ToBitmap();
                    break;

                case MessageBoxIcon.Question:
                    flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Question.ToBitmap();
                    break;

                default:
                    //When no icon is used: Correct placement and width of rich text box.
                    flexibleMessageBoxForm.pictureBoxForIcon.Visible = false;
                    flexibleMessageBoxForm.richTextBoxMessage.Left  -= flexibleMessageBoxForm.pictureBoxForIcon.Width;
                    flexibleMessageBoxForm.richTextBoxMessage.Width += flexibleMessageBoxForm.pictureBoxForIcon.Width;
                    break;
                }
            }
 /// <summary>
 /// Shows the specified message box.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="text">The text.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="defaultButton">The default button.</param>
 /// <returns>The dialog result.</returns>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
 {
     return(FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton));
 }
Пример #38
0
 public Gui.DialogResult ShowMessageBox(string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     return((Gui.DialogResult)MessageBox.Show(this, message, caption, buttons, icon));
 }
Пример #39
0
        //Agregandole new a los metodos void damos por sabido que el miembro que modificamos oculta el miembro que se hereda de la clase base.

        public new  void Notificar(string titulo, string mensaje, MessageBoxButtons botones, MessageBoxIcon icono)
        {
            MessageBox.Show(titulo, mensaje, botones, icono);
        }
Пример #40
0
 public static DialogResult Message(string prompt, MessageBoxButtons button = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information, string title = null, Form parentForm = null)
 {
     SetWaitCursor(false, parentForm);
     using (var newMessage = new Dialog(parentForm))
     {
         return(newMessage.DialogMessage(prompt, button, icon, title, parentForm));
     }
 }
Пример #41
0
 /// <summary>
 /// Open a message box and return the result selected by the user.
 /// </summary>
 /// <param name="owner">The owner of message box.</param>
 /// <param name="message">Text to display.</param>
 /// <param name="caption">The title of message box.</param>
 /// <param name="button">The group of buttons to display in the message box.</param>
 /// <param name="icon">Large icon displayed on the left side of the message box.</param>
 /// <param name="defaultButton">The default button. Buttons set as default will be highlighted.</param>
 public static MessageBoxResult Show(Window owner, string message, string caption, MessageBoxButton button, MessageBoxIcon icon, DefaultButton defaultButton, MessageBoxXSetting setting)
 {
     return(CallMessageBoxXWindow(owner, message, caption, button, icon, defaultButton, setting));
 }
Пример #42
0
 public new void Notificar(string mensaje, MessageBoxButtons botones, MessageBoxIcon icono)
 {
     this.Notificar(this.Text, mensaje, botones, icono);
 }
Пример #43
0
 /// <summary>
 /// Open a message box and return the result selected by the user.
 /// </summary>
 /// <param name="message">Text to display.</param>
 /// <param name="caption">The title of message box.</param>
 /// <param name="button">The group of buttons to display in the message box.</param>
 /// <param name="icon">Large icon displayed on the left side of the message box.</param>
 /// <param name="defaultButton">The default button. Buttons set as default will be highlighted.</param>
 public static MessageBoxResult Show(string message, string caption, MessageBoxButton button, MessageBoxIcon icon, DefaultButton defaultButton)
 {
     return(CallMessageBoxXWindow(null, message, caption, button, icon, defaultButton, null));
 }
Пример #44
0
        private static MessageBoxResult CallMessageBoxXWindow(Window owner, string message, string caption, MessageBoxButton button, MessageBoxIcon icon, DefaultButton defaultButton, MessageBoxXSetting setting)
        {
            var window       = new MessageBoxXWindow(message, caption, button, icon, defaultButton, owner, setting ?? MessageBoxXSettings.Setting);
            var dialogResult = window.ShowDialog();

            switch (dialogResult)
            {
            case true:
                return((button == MessageBoxButton.YesNo || button == MessageBoxButton.YesNoCancel)
                        ? MessageBoxResult.Yes
                        : MessageBoxResult.OK);

            case false:
                return(MessageBoxResult.No);

            default:
                return(MessageBoxResult.Cancel);
            }
        }
Пример #45
0
 protected static extern bool MessageBeep(MessageBoxIcon mbi);
Пример #46
0
 /// <summary>
 /// Open a message box and return the result selected by the user.
 /// </summary>
 /// <param name="owner">The owner of message box.</param>
 /// <param name="message">Text to display.</param>
 /// <param name="caption">The title of message box.</param>
 /// <param name="icon">Large icon displayed on the left side of the message box.</param>
 /// <param name="defaultButton">The default button. Buttons set as default will be highlighted.</param>
 public static MessageBoxResult Show(Window owner, string message, string caption, MessageBoxIcon icon, DefaultButton defaultButton)
 {
     return(CallMessageBoxXWindow(owner, message, caption, MessageBoxButton.OK, icon, defaultButton, null));
 }
Пример #47
0
 //Método Mensaje - Envía mensaje en un cuadro de texto al usuario.
 public void Mensaje(string Mensaje, string Titulo, MessageBoxButtons Botones, MessageBoxIcon Icono)
 {
     MessageBox.Show(Mensaje, String.Format(Configuracion.Titulo, Titulo), Botones, Icono);
 }
Пример #48
0
 /// <summary>
 /// Open a message box and return the result selected by the user.
 /// </summary>
 /// <param name="owner">The owner of message box.</param>
 /// <param name="message">Text to display.</param>
 /// <param name="caption">The title of message box.</param>
 /// <param name="icon">Large icon displayed on the left side of the message box.</param>
 public static MessageBoxResult Show(Window owner, string message, MessageBoxIcon icon)
 {
     return(CallMessageBoxXWindow(owner, message, null, MessageBoxButton.OK, icon, DefaultButton.Unset, null));
 }
Пример #49
0
 public static DialogResult Show(string text, string caption, string errorDetails,
                                 MessageBoxButtons buttons, MessageBoxIcon icon,
                                 MessageBoxDefaultButton defaultButton, FormStartPosition startPosition)
 {
     return(Show(null, text, caption, errorDetails, buttons, icon, defaultButton, startPosition));
 }
Пример #50
0
        public DialogResult messageBoxCaller(string message, string header, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            Thread.Sleep(100);
            DialogResult r = DialogResult.Cancel;

            form1.Invoke(new Action(() =>
                                    r = MetroMessageBox.Show(form1, message, header, buttons, icon, 300)));
            return(r);
        }
 /// <summary>
 /// 创建消息窗体
 /// </summary>
 public MessageForm(string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, string attachMessage, bool enableAnimate, bool enableSound)
     : this(enableAnimate)
 {
     this.lbMsg.Text     = message;
     this.Text           = caption;
     this.txbAttach.Text = attachMessage;
     this.MessageButtons = buttons;
     this.MessageIcon    = icon;
     this.DefaultButton  = defaultButton;
     this.UseSound       = enableSound;
 }
Пример #52
0
 public static DialogResult Show(string text, string caption,
                                 MessageBoxButtons buttons, MessageBoxIcon icon = MessageBoxIcon.None)
 {
     return(Show(null, text, caption, null, buttons,
                 icon, MessageBoxDefaultButton.Button1, FormStartPosition.CenterParent));
 }
 /// <summary>
 /// 显示消息框
 /// </summary>
 /// <param name="message">消息文本</param>
 /// <param name="caption">消息框标题</param>
 /// <param name="exception">异常实例</param>
 /// <param name="buttons">按钮组合</param>
 /// <param name="icon">图标</param>
 /// <param name="defaultButton">默认按钮</param>
 public static DialogResult Show(string message, string caption, Exception exception, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
 {
     return(Show(message, caption, exception == null ? string.Empty : exception.ToString(), buttons, icon, defaultButton));
 }
        /// <summary>
        /// 显示消息框
        /// </summary>
        /// <param name="message">消息文本</param>
        /// <param name="caption">消息框标题</param>
        /// <param name="attachMessage">附加消息</param>
        /// <param name="buttons">按钮组合</param>
        /// <param name="icon">图标</param>
        public static DialogResult Show(string message, string caption, string attachMessage, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            if (!Enum.IsDefined(typeof(MessageBoxButtons), buttons))
            {
                throw new InvalidEnumArgumentException(InvalidButtonExString);
            }
            if (!Enum.IsDefined(typeof(MessageBoxIcon), icon))
            {
                throw new InvalidEnumArgumentException(InvalidIconExString);
            }

            return(ShowCore(message, caption, attachMessage, buttons, icon, MessageBoxDefaultButton.Button1));
        }
Пример #55
0
 public static DialogResult Show(IWin32Window parent, string text, MessageBoxButtons buttons, MessageBoxIcon icon, ref bool saveAnswer)
 {
     return(MessageBoxEx.Show(parent, text, buttons, icon, ref saveAnswer, null));
 }
 //内部方法,不检查参数有效性
 private static DialogResult ShowCore(string message, string caption, string attachMessage, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
 {
     using (MessageForm f = new MessageForm(message, caption, buttons, icon, defaultButton, attachMessage, EnableAnimate, EnableSound))
     {
         return(f.ShowDialog());
     }
 }
Пример #57
0
 /// <summary>
 /// Mostra uma mensagem ao usuario,(retorna um dialogResult dependente o tipo de Buttons definido com parâmetro)
 /// </summary>
 /// <param name="mensagem">Mensagem ao usuário</param>
 /// <param name="caption">Cabeçalho</param>
 /// <param name="msgButton">Buttons</param>
 /// <param name="msgIcon"> Icone da caixa de texto.</param>
 /// <returns></returns>
 public static DialogResult mostrarMensagem(string mensagem, string caption, MessageBoxButtons msgButton, MessageBoxIcon msgIcon)
 {
     return(MessageBox.Show(mensagem, caption, msgButton, msgIcon, MessageBoxDefaultButton.Button2));
 }
Пример #58
0
        public static DialogResult Show(IWin32Window parent, string text, MessageBoxButtons buttons, MessageBoxIcon icon, ref bool saveAnswer, string saveAnswerInRegistryKey)
        {
            MessageBoxEx msgBox = new MessageBoxEx(text, buttons, icon, saveAnswerInRegistryKey);

            DialogResult res = msgBox.ShowDialog(parent);

            saveAnswer = msgBox.SaveAnswer;

            return(res);
        }
Пример #59
0
 /// <summary>
 /// Shows the specified message box.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="text">The text.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="defaultButton">The default button.</param>
 /// <param name="linkClickedAction">optional handler if user clicks a hyperlink (as determined by RichTextBox). Set to
 /// <seealso cref="BasicLinkClickedEventHandler"/> to get basic handling. If <c>null</c>, URLs will not be detected or
 /// highlighted in the message.</param>
 /// <returns>The dialog result.</returns>
 /// <returns>The dialog result.</returns>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons,
                                 MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, LinkClickedEventHandler linkClickedAction = null)
 {
     return(FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton, linkClickedAction));
 }
Пример #60
0
        public MessageBoxEx(string text, MessageBoxButtons buttons, MessageBoxIcon icon, string saveAnswerInRegistryKey)
        {
            InitializeComponent();

            labelText.Text = text;

            SaveAnswerInRegistryKey = saveAnswerInRegistryKey;

            switch (icon)
            {
            case MessageBoxIcon.Exclamation:
                pictureBoxIcon.Image = Misc.IconToAlphaBitmap(Icons.exclamation);
                break;

            case MessageBoxIcon.Information:
                pictureBoxIcon.Image = Misc.IconToAlphaBitmap(Icons.information);
                break;

            case MessageBoxIcon.Question:
                pictureBoxIcon.Image = Misc.IconToAlphaBitmap(Icons.question);
                break;

            case MessageBoxIcon.Stop:
                pictureBoxIcon.Image = Misc.IconToAlphaBitmap(Icons.error);
                break;

            case MessageBoxIcon.None:
            default:
                break;
            }

            switch (buttons)
            {
            case MessageBoxButtons.AbortRetryIgnore:
                tableLayoutPanel.ColumnCount = 3;
                button1.Text         = StringTable.Abort;
                button1.DialogResult = DialogResult.Abort;
                button2.Text         = StringTable.Retry;
                button2.DialogResult = DialogResult.Retry;
                button3.Text         = StringTable.Ignore;
                button3.DialogResult = DialogResult.Ignore;
                AcceptButton         = button1;
                CancelButton         = button1;
                break;

            case MessageBoxButtons.OK:
                tableLayoutPanel.ColumnCount = 1;
                button1.Anchor            = AnchorStyles.None;
                button1.Text              = StringTable.OK;
                button1.DialogResult      = DialogResult.OK;
                AcceptButton              = button1;
                CancelButton              = button1;
                checkBoxDontAskAgain.Text = StringTable.DontDisplayAgain;
                break;

            case MessageBoxButtons.OKCancel:
                tableLayoutPanel.ColumnCount = 2;
                button1.Text         = StringTable.OK;
                button1.DialogResult = DialogResult.OK;
                button2.Text         = StringTable.Cancel;
                button2.DialogResult = DialogResult.Cancel;
                AcceptButton         = button1;
                CancelButton         = button2;
                break;

            case MessageBoxButtons.RetryCancel:
                tableLayoutPanel.ColumnCount = 2;
                button1.Text         = StringTable.Retry;
                button1.DialogResult = DialogResult.Retry;
                button2.Text         = StringTable.Cancel;
                button2.DialogResult = DialogResult.Cancel;
                AcceptButton         = button1;
                CancelButton         = button2;
                break;

            case MessageBoxButtons.YesNo:
                tableLayoutPanel.ColumnCount = 2;
                button1.Text         = StringTable.Yes;
                button1.DialogResult = DialogResult.Yes;
                button2.Text         = StringTable.No;
                button2.DialogResult = DialogResult.No;
                AcceptButton         = button1;
                CancelButton         = button2;
                break;

            case MessageBoxButtons.YesNoCancel:
                tableLayoutPanel.ColumnCount = 3;
                button1.Text         = StringTable.Yes;
                button1.DialogResult = DialogResult.Yes;
                button2.Text         = StringTable.No;
                button2.DialogResult = DialogResult.No;
                button3.Text         = StringTable.Cancel;
                button3.DialogResult = DialogResult.Cancel;
                AcceptButton         = button1;
                CancelButton         = button3;
                break;

            default:
                break;
            }
        }