public Task InitializeAsync(FileTagsOverviewViewModel context) { return(Task.Run( () => { CreateFileTag = new ViewModelCommand( "Create", new RelayCommand( async() => { await _navigationService.NavigateToFileTagEditAsync(Maybe.CreateNone <string>()); })); UpdateFileTag = new ViewModelCommand( "Update", new RelayCommand( async() => { await _navigationService.NavigateToFileTagEditAsync( Maybe.CreateSome(context.SelectedFileTag.Id)); }, () => context.SelectedFileTag != null)); DeleteFileTag = new ViewModelCommand( "Delete", new RelayCommand( async() => { await _fileTagService.DeleteAsync(context.SelectedFileTag.Id); context.FileTags.Remove(context.SelectedFileTag); context.SelectedFileTag = null; }, () => context.SelectedFileTag != null)); })); }
public ShooterViewModel() { ShowSelectGroupingCommand = new ViewModelCommand(x => MessengerInstance.Send(new AddGroupingToShooterDialogMessage(Shooter.ShooterId))); ShowSelectGroupingCommand.RaiseCanExecuteChanged(); ShowSelectParticipationCommand = new ViewModelCommand(x => MessengerInstance.Send(new AddParticipationToShooterDialogMessage(Shooter.ShooterId))); ShowSelectParticipationCommand.RaiseCanExecuteChanged(); DeleteGroupingCommand = new ViewModelCommand(x => MessengerInstance.Send(new RemoveGroupingFromShooterDialogMessage(Shooter.ShooterId, SelectedGrouping))); DeleteGroupingCommand.AddGuard(x => SelectedGrouping != null); DeleteGroupingCommand.RaiseCanExecuteChanged(); DeleteParticipationCommand = new ViewModelCommand(x => MessengerInstance.Send(new RemoveParticipationFromShooterDialogMessage(Shooter.ShooterId, SelectedParticipation))); DeleteParticipationCommand.AddGuard(x => SelectedParticipation != null); DeleteParticipationCommand.RaiseCanExecuteChanged(); ReassignSessionCommand = new ViewModelCommand( x => MessengerInstance.Send(new ShowReassignSessionDialogMessage(SelectedSession.SessionId))); ReassignSessionCommand.AddGuard(x => SelectedSession != null); ReassignSessionCommand.RaiseCanExecuteChanged(); ReassignProgramNumberCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowReassignShooterNumberDialogMessage(SelectedSession.SessionId))); ReassignProgramNumberCommand.AddGuard(x => SelectedSession != null); ReassignProgramNumberCommand.RaiseCanExecuteChanged(); }
public MainWindowViewModel() { Title = "Shooting Range"; ShowPersonsCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowPersonsPageMessage())); ShowPersonsCommand.RaiseCanExecuteChanged(); ShowGroupingsCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowGroupsPageMessage())); ShowGroupingsCommand.RaiseCanExecuteChanged(); ShowCreatePersonDialogCommand = new ViewModelCommand(x => MessengerInstance.Send(new CreatePersonDialogMessage())); ShowCreatePersonDialogCommand.RaiseCanExecuteChanged(); ShowCreateGroupingDialogCommand = new ViewModelCommand(x => MessengerInstance.Send(new CreateGroupingDialogMessage((IWindow)x))); ShowCreateGroupingDialogCommand.RaiseCanExecuteChanged(); ShowResultsCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowResultsPageMessage())); ShowResultsCommand.RaiseCanExecuteChanged(); RefreshCommand = new ViewModelCommand(x => MessengerInstance.Send(new RefreshDataFromRepositoriesMessage())); RefreshCommand.RaiseCanExecuteChanged(); ShowRankingsCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowRankingsPageMessage())); ShowRankingsCommand.RaiseCanExecuteChanged(); }
public PersonsPageViewModel() { ShowCreatePersonCommand = new ViewModelCommand(x => MessengerInstance.Send(new CreatePersonDialogMessage())); ShowCreatePersonCommand.RaiseCanExecuteChanged(); ShowEditPersonCommand = new ViewModelCommand(x => MessengerInstance.Send(new EditPersonDialogMessage(SelectedPerson))); ShowEditPersonCommand.AddGuard(x => SelectedPerson != null); ShowEditPersonCommand.RaiseCanExecuteChanged(); DeletePersonCommand = new ViewModelCommand(x => MessengerInstance.Send(new DeletePersonDialogMessage(SelectedPerson))); DeletePersonCommand.AddGuard(x => SelectedPerson != null); DeletePersonCommand.RaiseCanExecuteChanged(); CreateShooterCommand = new ViewModelCommand(x => CreateShooter(SelectedPerson)); CreateShooterCommand.AddGuard(x => SelectedPerson != null); CreateShooterCommand.RaiseCanExecuteChanged(); DeleteShooterCommand = new ViewModelCommand( x => MessengerInstance.Send(new DeleteShooterDialogMessage(SelectedShooter.Shooter.ShooterNumber))); DeleteShooterCommand.AddGuard(x => SelectedShooter != null); DeleteShooterCommand.RaiseCanExecuteChanged(); ShowSelectParticipationCommand = new ViewModelCommand(x => { }); ShowSelectParticipationCommand.RaiseCanExecuteChanged(); PrintBarcodeCommand = new ViewModelCommand(x => PrintBarcode()); PrintBarcodeCommand.AddGuard(x => SelectedShooter != null); PrintBarcodeCommand.RaiseCanExecuteChanged(); }
public TradingViewModel(ViewModelContext viewModelContext, AccountViewModel accountViewModel, SymbolsViewModel symbolsViewModel, TradeViewModel tradeViewModel, OrdersViewModel ordersViewModel, IWpfExchangeService exchangeService, IAccountsService accountsService, IChartHelper chartHelper) : base(viewModelContext) { AccountViewModel = accountViewModel; SymbolsViewModel = symbolsViewModel; TradeViewModel = tradeViewModel; OrdersViewModel = ordersViewModel; Symbols = new ObservableCollection <SymbolViewModel>(); symbolObservableSubscriptions = new Dictionary <string, IDisposable>(); this.exchangeService = exchangeService; this.accountsService = accountsService; this.chartHelper = chartHelper; ObserveSymbols(); ObserveAccount(); ObserveTrade(); ObserveOrders(); CloseCommand = new ViewModelCommand(Close); }
public AccountViewModel(IWpfExchangeService exchangeService) : base(exchangeService) { accountCancellationTokenSource = new CancellationTokenSource(); LoginCommand = new ViewModelCommand(Login); }
public virtual void _Name_Handler(ViewModelCommand command) { if (Ctx.Item is CommandsChildItem) { Ctx.CurrentMethod.Parameters[0].Type = new CodeTypeReference(Ctx.Item.Name + "Command"); } else { Ctx.CurrentMethod.Parameters[0].Type = new CodeTypeReference(Ctx.Item.Name); } if (Ctx.IsDesignerFile) { if (Ctx.Item is CommandsChildItem) { var c = Ctx.TypedItem; if (Ctx.ItemAs <CommandsChildItem>().OutputCommand != null) { Ctx._("this.{0}(command.Sender as {1}, command)", c.Name, c.Node.Name.AsViewModel()); } else if (string.IsNullOrEmpty(c.RelatedType)) { Ctx._("this.{0}(command.Sender as {1})", c.Name, c.Node.Name.AsViewModel()); } else { Ctx._("this.{0}(command.Sender as {1}, command.Argument)", c.Name, c.Node.Name.AsViewModel()); } if (Ctx.ItemAs <CommandsChildItem>().Publish) { Ctx._("this.Publish(command)"); } } } }
//非同期で実行する場合は先に画像の参照先だけを設定しておき、あとで画像の取得と public VideoListItem(string title, string bitmapImageURL) { Title = title; BitmapImageURL = bitmapImageURL; TileCommand = new ViewModelCommand(Clicked); }
public void ExecuteCommandOverload(ViewModelCommand command) { Ctx.CurrentMethod.Parameters[0].Type = (Ctx.Item.Name + "Command").ToCodeReference(); Ctx._("command.Sender = {0}", Ctx.Data.View.Element.Name); Ctx._("{0}.{1}.OnNext(command)", Ctx.Data.View.Element.Name, Ctx.Item.Name); //Ctx._("this.ExecuteCommand({0}.{1})", Ctx.Data.Element.Name, Ctx.Item.Name); }
public UserAccountViewModel(UserAccount userAccount, ILoggerFacade logger) : base(logger) { UserAccount = userAccount; OpenSymbolsWindowCommand = new ViewModelCommand(OpenSymbolsWindow); }
public allSmgsViewModel() { context = new ShFluContext(); AllSmgsNakl = new ObservableCollection <SmgsNakl>(context.SmgsNaklDbSet); EditCommand = new ViewModelCommand(Edit, true); DeleteCommand = new ViewModelCommand(Delete, true); }
public CreatePersonViewModel() { OkCommand = new ViewModelCommand(x => { ((IWindow)x).Close(); }); OkCommand.AddGuard(x => !(string.IsNullOrWhiteSpace(FirstName) || string.IsNullOrWhiteSpace(LastName))); }
public EditGroupingViewModel() { OkCommand = new ViewModelCommand(x => { ((IWindow)x).Close(); }); OkCommand.AddGuard(x => !string.IsNullOrWhiteSpace(GroupingName)); }
public BuildingViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, ProduceOrdersViewModel ProduceOrdersViewModel, HarvestOrdersViewModel HarvestOrderViewModels) : base(PIOClient, BotsClient, TranslationModule) { this.produceOrdersViewModel = ProduceOrdersViewModel; this.harvestOrderViewModels = HarvestOrderViewModels; CreateProduceOrderCommand = new ViewModelCommand(CreateProduceOrderCommandCanExecute, CreateProduceOrderCommandExecute); CreateHarvestOrderCommand = new ViewModelCommand(CreateHarvestOrderCommandCanExecute, CreateHarvestOrderCommandExecute); }
public ReassignProgramNumberViewModel() { OkCommand = new ViewModelCommand(x => { }); OkCommand.AddGuard(x => SelectedParticipation != null); OkCommand.RaiseCanExecuteChanged(); }
public ReassignSessionViewModel() { OkCommand = new ViewModelCommand(x => { }); OkCommand.AddGuard(x => SelectedShooter != null); OkCommand.RaiseCanExecuteChanged(); }
public WorkerViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule) { CreateBotCommand = new ViewModelCommand(CreateBotCommandCanExecute, CreateBotCommandExecute); DeleteBotCommand = new ViewModelCommand(DeleteBotCommandCanExecute, DeleteBotCommandExecute); ProduceCommand = new ViewModelCommand(ProduceCommandCanExecute, ProduceCommandExecute); HarvestCommand = new ViewModelCommand(HarvestCommandCanExecute, HarvestCommandExecute); }
public UserAccountsViewModel(ViewModelContext viewModelContext, IAccountsService accountsService) : base(viewModelContext) { this.accountsService = accountsService; AddAccountCommand = new ViewModelCommand(AddAccount); DeleteAccountCommand = new ViewModelCommand(DeleteAccount); }
/// <summary> /// Initializes a new instance of the <see cref="CasinoViewModel"/> class. /// </summary> public CasinoViewModel() { // Create the commands. goToCasinoCommand = new ViewModelCommand(DoGoToCasino, true); goToKlondikeSolitaireCommand = new ViewModelCommand(DoGoToKlondikeSolitaire, true); goToSpiderSolitaireCommand = new ViewModelCommand(DoGoToSpiderSolitaire, true); settingsCommand = new ViewModelCommand(DoSettingsCommand, true); }
public ExampleDocumentMessagesViewModel(ViewModelContext viewModelContext) : base(viewModelContext) { ShowMessageCommand = new ViewModelCommand(ShowMessage); ClearMessagesCommand = new ViewModelCommand(ClearMessages); ShowMessageBoxCommand = new ViewModelCommand(OpenMessageBox); ThrowExceptionCommand = new ViewModelCommand(ThrowException); }
public MainViewModelCore() { // Set up the background worker. backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); // Create the view model command. runTestsCommand = new ViewModelCommand(DoRunTests, true); }
public ViewModelCommand Get(Action execute, Func <bool> canExecute = null) { if (_Command == null) { _Command = new ViewModelCommand(execute, canExecute); } return(_Command); }
public TradePanelViewModel(IWpfExchangeService exchangeService, ILoggerFacade logger) : base(exchangeService, logger) { BuyCommand = new ViewModelCommand(Buy); SellCommand = new ViewModelCommand(Sell); BuyQuantityCommand = new ViewModelCommand(BuyQuantity); SellQuantityCommand = new ViewModelCommand(SellQuantity); Symbols = new ObservableCollection <Symbol>(); }
public FindMatrixViewModel(WagInSmgs wagInSmgs, ShFluContext context) { this.context = context; WagInSmgs = wagInSmgs; AddCommand = new ViewModelCommand(Add, true); SaveCommand = new ViewModelCommand(Save, true); MatrixWagonList = new List <MatrixWagon>(context.MatrixWagonDbSet.Where(p => p.WagonNumberMatrix == wagInSmgs.Wagon.Nwag)); }
public TradeViewModel(IWpfExchangeService exchangeService) : base(exchangeService) { BuyCommand = new ViewModelCommand(Buy); SellCommand = new ViewModelCommand(Sell); BuyQuantityCommand = new ViewModelCommand(BuyQuantity); SellQuantityCommand = new ViewModelCommand(SellQuantity); OnPropertyChanged(""); }
protected static ViewModelCommand CreateCommand(ref ViewModelCommand backingStore, Action execute, Func <bool> canExecute = null) { if (backingStore == null) { backingStore = new ViewModelCommand(execute, canExecute); } return(backingStore); }
public AccountViewModel(IWpfExchangeService exchangeService, ISymbolsCache symbolsCache, ILoggerFacade logger) : base(exchangeService, logger) { accountCancellationTokenSource = new CancellationTokenSource(); LoginCommand = new ViewModelCommand(Login); this.symbolsCache = symbolsCache; }
protected void CommandInit() { System.Diagnostics.Debug.WriteLine("Initialize"); SetBarcodeList(); SetConfigList(); this.TemplateExcelCommand = new ViewModelCommand(TemplateExcel); this.BarcodeCommitCommand = new ViewModelCommand(BarcodeCommit); }
public ExampleDocumentNavigationViewModel(ViewModelContext viewModelContext) : base(viewModelContext) { OpenDocumentCommand = new ViewModelCommand(OpenDocument); GetDocumentsCommand = new ViewModelCommand(GetDocuments); OpenWindowCommand = new ViewModelCommand(OpenWindow); OpenDocuments = new ObservableCollection <ViewModelBase>(); }
public MatrixLoadViewModel() { Matrix = new Matrixx(); LoadMatrixCommand = new ViewModelCommand(LoadMatrix, true); EditCommand = new ViewModelCommand(edit, true); ViewAllCommand = new ViewModelCommand(ViewAll, true); SaveContextCommand = new ViewModelCommand(SaveContext, true); OpenFromDbCommand = new ViewModelCommand(OpenFromDb, true); }
/// <summary> /// Initializes a new instance of the <see cref="CardGameViewModel"/> class. /// </summary> public CardGameViewModel() { // Set up the timer. timer.Interval = TimeSpan.FromMilliseconds(500); timer.Tick += new EventHandler(timer_Tick); // Create the commands. leftClickCardCommand = new ViewModelCommand(DoLeftClickCard, true); rightClickCardCommand = new ViewModelCommand(DoRightClickCard, true); dealNewGameCommand = new ViewModelCommand(DoDealNewGame, true); goToCasinoCommand = new ViewModelCommand(DoGoToCasino, true); }
public CreateGroupingViewModel(ServiceDeskConfiguration serviceDeskConfiguration) { Participations = new ObservableCollection<ParticipationDescription>( serviceDeskConfiguration.ParticipationDescriptions.GetAll() .Where(x => x.AllowShooterCollectionParticipation)); OkCommand = new ViewModelCommand(x => { ((IWindow)x).Close(); }); OkCommand.AddGuard(x => !string.IsNullOrWhiteSpace(GroupingName) && SelectedParticipation != null); }
public SpiderSolitaireViewModel() { // Create the quick access arrays. tableaus.Add(tableau1); tableaus.Add(tableau2); tableaus.Add(tableau3); tableaus.Add(tableau4); tableaus.Add(tableau5); tableaus.Add(tableau6); tableaus.Add(tableau7); tableaus.Add(tableau8); tableaus.Add(tableau9); tableaus.Add(tableau10); dealCardsCommand = new ViewModelCommand(DoDealCards, true); // If we're in the designer deal a game. if (Apex.Design.DesignTime.IsDesignTime) DoDealNewGame(null); }
public GroupingPageGroupingViewModel() { NewGroupingCommand = new ViewModelCommand(x => ShowCreateGrouping((IWindow)x)); NewGroupingCommand.RaiseCanExecuteChanged(); EditGroupingCommand = new ViewModelCommand(x => MessengerInstance.Send(new EditGroupingDialogMessage(SelectedShooterCollection.ShooterCollectionId, SelectedShooterCollection.CollectionName))); EditGroupingCommand.AddGuard(x => SelectedShooterCollection != null); EditGroupingCommand.RaiseCanExecuteChanged(); DeleteGroupingCommand = new ViewModelCommand(x => MessengerInstance.Send(new DeleteGroupingDialogMessage(SelectedShooterCollection))); DeleteGroupingCommand.AddGuard(x => SelectedShooterCollection != null); DeleteGroupingCommand.RaiseCanExecuteChanged(); RemoveShooterFromGroupingCommand = new ViewModelCommand(x => RemoveShooterFromGrouping()); RemoveShooterFromGroupingCommand.AddGuard(x => SelectedShooterCollection != null && SelectedShooter != null); RemoveShooterFromGroupingCommand.RaiseCanExecuteChanged(); AddShooterToGroupingCommand = new ViewModelCommand(x => MessengerInstance.Send(new AddShooterToGroupingDialogMessage(ProgramNumber, SelectedShooterCollection.ShooterCollectionId))); AddShooterToGroupingCommand.AddGuard(x => SelectedShooterCollection != null); AddShooterToGroupingCommand.RaiseCanExecuteChanged(); }
public ResultsPageViewModel() { if (MessengerInstance != null) { MessengerInstance.Register<RefreshDataFromRepositoriesMessage>(this, x => { PersonShooterViewModel bkp = SelectedPerson; LoadPersons(); SelectedPerson = bkp; SelectedPersonChanged(); }); ReassignSessionCommand = new ViewModelCommand( x => MessengerInstance.Send(new ShowReassignSessionDialogMessage(SelectedSession.SessionId))); ReassignSessionCommand.AddGuard(x => SelectedSession != null); ReassignSessionCommand.RaiseCanExecuteChanged(); ReassignProgramNumberCommand = new ViewModelCommand(x => MessengerInstance.Send(new ShowReassignShooterNumberDialogMessage(SelectedSession.SessionId))); ReassignProgramNumberCommand.AddGuard(x => SelectedSession != null); ReassignProgramNumberCommand.RaiseCanExecuteChanged(); } }
/// <summary> /// Initializes a new instance of the <see cref="GameStatistics"/> class. /// </summary> public GameStatistics() { // Create the reset command. resetCommand = new ViewModelCommand(DoReset, true); }
/// <summary> /// Initializes a new instance of the <see cref="KlondikeSolitaireViewModel"/> class. /// </summary> public KlondikeSolitaireViewModel() { // Create the quick access arrays. foundations.Add(foundation1); foundations.Add(foundation2); foundations.Add(foundation3); foundations.Add(foundation4); tableaus.Add(tableau1); tableaus.Add(tableau2); tableaus.Add(tableau3); tableaus.Add(tableau4); tableaus.Add(tableau5); tableaus.Add(tableau6); tableaus.Add(tableau7); // Create the turn stock command. turnStockCommand = new ViewModelCommand(DoTurnStock, true); // If we're in the designer deal a game. if (Apex.Design.DesignTime.IsDesignTime) DoDealNewGame(null); }
public SelectParticipationViewModel() { OkCommand = new ViewModelCommand(x => { }); OkCommand.AddGuard(x => SelectedParticipationDescription != null); }
public SelectGroupingViewModel() { OkCommand = new ViewModelCommand(x => { }); OkCommand.AddGuard(x => SelectedGrouping != null); }
public SelectShooterViewModel() { OkCommand = new ViewModelCommand(x => { }); OkCommand.AddGuard(x => SelectedShooter != null); }
public RankViewModel() { GenerateRankingCommand = new ViewModelCommand(x => GenerateRanking(SelectedParticipation.ProgramNumber)); GenerateRankingCommand.AddGuard(x => SelectedParticipation != null); GenerateRankingCommand.RaiseCanExecuteChanged(); }