当前位置: 首页>>代码示例>>C#>>正文


C# ExecutedRoutedEventArgs.ExtractDataContext方法代码示例

本文整理汇总了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);
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:4,代码来源:GameCommandBindings.cs

示例2: OnSaveSettingsExecuted

 private static void OnSaveSettingsExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     e.ExtractDataContext<ITransaction>(vm =>
     {
         vm.Commit();
         (sender as DependencyObject).CloseParentWindow(true);
     });
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:8,代码来源:GameCommandBindings.cs

示例3: OnRefreshExecuted

 private static void OnRefreshExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     e.ExtractDataContext<ClearMineViewModel>().Game.Restart();
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:4,代码来源:GameCommandBindings.cs

示例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();
            }
        }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:23,代码来源:GameCommandBindings.cs

示例5: OnOptionCloseExecuted

 private static void OnOptionCloseExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     e.ExtractDataContext<ITransaction>(vm =>
     {
         if (vm != null)
             vm.Rollback();
         (sender as DependencyObject).CloseParentWindow(false);
     });
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:9,代码来源:GameCommandBindings.cs

示例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());
     }
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:11,代码来源:GameCommandBindings.cs

示例7: OnNewGameExecuted

 private static void OnNewGameExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     e.ExtractDataContext<ClearMineViewModel>().StartNewGame();
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:4,代码来源:GameCommandBindings.cs


注:本文中的System.Windows.Input.ExecutedRoutedEventArgs.ExtractDataContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。