本文整理汇总了C#中System.Windows.Input.ExecutedRoutedEventArgs.ExtractDataContext方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutedRoutedEventArgs.ExtractDataContext方法的具体用法?C# ExecutedRoutedEventArgs.ExtractDataContext怎么用?C# ExecutedRoutedEventArgs.ExtractDataContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Input.ExecutedRoutedEventArgs
的用法示例。
在下文中一共展示了ExecutedRoutedEventArgs.ExtractDataContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSaveAsExecuted
private static void OnSaveAsExecuted(object sender, ExecutedRoutedEventArgs e)
{
Infrastructure.Container.GetExportedValue<IGameSerializer>().SaveGame(e.ExtractDataContext<ClearMineViewModel>().Game);
}
示例2: OnSaveSettingsExecuted
private static void OnSaveSettingsExecuted(object sender, ExecutedRoutedEventArgs e)
{
e.ExtractDataContext<ITransaction>(vm =>
{
vm.Commit();
(sender as DependencyObject).CloseParentWindow(true);
});
}
示例3: OnRefreshExecuted
private static void OnRefreshExecuted(object sender, ExecutedRoutedEventArgs e)
{
e.ExtractDataContext<ClearMineViewModel>().Game.Restart();
}
示例4: OnOptionExecuted
private static void OnOptionExecuted(object sender, ExecutedRoutedEventArgs e)
{
var viewModel = e.ExtractDataContext<ClearMineViewModel>();
bool shouldResume = false;
if (viewModel.Game.GameState == GameState.Started)
{
shouldResume = true;
// Pause the game may takes long time. Needn't wait that finish;
Application.Current.Dispatcher.BeginInvoke(new Action(viewModel.Game.PauseGame), DispatcherPriority.Background);
}
var result = MessageManager.SendMessage<ShowDialogMessage>(e.OriginalSource, PopupDialog.Options, new OptionsViewModel());
if ((bool)result)
{
viewModel.StartNewGame();
}
else if (shouldResume)
{
viewModel.Game.ResumeGame();
}
}
示例5: OnOptionCloseExecuted
private static void OnOptionCloseExecuted(object sender, ExecutedRoutedEventArgs e)
{
e.ExtractDataContext<ITransaction>(vm =>
{
if (vm != null)
vm.Rollback();
(sender as DependencyObject).CloseParentWindow(false);
});
}
示例6: OnOpenExecuted
private static void OnOpenExecuted(object sender, ExecutedRoutedEventArgs e)
{
var openFileDialog = new OpenFileDialog();
openFileDialog.DefaultExt = Settings.Default.SavedGameExt;
openFileDialog.Filter = ResourceHelper.FindText("SavedGameFilter", Settings.Default.SavedGameExt);
if (openFileDialog.ShowDialog() == true)
{
Infrastructure.Container.GetExportedValue<IGameSerializer>().LoadGame(openFileDialog.FileName,
e.ExtractDataContext<ClearMineViewModel>().Game.GetType());
}
}
示例7: OnNewGameExecuted
private static void OnNewGameExecuted(object sender, ExecutedRoutedEventArgs e)
{
e.ExtractDataContext<ClearMineViewModel>().StartNewGame();
}