예제 #1
0
파일: MessageBox.cs 프로젝트: nhannd/Xian
        internal DialogBoxAction Show(string message, string title, ClearCanvas.Common.MessageBoxActions buttons, IWin32Window owner)
        {
#if !MONO 
			// Ticket #7285:  messages boxes should not be obscured by the splashscreen
			// If no splash screen is being displayed, this is effectively a no-op.
			SplashScreenManager.DismissSplashScreen(owner as Form);
#endif 

            title = string.IsNullOrEmpty(title) ? Application.Name : string.Format("{0} - {1}", Application.Name, title);

        	using (var hook = new CommonDialogHook())
        	{
        		var mbButtons = _buttonMap[(int) buttons];

        		// The OK-only message box has a single button whose control ID is actually "Cancel"
        		if (mbButtons == MessageBoxButtons.OK)
        			hook.ButtonCaptions[2] = SR.ButtonOk;

        		var dr = System.Windows.Forms.MessageBox.Show(owner, message, title, mbButtons);
        		return (DialogBoxAction) _resultMap[dr];
        	}
        }
예제 #2
0
        internal DialogBoxAction Show(string message, string title, ClearCanvas.Common.MessageBoxActions buttons, IWin32Window owner)
        {
#if !MONO
            // Ticket #7285:  messages boxes should not be obscured by the splashscreen
            // If no splash screen is being displayed, this is effectively a no-op.
            SplashScreenManager.DismissSplashScreen(owner as Form);
#endif

            title = string.IsNullOrEmpty(title) ? Application.Name : string.Format("{0} - {1}", Application.Name, title);

            using (var hook = new CommonDialogHook())
            {
                var mbButtons = _buttonMap[(int)buttons];

                // The OK-only message box has a single button whose control ID is actually "Cancel"
                if (mbButtons == MessageBoxButtons.OK)
                {
                    hook.ButtonCaptions[2] = SR.ButtonOk;
                }

                var dr = System.Windows.Forms.MessageBox.Show(owner, message, title, mbButtons);
                return((DialogBoxAction)_resultMap[dr]);
            }
        }