public MainMenuViewModel(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator) { if (container == null) { throw new ArgumentNullException("container"); } if (regionManager == null) { throw new ArgumentNullException("regionManager"); } if (eventAggregator == null) { throw new ArgumentNullException("eventAggregator"); } this.container = container; this.regionManager = regionManager; this.eventAggregator = eventAggregator; this.InfoBaseViewPopup = new InteractionRequest <Confirmation>(); this.SQLConnectionPopupRequest = new InteractionRequest <SQLConnectionDialogNotification>(); OpenMetadataCommand = new OpenMetadataCommand <object>(this.OnOpenMetadata, this.CanExecuteCommand); SaveMetadataCommand = new DelegateCommand(this.OnSaveMetadata); KillMetadataCommand = new DelegateCommand(this.OnKillMetadata); UpdateMetadataCommand = new UpdateMetadataCommand <object>(this.OnUpdateMetadata, this.CanExecuteCommand); ShowSettingsCommand = new ShowSettingsCommand <object>(this.OnShowSettings, this.CanExecuteCommand); AddMetadataCommand = new DelegateCommand(this.OnAddMetadata); CreateInfoBaseCommand = new DelegateCommand(this.CreateNewInfoBase); }
/// <summary> /// Called when the show settings command is called. /// </summary> private void OnShowSettings() { if (ShowSettingsCommand.CanExecute()) { string uriString = "/Views/EditListsView.xaml"; NavigateTo(uriString); } }
public void CanShowSettingsCommand() { var settingsWindow = MockRepository.GenerateMock <ISettingsWindow>(); var command = new ShowSettingsCommand(_view, settingsWindow); command.Execute(null); command.CanExecute(null).ShouldBe(true); settingsWindow.ShouldHaveBeenCalled(s => s.ShowDialog()); }
private void InitaliseCommands() { NavigateToHelp = ReactiveCommand.Create(); NavigateToHelp.Subscribe(NavigateToHelpCommandHandler); BuyNewGameCommand = ReactiveCommand.Create(); BuyNewGameCommand.Subscribe(BuyNewGameCommandHandler); ShowSettingsCommand = ReactiveCommand.Create(); ShowSettingsCommand.Subscribe(arg => { }); }
protected override void OnPropertyChanged(string name) { switch (name) { case nameof(IsBusy): case nameof(Content): ShowSettingsCommand.RaiseCanExecuteChanged(); OpenGameSettingsCommand.RaiseCanExecuteChanged(); CreateNewGameSettingsCommand.RaiseCanExecuteChanged(); break; } base.OnPropertyChanged(name); }
private static void ShowInvalidProcessingAreaLocationDialog() { DialogResult dialogResult = MessageBox.Show( SettingsGUI.UndefinedArkadeProcessingAreaLocationDialogMessage, SettingsGUI.UndefinedArkadeProcessingAreaLocationDialogTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation ); if (dialogResult == DialogResult.OK) { ShowSettingsCommand.Execute(); } else { System.Windows.Application.Current.Shutdown(); } }