/// <summary> /// This is useful for initialize the view model commands. /// </summary> private void InitVmCommands() { ClickSearchWebAddressCommand = new Prism.Commands.DelegateCommand <object>(LaunchWebBrowser); ItemChangedCommand = new Prism.Commands.DelegateCommand <object>(OnChangedField); AssistCommand = new Prism.Commands.DelegateCommand <object>(OnAssistCommand); ContactsChangedCommand = new DelegateCommand <object>(OnContactsChangedCommand); }
/// <summary> /// Initialize view model. /// </summary> private void InitVmCommands() { ItemChangedCommand = new Prism.Commands.DelegateCommand <object>(OnChangedField); AssistCommand = new Prism.Commands.DelegateCommand <object>(OnAssistCommand); SelectCompanyOrDriver = new DelegateCommand <object>(OnCompanyOrDriver); CurrentOperationalState = DataPayLoad.Type.Show; ContentAreaCommand = new DelegateCommand <object>(OnContentAreaCommand); _helperData = new HelperBase(); }
public ExportInvestorListViewModel(IRegionManager regionManager) { this.regionManager = regionManager; TabTitle = "Export Investordaten"; EditInvestorCommand = new Prism.Commands.DelegateCommand(OnEditInvestor).ObservesCanExecute(() => CanEditInvestor); ReloadCommand = new Prism.Commands.DelegateCommand(OnReload); ExportCommand = new Prism.Commands.DelegateCommand(OnExport).ObservesCanExecute(() => CanExportData); BrowseCommand = new Prism.Commands.DelegateCommand(OnBrowse); // an instance of RadGridView is needed to perform export to Excel GridViewLoadedCommand = new Prism.Commands.DelegateCommand <object>(OnGridViewLoaded); NotificationRequest = new InteractionRequest <INotification>(); GetDirectory(); }
public MainWindowViewModel() { ExecuteDelegateCommand = new Prism.Commands.DelegateCommand(Execute, CanExecute); // 指定监视属性,当该属性发生变化时,自动调用RaiseCanExecuteChanged方法通知界面状态已改变 DelegateCommandObservesProperty = new Prism.Commands.DelegateCommand(Execute, CanExecute).ObservesProperty(() => IsEnabled); // 如果程序中的CanExcute委托的结果是简单的布尔值,可以省去CanExcute委托的声明。不仅能够通过UI状态改变,而且使用与真实的CanExcute委托相同的属性 DelegateCommandObservesCanExecute = new Prism.Commands.DelegateCommand(Execute).ObservesCanExecute(() => IsEnabled); // 为命令指定参数 ExecuteGenericDelegateCommand = new Prism.Commands.DelegateCommand <string>(ExecuteGeneric).ObservesCanExecute(() => IsEnabled); AsyncMethodCommandOne = new DelegateCommand(ExecuteCommandNameOne, CanExecute).ObservesProperty(() => IsEnabled); AsyncMethodCommandTwo = new DelegateCommand(async() => await ExecuteCommandName(), CanExecute).ObservesProperty(() => IsEnabled); }