Пример #1
0
		public static void GetSplash()
		{
			SplashTimer = new Timer { Interval = 2500 };
			SplashTimer.Start();
			SplashTimer.Elapsed += SplashElapsed;
			SplashWin = new ModernDialog
			{
				WindowStartupLocation = WindowStartupLocation.CenterScreen,
				SizeToContent = SizeToContent.WidthAndHeight,
				Buttons = null,
				Title = "Идет загрузка",
				Content = new SplashScreen()
			};
			SplashWin.ShowDialog();
		}
Пример #2
0
 private static IEnumerable<Button> GetButtons(ModernDialog owner, MessageBoxButton button)
 {
     if (button != MessageBoxButton.OK)
     {
         if (button != MessageBoxButton.OKCancel)
         {
             if (button != MessageBoxButton.YesNo)
             {
                 if (button != MessageBoxButton.YesNoCancel) yield break;
                 yield return owner.YesButton;
                 yield return owner.NoButton;
                 yield return owner.CancelButton;
             }
             else
             {
                 yield return owner.YesButton;
                 yield return owner.NoButton;
             }
         }
         else
         {
             yield return owner.OkButton;
             yield return owner.CancelButton;
         }
     }
     else
     {
         yield return owner.OkButton;
     }
 }
Пример #3
0
 private static void GetAbout(object obj)
 {
     AboutWin = new AboutWindow();
     SpeechConverter.GetJobVoice("О программе.");
     AboutWin.ShowDialog();
 }
Пример #4
0
        /// <summary>
        /// Displays a messagebox.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="title">The title.</param>
        /// <param name="button">The button.</param>
        /// <param name="owner">The window owning the messagebox. The messagebox will be located at the center of the owner.</param>
        /// <returns></returns>
        public static MessageBoxResult ShowMessage(string text, string title, MessageBoxButton button, Window owner = null)
        {
            var dlg = new ModernDialog {
                Title = title,
                Content = new BbCodeBlock { BbCode = text, Margin = new Thickness(0, 0, 0, 8) },
                MinHeight = 0,
                MinWidth = 0,
                MaxHeight = 480,
                MaxWidth = 640,
            };
            if (owner != null) {
                dlg.Owner = owner;
            }

            dlg.Buttons = GetButtons(dlg, button);
            dlg.ShowDialog();
            return dlg._messageBoxResult;
        }