本文整理汇总了C#中MahApps.Metro.Controls.Dialogs.MetroDialogSettings类的典型用法代码示例。如果您正苦于以下问题:C# MetroDialogSettings类的具体用法?C# MetroDialogSettings怎么用?C# MetroDialogSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetroDialogSettings类属于MahApps.Metro.Controls.Dialogs命名空间,在下文中一共展示了MetroDialogSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BtnDeleteDeck_Click
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();
}
开发者ID:rudzu,项目名称:Hearthstone-Deck-Tracker,代码行数:25,代码来源:MainWindow_Edit.cs
示例2: ShowProgressDialog
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);
}
开发者ID:mainsalmon,项目名称:WPHFramework1,代码行数:7,代码来源:Screen8ViewModel.cs
示例3: CleanWindowClosing
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();
}
开发者ID:MahApps,项目名称:MahApps.Metro,代码行数:25,代码来源:CleanWindowDemo.xaml.cs
示例4: CloseWin
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();
}
}
开发者ID:hutchlabs,项目名称:PetraERP,代码行数:28,代码来源:TicketsAddView.xaml.cs
示例5: ExportDeck
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);
}
}
开发者ID:GatherHere,项目名称:Hearthstone-Deck-Tracker,代码行数:34,代码来源:MainWindow_Export.cs
示例6: ShowInputAsync
/// <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();
}
开发者ID:NExPlain,项目名称:MahApps.Metro,代码行数:67,代码来源:DialogManager.cs
示例7: ImportDeckFromWeb
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;
}
开发者ID:JulioCL,项目名称:Hearthstone-Deck-Tracker,代码行数:26,代码来源:MainWindow_Import.cs
示例8: BtnIdString_Click
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);
}
开发者ID:JulioCL,项目名称:Hearthstone-Deck-Tracker,代码行数:31,代码来源:MainWindow_Import.cs
示例9: ShowSavedAndUploadedFileMessage
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");
}
}
}
开发者ID:nikolasferreira,项目名称:Hearthstone-Deck-Tracker,代码行数:31,代码来源:MessageDialogs.cs
示例10: PlayerViewModel
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);
}
}
}
开发者ID:tofi92,项目名称:MetroPlayer,代码行数:29,代码来源:PlayerViewModel.cs
示例11: ShowInputDialog
public override Task<string> ShowInputDialog(string title, string message, MetroDialogSettings settings = null)
{
if (GetActiveWindow() == null)
return null;
return GetActiveWindow().ShowInputAsync(title, message, settings);
}
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:7,代码来源:MetroDialogService.cs
示例12: HideMetroDialogAsync
/// <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();
}
开发者ID:darknesstiller,项目名称:MetodoDeGauss,代码行数:36,代码来源:DialogManager.cs
示例13: BtnIdString_Click
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();
}
开发者ID:kkcosmo,项目名称:Hearthstone-Deck-Tracker,代码行数:33,代码来源:DeckImport.xaml.cs
示例14: CloseHandleAsync
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();
}
}
开发者ID:nikitadev,项目名称:DomainSetBidsApplication,代码行数:25,代码来源:MainWindowView.xaml.cs
示例15: ShowMessage
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);
}
}
}
}
开发者ID:Pham0uz,项目名称:UFO,代码行数:29,代码来源:EditPerformanceView.xaml.cs
示例16: CameraPositioningCalibrationView
public CameraPositioningCalibrationView(MetroWindow parentWindow, MetroDialogSettings settings)
: base(parentWindow, settings)
{
InitializeComponent();
DataContextChanged += CameraPositioningCalibrationView_DataContextChanged;
CloseButton.Command = CloseCommand;
}
开发者ID:cosmo1911,项目名称:UniMoveStation,代码行数:7,代码来源:CameraPositioningCalibrationView.xaml.cs
示例17: ShowHsNotInstalledMessage
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.");
}
}
}
开发者ID:christopher7694,项目名称:Hearthstone-Deck-Tracker,代码行数:26,代码来源:MessageDialogs.cs
示例18: ShowMessage
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);
}
}
}
}
开发者ID:Pham0uz,项目名称:UFO,代码行数:30,代码来源:EditVenueView.xaml.cs
示例19: MessageDialog
internal MessageDialog(MetroWindow parentWindow, MetroDialogSettings settings)
: base(parentWindow, settings)
{
InitializeComponent();
PART_MessageScrollViewer.Height = DialogSettings.MaximumBodyHeight;
}
开发者ID:Acaspita,项目名称:MahApps.Metro,代码行数:7,代码来源:MessageDialog.cs
示例20: SelectFolderPath
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;
}
开发者ID:Yazurka,项目名称:XMLGenerator,代码行数:35,代码来源:PathValidator.cs
注:本文中的MahApps.Metro.Controls.Dialogs.MetroDialogSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论