コード例 #1
0
ファイル: ViewModel.cs プロジェクト: rmkrmk/Prism
 public ViewModel()
 {
     _RegisterCommand = new DelegateCommand(ExecuteRegisterCommand, CanExecuteRegisterCommand);
     _RegisterCommand.ObservesProperty(() => this.FirstName);
     _RegisterCommand.ObservesProperty(() => this.LastName);
     new Task(MyThread).Start();
 }
コード例 #2
0
        private void InitCommands()
        {
            AnalyzeCommand = new DelegateCommand(async () =>
            {
                var result = await ((MetroWindow)Application.Current.MainWindow).ShowMessageAsync
                ("Analyze",
                 "The operation you are about to perform may take a few minutes and is uncancelable. " +
                 "Are you sure you want to continue?",
                 MessageDialogStyle.AffirmativeAndNegative);

                if (result == MessageDialogResult.Affirmative)
                    AnalyzeStocks();
            },
            () => !IsLoadingStockData && !_stocksAnalyzer.IsAnalyzing);
            // raise canExecute on IsLoadingStockData changes
            AnalyzeCommand.ObservesProperty(() => IsLoadingStockData);
        }