A class that represents the settings used by Metro Dialogs.
		internal async void BtnDeleteDeck_Click(object sender, RoutedEventArgs e)
		{
			var decks = DeckPickerList.SelectedDecks;
			if(!decks.Any())
				return;

			var settings = new MetroDialogSettings {AffirmativeButtonText = "Yes", NegativeButtonText = "No"};
			var keepStatsInfo = Config.Instance.KeepStatsWhenDeletingDeck
				                    ? "The stats will be kept (can be changed in options)"
				                    : "The stats will be deleted (can be changed in options)";
			var result =
				await
				this.ShowMessageAsync("Deleting " + (decks.Count == 1 ? decks.First().Name : decks.Count + " decks"),
				                      "Are you Sure?\n" + keepStatsInfo, MessageDialogStyle.AffirmativeAndNegative, settings);
			if(result == MessageDialogResult.Negative)
				return;
			DeckManagerEvents.OnDeckDeleted.Execute(decks);
			SelectDeck(null, true);
			foreach(var deck in decks)
				DeleteDeck(deck, false);
			DeckStatsList.Save();
			DeckList.Save();
			DeckPickerList.UpdateDecks();
			DeckPickerList.UpdateArchivedClassVisibility();
		}
      public async void ShowProgressDialog()
      {
          
          MetroDialogSettings settings = new MetroDialogSettings() { NegativeButtonText = "Cancel", AnimateShow = true, AnimateHide=true };
          _controller = await _dialogCoordinator.ShowProgressAsync(this, "Screen8ViewModel is working on something", "", true, settings);
 
      }
Esempio n. 3
0
        private async void CloseWin(bool check=true)
        {
            if (check)
            {
                var mySettings = new MetroDialogSettings()
                {
                    AffirmativeButtonText = "Yes, cancel",
                    NegativeButtonText = "No, continue with ticket creation",
                    AnimateShow = true,
                    AnimateHide = false
                };

                var result = await this.ShowMessageAsync("Quit Creating ticket?",
                                                         "Sure you want to cancel creating a ticket?",
                                                          MessageDialogStyle.AffirmativeAndNegative, mySettings);

                if (result == MessageDialogResult.Affirmative)
                {
                    this.Closing -= CloseWindow;
                    this.Close();
                }
            }
            else
            {
                this.Closing -= CloseWindow;
                this.Close();
            }
        }
Esempio n. 4
0
        private async void ShowMessage(object sender, string affirmativeButtonText, string negativeButtonText, string title, string message, bool animateShow = true, bool animateHide = false)
        {
            var mySettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = affirmativeButtonText,
                NegativeButtonText = negativeButtonText,
                AnimateShow = animateShow,
                AnimateHide = animateHide
            };

            var mainWindow = Application.Current.Windows.OfType<MetroWindow>().FirstOrDefault(x => x.Title == "Ultimate Festival Organizer");
            if (mainWindow != null)
            {
                var result = await mainWindow.ShowMessageAsync(title,
                message,
                MessageDialogStyle.AffirmativeAndNegative, mySettings);

                if (result == MessageDialogResult.Affirmative)
                {
                    // Execute command in tag
                    var button = sender as Button;
                    if (button != null)
                    {
                        var command = button.Tag as ICommand;
                        if (command != null)
                            command.Execute(button.CommandParameter);
                    }
                }
            }
        }
Esempio n. 5
0
        public override Task<string> ShowInputDialog(string title, string message, MetroDialogSettings settings = null)
        {
            if (GetActiveWindow() == null)
                return null;

            return GetActiveWindow().ShowInputAsync(title, message, settings);
        }
		private async void ExportDeck(Deck deck)
		{
			var export = true;
			if(Config.Instance.ShowExportingDialog)
			{
				var message =
					string.Format(
					              "1) create a new, empty {0}-Deck {1}.\n\n2) leave the deck creation screen open.\n\n3)do not move your mouse or type after clicking \"export\"",
					              deck.Class, (Config.Instance.AutoClearDeck ? "(or open an existing one to be cleared automatically)" : ""));

				if(deck.GetSelectedDeckVersion().Cards.Any(c => c.Name == "Stalagg" || c.Name == "Feugen"))
				{
					message +=
						"\n\nIMPORTANT: If you own golden versions of Feugen or Stalagg please make sure to configure\nOptions > Other > Exporting";
				}

				var settings = new MetroDialogSettings {AffirmativeButtonText = "export"};
				var result =
					await
					this.ShowMessageAsync("Export " + deck.Name + " to Hearthstone", message, MessageDialogStyle.AffirmativeAndNegative, settings);
				export = result == MessageDialogResult.Affirmative;
			}
			if(export)
			{
				var controller = await this.ShowProgressAsync("Creating Deck", "Please do not move your mouse or type.");
				Topmost = false;
				await Task.Delay(500);
				await DeckExporter.Export(deck);
				await controller.CloseAsync();

				if(deck.MissingCards.Any())
					this.ShowMissingCardsMessage(deck);
			}
		}
        private async Task CloseHandleAsync()
        {
            if (_shutdown) return;

            var settings = new MetroDialogSettings()
            {
                AffirmativeButtonText = Properties.Resources.Close,
                NegativeButtonText = Properties.Resources.Cancel,
                AnimateShow = true,
                AnimateHide = false
            };

            var result = await this.ShowMessageAsync(
                Properties.Resources.TitleDlgExitApp,
                Properties.Resources.QuestionExitApp,
                MessageDialogStyle.AffirmativeAndNegative, settings);

            if (result == MessageDialogResult.Affirmative)
            {
                ViewModelLocator.Cleanup();

                _shutdown = true;
                Application.Current.Shutdown();
            }
        }
        /// <summary>
        /// Hides a visible Metro Dialog instance.
        /// </summary>
        /// <param name="window">The window with the dialog that is visible.</param>
        /// <param name="dialog">The dialog instance to hide.</param>
        /// <returns>A task representing the operation.</returns>
        /// <exception cref="InvalidOperationException">
        /// The <paramref name="dialog"/> is not visible in the window.
        /// This happens if <see cref="ShowMetroDialogAsync"/> hasn't been called before.
        /// </exception>
        public static Task HideMetroDialogAsync(this MetroWindow window, BaseMetroDialog dialog, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            if (!window.metroDialogContainer.Children.Contains(dialog))
                throw new InvalidOperationException("The provided dialog is not visible in the specified window.");

            window.SizeChanged -= dialog.SizeChangedHandler;

            dialog.OnClose();

            Task closingTask = (Task)window.Dispatcher.Invoke(new Func<Task>(dialog._WaitForCloseAsync));
            return closingTask.ContinueWith(a =>
            {
                if (DialogClosed != null)
                {
                    window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs())));
                }

                return (Task)window.Dispatcher.Invoke(new Func<Task>(() =>
                {
                    window.metroDialogContainer.Children.Remove(dialog); //remove the dialog from the container

                    return HandleOverlayOnHide(settings, window);
                }));
            }).Unwrap();
        }
		public static async Task ShowSavedAndUploadedFileMessage(this MainWindow window, string fileName, string url)
		{
			var settings = new MetroDialogSettings {NegativeButtonText = "open in browser", FirstAuxiliaryButtonText = "copy url to clipboard"};
			var sb = new StringBuilder();
			if(fileName != null)
				sb.AppendLine("Saved to\n\"" + fileName + "\"");
			sb.AppendLine("Uploaded to\n" + url);
			var result = await window.ShowMessageAsync("", sb.ToString(), MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, settings);
			if(result == MessageDialogResult.Negative)
			{
				try
				{
					Process.Start(url);
				}
				catch(Exception ex)
				{
					Logger.WriteLine("Error starting browser: " + ex, "ScreenshotMessageDialog");
				}
			}
			else if(result == MessageDialogResult.FirstAuxiliary)
			{
				try
				{
					Clipboard.SetText(url);
				}
				catch(Exception ex)
				{
					Logger.WriteLine("Error copying url to clipboard: " + ex, "ScreenshotMessageDialog");
				}
			}
		}
Esempio n. 10
0
        internal MessageDialog(MetroWindow parentWindow, MetroDialogSettings settings)
            : base(parentWindow, settings)
        {
            InitializeComponent();

            PART_MessageScrollViewer.Height = DialogSettings.MaximumBodyHeight;
        }
Esempio n. 11
0
        public static async Task<string> SelectFolderPath(string BaseFolderPath)
        {
            var returnString = string.Empty;

            FolderBrowserDialog p = new FolderBrowserDialog();
            p.SelectedPath = BaseFolderPath;
            p.ShowDialog();
            var selectedPath = p.SelectedPath;

            if (string.IsNullOrEmpty(selectedPath))
            {
                return "";
            }

            var isValid = PathValidator.ValidatePath(BaseFolderPath, selectedPath);

            if (!isValid)
            {
                var window = System.Windows.Application.Current.MainWindow as MetroWindow;
                MetroDialogSettings Settings = new MetroDialogSettings();
                Settings.AffirmativeButtonText = "Yes";
                Settings.NegativeButtonText = "No";
                var x = await window.ShowMessageAsync("Not allowed", "The selected path is invalid, do you want to try again?", MessageDialogStyle.AffirmativeAndNegative, Settings);

                switch (x)
                {
                    case MessageDialogResult.Negative:
                        return "";
                    case MessageDialogResult.Affirmative:
                        return await SelectFolderPath(BaseFolderPath);
                }
            }

            return selectedPath;
        }
Esempio n. 12
0
        public PlayerViewModel(DialogCoordinator pCoordinator)
        {
            DialogCoordinator = pCoordinator;
            Tracks = new ObservableCollection<Track>();
            Tracks.CollectionChanged += Tracks_CollectionChanged;


            var errorSettings = new MetroDialogSettings();
            errorSettings.ColorScheme = MetroDialogColorScheme.Theme;

            TestCommand = new RelayCommand(() => ShowMessage("Error", "EIN FEHLER!", MessageDialogStyle.Affirmative, errorSettings));



            if (Properties.Settings.Default.ShouldScanForNewTracks)
            {
                foreach (var path in Properties.Settings.Default.TrackLocations)
                {
                    FileSystemWatcher fsw = new FileSystemWatcher(path);
                    fsw.Created += Fsw_Created;
                    fsw.Deleted += Fsw_Deleted;
                    fsw.EnableRaisingEvents = true;
                    fileSystemWatchers.Add(fsw);

                }

            }

        }
		private async void BtnIdString_Click(object sender, RoutedEventArgs e)
		{
			var settings = new MetroDialogSettings();
			var clipboard = Clipboard.GetText();
			if(clipboard.Count(c => c == ':') > 0 && clipboard.Count(c => c == ';') > 0)
				settings.DefaultText = clipboard;

			//import dialog
			var idString = await this.ShowInputAsync("Import deck", "id:count;id2:count2;... (e.g. EX1_050:2;EX1_556:1;)\nObtained from: \nEXPORT > COPY IDS TO CLIPBOARD", settings);
			if(string.IsNullOrEmpty(idString))
				return;
			var deck = new Deck();
			foreach(var entry in idString.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries))
			{
				var splitEntry = entry.Split(':');
				if(splitEntry.Length != 2)
					continue;
				var card = Game.GetCardFromId(splitEntry[0]);
				if(card.Id == "UNKNOWN")
					continue;
				int count;
				int.TryParse(splitEntry[1], out count);
				card.Count = count;

				if(string.IsNullOrEmpty(deck.Class) && card.GetPlayerClass != "Neutral")
					deck.Class = card.GetPlayerClass;

				deck.Cards.Add(card);
			}
			SetNewDeck(deck);
		}
		private async Task<Deck> ImportDeckFromWeb()
		{
			var settings = new MetroDialogSettings();
			var clipboard = Clipboard.GetText();
			var validUrls = new[]
				{
					"hearthstats", "hss.io", "hearthpwn", "hearthhead", "hearthstoneplayers", "tempostorm",
					"hearthstonetopdeck", "hearthnews.fr", "arenavalue", "hearthstone-decks"
				};
			if(validUrls.Any(clipboard.Contains))
				settings.DefaultText = clipboard;

			//import dialog
			var url = await this.ShowInputAsync("Import deck", "Supported websites:\n" + validUrls.Aggregate((x, next) => x + ", " + next), settings);
			if(string.IsNullOrEmpty(url))
				return null;

			var controller = await this.ShowProgressAsync("Loading Deck...", "please wait");

			//var deck = await this._deckImporter.Import(url);
			var deck = await DeckImporter.Import(url);
			deck.Url = url;

			await controller.CloseAsync();
			return deck;
		}
        private async void CleanWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (e.Cancel) return;

            // we want manage the closing itself!
            e.Cancel = !this.closeMe;
            // yes we want now really close the window
            if (this.closeMe) return;

            var mySettings = new MetroDialogSettings()
                             {
                                 AffirmativeButtonText = "Quit",
                                 NegativeButtonText = "Cancel",
                                 AnimateShow = true,
                                 AnimateHide = false
                             };
            var result = await this.ShowMessageAsync(
                "Quit application?",
                "Sure you want to quit application?",
                MessageDialogStyle.AffirmativeAndNegative, mySettings);

            this.closeMe = result == MessageDialogResult.Affirmative;

            if (this.closeMe) this.Close();
        }
Esempio n. 16
0
        private async void ShowMessage(object sender, string affirmativeButtonText, string negativeButtonText, string title, string message, bool animateShow = true, bool animateHide = false)
        {
            var mySettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = affirmativeButtonText,
                NegativeButtonText = negativeButtonText,
                AnimateShow = animateShow,
                AnimateHide = animateHide
            };

            if (mainWindow != null)
            {
                var result = await mainWindow.ShowMessageAsync(title,
                message,
                MessageDialogStyle.AffirmativeAndNegative, mySettings);

                if (result == MessageDialogResult.Affirmative)
                {
                    // Execute command in tag
                    var button = sender as Button;
                    if (button != null)
                    {
                        var command = button.Tag as ICommand;
                        if (command != null)
                            command.Execute(button.CommandParameter);
                    }
                }
            }
        }
		public static async Task ShowHsNotInstalledMessage(this MetroWindow window)
		{
			var settings = new MetroDialogSettings {AffirmativeButtonText = "Ok", NegativeButtonText = "Select manually"};
			var result =
				await
				window.ShowMessageAsync("Hearthstone install directory not found",
				                        "Hearthstone Deck Tracker will not work properly if Hearthstone is not installed on your machine (obviously).",
				                        MessageDialogStyle.AffirmativeAndNegative, settings);
			if(result == MessageDialogResult.Negative)
			{
				var dialog = new OpenFileDialog
				{
					Title = "Select Hearthstone.exe",
					DefaultExt = "Hearthstone.exe",
					Filter = "Hearthstone.exe|Hearthstone.exe"
				};
				var dialogResult = dialog.ShowDialog();

				if(dialogResult == true)
				{
					Config.Instance.HearthstoneDirectory = Path.GetDirectoryName(dialog.FileName);
					Config.Save();
					Helper.MainWindow.ShowMessage("Restart required.", "Please restart HDT for this to take effect.");
				}
			}
		}
Esempio n. 18
0
        public void ConfirmSave(WindowMain.CallBack afterSave_callback = null)
        {
            if (!CheckJson())
            {
                afterSave_callback?.Invoke();
                return;
            }

            if (!UserControls.ConfigOptions.ConfigOptionManager.bChanged)
            {
                afterSave_callback?.Invoke();
                return;
            }

            MahApps.Metro.Controls.Dialogs.MetroDialogSettings settings = new MahApps.Metro.Controls.Dialogs.MetroDialogSettings()
            {
                AffirmativeButtonText    = "Yes",
                NegativeButtonText       = "No",
                FirstAuxiliaryButtonText = "Cancel"
            };
            WindowMain.current.ShowMessageDialog("Save", "변경된 Config File 을 저장하시겠습니까?",
                                                 MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary,
                                                 affirmative_callback: delegate { SaveJsonFile(); afterSave_callback?.Invoke(); },
                                                 negative_callback: delegate { afterSave_callback?.Invoke(); },
                                                 settings: settings);
        }
 public CameraPositioningCalibrationView(MetroWindow parentWindow, MetroDialogSettings settings)
     : base(parentWindow, settings)
 {
     InitializeComponent();
     DataContextChanged += CameraPositioningCalibrationView_DataContextChanged;
     CloseButton.Command = CloseCommand;
 }
		private async void BtnIdString_Click(object sender, RoutedEventArgs e)
		{
			var settings = new MetroDialogSettings();
			var clipboard = Clipboard.GetText();
			if(clipboard.Count(c => c == ':') > 0 && clipboard.Count(c => c == ';') > 0)
				settings.DefaultText = clipboard;

			//import dialog
			var idString = await Helper.MainWindow.ShowInputAsync("Import deck", "", settings);
			if(string.IsNullOrEmpty(idString))
				return;
			var deck = new Deck();
			foreach(var entry in idString.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries))
			{
				var splitEntry = entry.Split(':');
				if(splitEntry.Length != 2)
					continue;
				var card = Game.GetCardFromId(splitEntry[0]);
				if(card.Id == "UNKNOWN")
					continue;
				var count = 1;
				int.TryParse(splitEntry[1], out count);
				card.Count = count;

				if(string.IsNullOrEmpty(deck.Class) && card.GetPlayerClass != "Neutral")
					deck.Class = card.GetPlayerClass;

				deck.Cards.Add(card);
			}
			Helper.MainWindow.SetNewDeck(deck);

			After_Click();
		}
Esempio n. 21
0
        /// <summary>
        /// Creates a InputDialog inside of the current window.
        /// </summary>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns>
        public static Task<string> ShowInputAsync(this MetroWindow window, string title, string message, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            return HandleOverlayOnShow(settings, window).ContinueWith(z =>
                {
                    return (Task<string>)window.Dispatcher.Invoke(new Func<Task<string>>(() =>
                        {
                            if (settings == null)
                                settings = window.MetroDialogOptions;

                            //create the dialog control
                            InputDialog dialog = new InputDialog(window, settings);
                            dialog.Title = title;
                            dialog.Message = message;
                            dialog.Input = settings.DefaultText;

                            SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                            dialog.SizeChangedHandler = sizeHandler;

                            return dialog.WaitForLoadAsync().ContinueWith(x =>
                            {
                                if (DialogOpened != null)
                                {
                                    window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs()
                                    {
                                    })));
                                }

                                return dialog.WaitForButtonPressAsync().ContinueWith(y =>
                                {
                                    //once a button as been clicked, begin removing the dialog.

                                    dialog.OnClose();

                                    if (DialogClosed != null)
                                    {
                                        window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs()
                                        {
                                        })));
                                    }

                                    Task closingTask = (Task)window.Dispatcher.Invoke(new Func<Task>(() => dialog._WaitForCloseAsync()));
                                    return closingTask.ContinueWith<Task<string>>(a =>
                                        {
                                            return ((Task)window.Dispatcher.Invoke(new Func<Task>(() =>
                                            {
                                                window.SizeChanged -= sizeHandler;

                                                window.metroDialogContainer.Children.Remove(dialog); //remove the dialog from the container

                                                return HandleOverlayOnHide(settings, window);
                                                //window.overlayBox.Visibility = System.Windows.Visibility.Hidden; //deactive the overlay effect

                                            }))).ContinueWith(y3 => y).Unwrap();
                                        });
                                }).Unwrap();
                            }).Unwrap().Unwrap();
                        }));
                }).Unwrap();
        }
Esempio n. 22
0
 internal AdvancedInputDialog(MetroWindow parentWindow, MetroDialogSettings settings)
     : base(parentWindow, settings)
 {
     InitializeComponent();
     PART_AffirmativeButton.Content = settings.AffirmativeButtonText;
     PART_NegativeButton.Content = settings.NegativeButtonText;
     Input = settings.DefaultText;
 }
        public void ShowDialogError(string title, string message)
        {
            var metroDialogSettings = new MetroDialogSettings();
            metroDialogSettings.ColorScheme = MetroDialogColorScheme.Inverted;

            DialogCoordinator.Instance.ShowMessageAsync(this, title, message, MessageDialogStyle.Affirmative,
                metroDialogSettings);
        }
		public static async Task ShowSavedFileMessage(this MainWindow window, string fileName)
		{
			var settings = new MetroDialogSettings {NegativeButtonText = "Open folder"};
			var result =
				await window.ShowMessageAsync("", "Saved to\n\"" + fileName + "\"", MessageDialogStyle.AffirmativeAndNegative, settings);
			if(result == MessageDialogResult.Negative)
				Process.Start(Path.GetDirectoryName(fileName));
		}
Esempio n. 25
0
        /// <summary>
        /// Initializes a new MahApps.Metro.Controls.BaseMetroDialog.
        /// </summary>
        /// <param name="owningWindow">The window that is the parent of the dialog.</param>
        /// <param name="settings">The settings for the message dialog.</param>
        protected BaseMetroDialog(IHandleDialogs owningWindow, MetroDialogSettings settings)
        {
            DialogSettings = settings ?? owningWindow.MetroDialogOptions;

            OwningWindow = owningWindow as FrameworkElement;

            Initialize();
        }
Esempio n. 26
0
        /// <summary>
        /// Initializes a new MahApps.Metro.Controls.BaseMetroDialog.
        /// </summary>
        /// <param name="owningWindow">The window that is the parent of the dialog.</param>
        /// <param name="settings">The settings for the message dialog.</param>
        protected BaseMetroDialog(MetroWindow owningWindow, MetroDialogSettings settings)
        {
            DialogSettings = settings ?? owningWindow.MetroDialogOptions;

            OwningWindow = owningWindow;

            Initialize();
        }
		public static async Task<MessageDialogResult> ShowDeleteMultipleGameStatsMessage(this MetroWindow window, int count)
		{
			var settings = new MetroDialogSettings {AffirmativeButtonText = "Yes", NegativeButtonText = "No"};
			return
				await
				window.ShowMessageAsync("Delete Games", "This will delete the selected games (" + count + ").\n\nAre you sure?",
				                        MessageDialogStyle.AffirmativeAndNegative, settings);
		}
Esempio n. 28
0
        public SwitchProfileDialog(string[] profiles, MetroWindow parentWindow, MetroDialogSettings settings)
            : base(parentWindow, settings)
        {
            InitializeComponent();

            foreach (string profile in profiles)
                PART_ProfileComboBox.Items.Add(profile);
        }
		public static async Task ShowUpdateNotesMessage(this MetroWindow window)
		{
			const string releaseDownloadUrl = @"https://github.com/Epix37/Hearthstone-Deck-Tracker/releases";
			var settings = new MetroDialogSettings {AffirmativeButtonText = "Show update notes", NegativeButtonText = "Close"};

			var result = await window.ShowMessageAsync("Update successful", "", MessageDialogStyle.AffirmativeAndNegative, settings);
			if(result == MessageDialogResult.Affirmative)
				Process.Start(releaseDownloadUrl);
		}
		public static async Task<MessageDialogResult> ShowDeleteGameStatsMessage(MetroWindow window, GameStats stats)
		{
			var settings = new MetroDialogSettings {AffirmativeButtonText = "Yes", NegativeButtonText = "No"};
			return
				await
				window.ShowMessageAsync("Delete Game",
				                        stats.Result + " vs " + stats.OpponentHero + "\nfrom " + stats.StartTime + "\n\nAre you sure?",
				                        MessageDialogStyle.AffirmativeAndNegative, settings);
		}
Esempio n. 31
0
 public Task<MessageDialogResult> AskQuestionAsync(string title, string message)
 {
     var settings = new MetroDialogSettings()
     {
         AffirmativeButtonText = "Yes",
         NegativeButtonText = "No",
     };
     return metroWindow.ShowMessageAsync(title, message,
         MessageDialogStyle.AffirmativeAndNegative, settings);
 }
Esempio n. 32
0
 /// <summary>
 /// With this method it's possible to return your own settings in a custom dialog.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 protected virtual MetroDialogSettings ConfigureSettings(MetroDialogSettings settings)
 {
     return(settings);
 }
Esempio n. 33
0
        /// <summary>
        /// Creates a InputDialog outside of the current window.
        /// </summary>
        /// <param name="window">The MetroWindow</param>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns>
        public static string ShowModalInputExternal(this MetroWindow window, string title, string message, MetroDialogSettings settings = null)
        {
            var win = CreateModalExternalWindow(window);

            settings = settings ?? window.MetroDialogOptions;

            //create the dialog control
            var dialog = new InputDialog(window, settings)
            {
                Message = message,
                Title   = title,
                Input   = settings.DefaultText
            };

            SetDialogFontSizes(settings, dialog);

            win.Content = dialog;

            string result = null;

            dialog.WaitForButtonPressAsync().ContinueWith(task =>
            {
                result = task.Result;
                win.Invoke(win.Close);
            });

            HandleOverlayOnShow(settings, window);
            win.ShowDialog();
            HandleOverlayOnHide(settings, window);
            return(result);
        }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new MahApps.Metro.Controls.BaseMetroDialog.
 /// </summary>
 /// <param name="owningWindow">The window that is the parent of the dialog.</param>
 /// <param name="settings">The settings for the message dialog.</param>
 protected BaseMetroDialog(MetroWindow owningWindow, MetroDialogSettings settings)
 {
     this.Initialize(owningWindow, settings);
 }
Esempio n. 35
0
        /// <summary>
        /// Adds a Metro Dialog instance to the specified window and makes it visible asynchronously.
        /// If you want to wait until the user has closed the dialog, use <see cref="BaseMetroDialog.WaitUntilUnloadedAsync"/>
        /// <para>You have to close the resulting dialog yourself with <see cref="HideMetroDialogAsync"/>.</para>
        /// </summary>
        /// <param name="window">The owning window of the dialog.</param>
        /// <param name="dialog">The dialog instance itself.</param>
        /// <param name="settings">An optional pre-defined settings instance.</param>
        /// <returns>A task representing the operation.</returns>
        /// <exception cref="InvalidOperationException">The <paramref name="dialog"/> is already visible in the window.</exception>
        public static Task ShowMetroDialogAsync([NotNull] this MetroWindow window, [NotNull] BaseMetroDialog dialog, [CanBeNull] MetroDialogSettings settings = null)
        {
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }

            window.Dispatcher.VerifyAccess();
            if (dialog == null)
            {
                throw new ArgumentNullException(nameof(dialog));
            }

            if (window.metroActiveDialogContainer.Children.Contains(dialog) || window.metroInactiveDialogContainer.Children.Contains(dialog))
            {
                throw new InvalidOperationException("The provided dialog is already visible in the specified window.");
            }

            settings = settings ?? (dialog.DialogSettings ?? window.MetroDialogOptions);

            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return (Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                {
                    SetDialogFontSizes(settings, dialog);

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        dialog.OnShown();

                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs())));
                        }
                    });
                }));
            }).Unwrap());
        }
Esempio n. 36
0
        /// <summary>
        /// Creates a MessageDialog inside of the current window.
        /// </summary>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="style">The type of buttons to use.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>A task promising the result of which button was pressed.</returns>
        public static Task <MessageDialogResult> ShowMessageAsync(this MetroWindow window, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return (Task <MessageDialogResult>)window.Dispatcher.Invoke(new Func <Task <MessageDialogResult> >(() =>
                {
                    if (settings == null)
                    {
                        settings = window.MetroDialogOptions;
                    }

                    //create the dialog control
                    MessageDialog dialog = new MessageDialog(window, settings);
                    dialog.Message = message;
                    dialog.Title = title;
                    dialog.ButtonStyle = style;

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs()
                            {
                            })));
                        }

                        return dialog.WaitForButtonPressAsync().ContinueWith(y =>
                        {
                            //once a button as been clicked, begin removing the dialog.

                            dialog.OnClose();

                            if (DialogClosed != null)
                            {
                                window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs()
                                {
                                })));
                            }

                            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(() => dialog._WaitForCloseAsync()));
                            return closingTask.ContinueWith <Task <MessageDialogResult> >(a =>
                            {
                                return ((Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                                {
                                    window.SizeChanged -= sizeHandler;

                                    window.metroDialogContainer.Children.Remove(dialog);             //remove the dialog from the container

                                    return HandleOverlayOnHide(settings, window);
                                    //window.overlayBox.Visibility = System.Windows.Visibility.Hidden; //deactive the overlay effect
                                }))).ContinueWith(y3 => y).Unwrap();
                            });
                        }).Unwrap();
                    }).Unwrap().Unwrap();
                }));
            }).Unwrap());
        }
Esempio n. 37
0
        /// <summary>
        /// Creates a ProgressDialog inside of the current window.
        /// </summary>
        /// <param name="title">The title of the ProgressDialog.</param>
        /// <param name="message">The message within the ProgressDialog.</param>
        /// <param name="isCancelable">Determines if the cancel button is visible.</param>
        /// <param name="settings">Optional Settings that override the global metro dialog settings.</param>
        /// <returns>A task promising the instance of ProgressDialogController for this operation.</returns>
        public static Task <ProgressDialogController> ShowProgressAsync(this MetroWindow window, string title, string message, bool isCancelable = false, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();

            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return ((Task <ProgressDialogController>)window.Dispatcher.Invoke(new Func <Task <ProgressDialogController> >(() =>
                {
                    //create the dialog control
                    ProgressDialog dialog = new ProgressDialog(window);
                    dialog.Message = message;
                    dialog.Title = title;
                    dialog.IsCancelable = isCancelable;

                    if (settings == null)
                    {
                        settings = window.MetroDialogOptions;
                    }

                    dialog.NegativeButtonText = settings.NegativeButtonText;

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs()
                            {
                            })));
                        }

                        return new ProgressDialogController(dialog, () =>
                        {
                            dialog.OnClose();

                            if (DialogClosed != null)
                            {
                                window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs()
                                {
                                })));
                            }

                            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(() => dialog._WaitForCloseAsync()));
                            return closingTask.ContinueWith <Task>(a =>
                            {
                                return (Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                                {
                                    window.SizeChanged -= sizeHandler;

                                    window.metroDialogContainer.Children.Remove(dialog);     //remove the dialog from the container

                                    return HandleOverlayOnHide(settings, window);
                                    //window.overlayBox.Visibility = System.Windows.Visibility.Hidden; //deactive the overlay effect
                                }));
                            }).Unwrap();
                        });
                    });
                })));
            }).Unwrap());
        }
Esempio n. 38
0
        /// <summary>
        /// Adds a Metro Dialog instance of the given type to the specified window and makes it visible asynchronously.
        /// If you want to wait until the user has closed the dialog, use <see cref="BaseMetroDialog.WaitUntilUnloadedAsync"/>
        /// <para>You have to close the resulting dialog yourself with <see cref="HideMetroDialogAsync"/>.</para>
        /// </summary>
        /// <param name="window">The owning window of the dialog.</param>
        /// <param name="settings">An optional pre-defined settings instance.</param>
        /// <returns>A task with the dialog representing the operation.</returns>
        public static Task <TDialog> ShowMetroDialogAsync <TDialog>([NotNull] this MetroWindow window, [CanBeNull] MetroDialogSettings settings = null)
            where TDialog : BaseMetroDialog
        {
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }

            window.Dispatcher.VerifyAccess();

            var dialog = (TDialog)Activator.CreateInstance(typeof(TDialog), window, settings);

            return(HandleOverlayOnShow(dialog.DialogSettings, window).ContinueWith(z =>
            {
                return (Task <TDialog>)window.Dispatcher.Invoke(new Func <Task <TDialog> >(() =>
                {
                    SetDialogFontSizes(dialog.DialogSettings, dialog);

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        dialog.OnShown();

                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs())));
                        }
                    }).ContinueWith(x => dialog);
                }));
            }).Unwrap());
        }
Esempio n. 39
0
        /// <summary>
        /// Creates a ProgressDialog inside of the current window.
        /// </summary>
        /// <param name="window">The MetroWindow</param>
        /// <param name="title">The title of the ProgressDialog.</param>
        /// <param name="message">The message within the ProgressDialog.</param>
        /// <param name="isCancelable">Determines if the cancel button is visible.</param>
        /// <param name="settings">Optional Settings that override the global metro dialog settings.</param>
        /// <returns>A task promising the instance of ProgressDialogController for this operation.</returns>
        public static Task <ProgressDialogController> ShowProgressAsync(this MetroWindow window, string title, string message, bool isCancelable = false, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            settings = settings ?? window.MetroDialogOptions;
            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return ((Task <ProgressDialogController>)window.Dispatcher.Invoke(new Func <Task <ProgressDialogController> >(() =>
                {
                    //create the dialog control
                    var dialog = new ProgressDialog(window, settings)
                    {
                        Title = title,
                        Message = message,
                        IsCancelable = isCancelable
                    };

                    SetDialogFontSizes(settings, dialog);

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs())));
                        }

                        return new ProgressDialogController(dialog, () =>
                        {
                            dialog.OnClose();

                            if (DialogClosed != null)
                            {
                                window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs())));
                            }

                            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(() => dialog.WaitForCloseAsync()));
                            return closingTask.ContinueWith(a =>
                            {
                                return (Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                                {
                                    window.SizeChanged -= sizeHandler;

                                    window.RemoveDialog(dialog);

                                    return HandleOverlayOnHide(settings, window);
                                }));
                            }).Unwrap();
                        });
                    });
                })));
            }).Unwrap());
        }
Esempio n. 40
0
        /// <summary>
        /// Creates a MessageDialog inside of the current window.
        /// </summary>
        /// <param name="window">The MetroWindow</param>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="style">The type of buttons to use.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>A task promising the result of which button was pressed.</returns>
        public static Task <MessageDialogResult> ShowMessageAsync(this MetroWindow window, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            settings = settings ?? window.MetroDialogOptions;
            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return (Task <MessageDialogResult>)window.Dispatcher.Invoke(new Func <Task <MessageDialogResult> >(() =>
                {
                    //create the dialog control
                    var dialog = new MessageDialog(window, settings)
                    {
                        Message = message,
                        Title = title,
                        ButtonStyle = style
                    };

                    SetDialogFontSizes(settings, dialog);

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs())));
                        }

                        return dialog.WaitForButtonPressAsync().ContinueWith(y =>
                        {
                            //once a button as been clicked, begin removing the dialog.

                            dialog.OnClose();

                            if (DialogClosed != null)
                            {
                                window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs())));
                            }

                            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(() => dialog.WaitForCloseAsync()));
                            return closingTask.ContinueWith(a =>
                            {
                                return ((Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                                {
                                    window.SizeChanged -= sizeHandler;

                                    window.RemoveDialog(dialog);

                                    return HandleOverlayOnHide(settings, window);
                                }))).ContinueWith(y3 => y).Unwrap();
                            });
                        }).Unwrap();
                    }).Unwrap().Unwrap();
                }));
            }).Unwrap());
        }
Esempio n. 41
0
        /// <summary>
        /// Creates a InputDialog inside of the current window.
        /// </summary>
        /// <param name="window">The MetroWindow</param>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns>
        public static Task <string> ShowInputAsync(this MetroWindow window, string title, string message, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                return (Task <string>)window.Dispatcher.Invoke(new Func <Task <string> >(() =>
                {
                    if (settings == null)
                    {
                        settings = window.MetroDialogOptions;
                    }

                    //create the dialog control
                    var dialog = new InputDialog(window, settings)
                    {
                        Title = title,
                        Message = message,
                        Input = settings.DefaultText
                    };

                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;

                    return dialog.WaitForLoadAsync().ContinueWith(x =>
                    {
                        if (DialogOpened != null)
                        {
                            window.Dispatcher.BeginInvoke(new Action(() => DialogOpened(window, new DialogStateChangedEventArgs())));
                        }

                        return dialog.WaitForButtonPressAsync().ContinueWith(y =>
                        {
                            //once a button as been clicked, begin removing the dialog.

                            dialog.OnClose();

                            if (DialogClosed != null)
                            {
                                window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs())));
                            }

                            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(() => dialog._WaitForCloseAsync()));
                            return closingTask.ContinueWith(a =>
                            {
                                return ((Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                                {
                                    window.SizeChanged -= sizeHandler;

                                    window.metroDialogContainer.Children.Remove(dialog); //remove the dialog from the container

                                    return HandleOverlayOnHide(settings, window);
                                }))).ContinueWith(y3 => y).Unwrap();
                            });
                        }).Unwrap();
                    }).Unwrap().Unwrap();
                }));
            }).Unwrap());
        }
Esempio n. 42
0
 internal MessageDialog(MetroWindow parentWindow, MetroDialogSettings settings)
     : base(parentWindow, settings)
 {
     InitializeComponent();
 }
Esempio n. 43
0
        /// <summary>
        /// Creates a MessageDialog ouside of the current window.
        /// </summary>
        /// <param name="window">The MetroWindow</param>
        /// <param name="title">The title of the MessageDialog.</param>
        /// <param name="message">The message contained within the MessageDialog.</param>
        /// <param name="style">The type of buttons to use.</param>
        /// <param name="settings">Optional settings that override the global metro dialog settings.</param>
        /// <returns>A task promising the result of which button was pressed.</returns>
        public static MessageDialogResult ShowModalMessageExternal(this MetroWindow window, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, MetroDialogSettings settings = null)
        {
            var win = CreateModalExternalWindow(window);

            settings = settings ?? window.MetroDialogOptions;

            //create the dialog control
            var dialog = new MessageDialog(window, settings)
            {
                Message     = message,
                Title       = title,
                ButtonStyle = style
            };

            SetDialogFontSizes(settings, dialog);

            win.Content = dialog;

            MessageDialogResult result = MessageDialogResult.Affirmative;

            dialog.WaitForButtonPressAsync().ContinueWith(task =>
            {
                result = task.Result;
                win.Invoke(win.Close);
            });

            HandleOverlayOnShow(settings, window);
            win.ShowDialog();
            HandleOverlayOnHide(settings, window);
            return(result);
        }
Esempio n. 44
0
 private static Task HandleOverlayOnHide(MetroDialogSettings settings, MetroWindow window)
 {
     return(settings == null || settings.AnimateHide ? window.HideOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(new Action(window.HideOverlay))));
 }
Esempio n. 45
0
        /// <summary>
        /// Adds a Metro Dialog instance to the specified window and makes it visible.
        /// <para>Note that this method returns as soon as the dialog is loaded and won't wait on a call of <see cref="HideMetroDialogAsync"/>.</para>
        /// <para>You can still close the resulting dialog with <see cref="HideMetroDialogAsync"/>.</para>
        /// </summary>
        /// <param name="window">The owning window of the dialog.</param>
        /// <param name="dialog">The dialog instance itself.</param>
        /// <param name="settings">An optional pre-defined settings instance.</param>
        /// <returns>A task representing the operation.</returns>
        /// <exception cref="InvalidOperationException">The <paramref name="dialog"/> is already visible in the window.</exception>
        public static Task ShowMetroDialogAsync(this MetroWindow window, BaseMetroDialog dialog, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            if (window.metroDialogContainer.Children.Contains(dialog))
            {
                throw new InvalidOperationException("The provided dialog is already visible in the specified window.");
            }

            return(HandleOverlayOnShow(settings, window).ContinueWith(z =>
            {
                dialog.Dispatcher.Invoke(new Action(() =>
                {
                    SizeChangedEventHandler sizeHandler = SetupAndOpenDialog(window, dialog);
                    dialog.SizeChangedHandler = sizeHandler;
                }));
            }).ContinueWith(y =>
                            ((Task)dialog.Dispatcher.Invoke(new Func <Task>(() => dialog.WaitForLoadAsync().ContinueWith(x =>
            {
                dialog.OnShown();

                if (DialogOpened != null)
                {
                    DialogOpened(window, new DialogStateChangedEventArgs());
                }
            }))))));
        }
        public Task HideMetroDialogAsync(object context, BaseMetroDialog dialog, MetroDialogSettings settings = null)
        {
            var metroWindow = GetMetroWindow(context);

            return(metroWindow.HideMetroDialogAsync(dialog, settings));
        }
        public Task <ProgressDialogController> ShowProgressAsync(object context, string title, string message,
                                                                 bool isCancelable = false, MetroDialogSettings settings = null)
        {
            var metroWindow = GetMetroWindow(context);

            return(metroWindow.ShowProgressAsync(title, message, isCancelable, settings));
        }
Esempio n. 48
0
        /// <summary>
        /// Hides a visible Metro Dialog instance.
        /// </summary>
        /// <param name="window">The window with the dialog that is visible.</param>
        /// <param name="dialog">The dialog instance to hide.</param>
        /// <param name="settings">An optional pre-defined settings instance.</param>
        /// <returns>A task representing the operation.</returns>
        /// <exception cref="InvalidOperationException">
        /// The <paramref name="dialog"/> is not visible in the window.
        /// This happens if <see cref="ShowMetroDialogAsync"/> hasn't been called before.
        /// </exception>
        public static Task HideMetroDialogAsync(this MetroWindow window, BaseMetroDialog dialog, MetroDialogSettings settings = null)
        {
            window.Dispatcher.VerifyAccess();
            if (!window.metroActiveDialogContainer.Children.Contains(dialog) && !window.metroInactiveDialogContainer.Children.Contains(dialog))
            {
                throw new InvalidOperationException("The provided dialog is not visible in the specified window.");
            }

            window.SizeChanged -= dialog.SizeChangedHandler;

            dialog.OnClose();

            Task closingTask = (Task)window.Dispatcher.Invoke(new Func <Task>(dialog._WaitForCloseAsync));

            return(closingTask.ContinueWith(a =>
            {
                if (DialogClosed != null)
                {
                    window.Dispatcher.BeginInvoke(new Action(() => DialogClosed(window, new DialogStateChangedEventArgs())));
                }

                return (Task)window.Dispatcher.Invoke(new Func <Task>(() =>
                {
                    window.RemoveDialog(dialog);

                    return HandleOverlayOnHide(settings, window);
                }));
            }).Unwrap());
        }
Esempio n. 49
0
 private static Task HandleOverlayOnShow(MetroDialogSettings settings, MetroWindow window)
 {
     return(settings == null || settings.UseAnimations ? window.ShowOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(new Action(() => window.ShowOverlay()))));
 }
        public Task <string> ShowInputAsync(object context, string title, string message, MetroDialogSettings metroDialogSettings = null)
        {
            var metroWindow = GetMetroWindow(context);

            return(metroWindow.ShowInputAsync(title, message, metroDialogSettings));
        }
        public Task <MessageDialogResult> ShowMessageAsync(object context, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, MetroDialogSettings settings = null)
        {
            var metroWindow = GetMetroWindow(context);

            return(metroWindow.ShowMessageAsync(title, message, style, settings));
        }
Esempio n. 52
0
        /// <summary>
        /// Initializes a new MahApps.Metro.Controls.BaseMetroDialog.
        /// </summary>
        protected BaseMetroDialog()
        {
            DialogSettings = new MetroDialogSettings();

            Initialize();
        }
Esempio n. 53
0
 internal InputDialog(MetroWindow parentWindow, MetroDialogSettings settings)
     : base(parentWindow, settings)
 {
     this.InitializeComponent();
 }