public LoginViewModel() { UserName = string.Empty; Auth = new RelayCommandAsync(AuthHelper); Exit = new RelayCommand(() => window.Close()); if (DateTime.Now.Hour < 11 && DateTime.Now.Hour > 6) { StatusMessage = "Good Morning"; } else if (DateTime.Now.Hour < 18 && DateTime.Now.Hour > 11) { StatusMessage = "Good Evening"; } else { StatusMessage = "Good Night"; } string LastUser = ConfigurationManager.AppSettings["Last User"]; if (!string.IsNullOrEmpty(LastUser)) { StatusMessage += "\nMr. " + LastUser; } }
public BasketViewModel(IBasketControllerClient basketControllerClient, ProductsViewModel products) { _basketControllerClient = basketControllerClient; _products = products; _updateProductQuantityCommand = new RelayCommandAsync<int>(async x => await _updateProductQuantity(x)); _proceedToCheckoutCommand = new RelayCommandAsync<object>(async x => await _proceedToCheckout()); }
public RelayCommandAsync CreateRelayCommandAsync(Func <Task> execute, Expression <Func <bool> > canExecute, params string[] additionalProperties) { var command = new RelayCommandAsync(execute, canExecute.Compile()); RegisterCommandsByPropertyNames(command, canExecute.Body, additionalProperties); return(command); }
public FlagTasksViewModel() { Issue = new Issue(); Close = new RelayCommand(() => Self.Close()); FlagTask = new RelayCommandAsync(flagTask); FlagMode = true; }
public TrainingFlowWindowVm(ISeatQueries seatQueries, Guid sessionId, IDocumentCreator documentCreator, ISessionQueries sessionQueries, IApplicationService applicationService, IComputerService computerService) { _seatQueries = seatQueries ?? throw new ArgumentNullException(nameof(seatQueries)); _sessionId = sessionId; _documentCreator = documentCreator ?? throw new ArgumentNullException(nameof(documentCreator)); _sessionQueries = sessionQueries ?? throw new ArgumentNullException(nameof(sessionQueries)); _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _computerService = computerService ?? throw new ArgumentNullException(nameof(computerService)); RefreshCommand = new RelayCommandAsync(ExecuteRefreshAsync); SelectedSeats = new ObservableCollection <ISeatValidatedResult>(); SelectedSeats.CollectionChanged += (sender, args) => { PrintCertificatOfAttendanceCommand.RaiseCanExecuteChanged(); PrintSurveyCommand.RaiseCanExecuteChanged(); PrintDegreeCommand.RaiseCanExecuteChanged(); MissingCommand.RaiseCanExecuteChanged(); }; PrintTimesheetCommand = new RelayCommand(ExecutePrintFeuillePresence); PrintCertificatOfAttendanceCommand = new RelayCommand(ExecutePrintCertificatAssiduite, () => SelectedSeats.Any()); PrintSurveyCommand = new RelayCommand(ExecutePrintQuestionnaire, () => SelectedSeats.Any()); PrintDegreeCommand = new RelayCommand(ExecutePrintDiplome, () => SelectedSeats.Any()); MissingCommand = new RelayCommandAsync(ExecuteAbsenceAsync, () => SelectedSeats.Any()); PrintAllDocumentCommand = new RelayCommandAsync(ExecutePrintAllDocumentAsync); }
public void Context() { _relayCommand = new RelayCommandAsync<object>(async obj => await ExecuteAsync(obj)); _executeParameter = new object(); _relayCommand.Execute(_executeParameter); }
public HistoryWindowVm(IEventQueries eventQueries, IEventSerializer eventSerializer) { _eventQueries = eventQueries ?? throw new ArgumentNullException(nameof(eventQueries)); _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer)); LoadCommand = new RelayCommandAsync(ExecuteLoadAsync); }
public SeatsWindowVm(Guid sessionId, int sessionPlaces, ISeatQueries seatQueries, ICompanyQueries companyQueries, IStudentQueries studentQueries, IApplicationService applicationService, ISessionQueries sessionQueries) { _sessionId = sessionId; _sessionPlaces = sessionPlaces; _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _sessionQueries = sessionQueries ?? throw new ArgumentNullException(nameof(sessionQueries)); _companyQueries = companyQueries ?? throw new ArgumentNullException(nameof(companyQueries)); _studentQueries = studentQueries ?? throw new ArgumentNullException(nameof(studentQueries)); _seatQueries = seatQueries ?? throw new ArgumentNullException(nameof(seatQueries)); AddSeatCommand = new RelayCommandAsync(() => ExecuteAddSeatAsync(false), () => SelectedCompany != null); AddValidatedSeatCommand = new RelayCommandAsync(() => ExecuteAddSeatAsync(true), () => SelectedCompany != null && SelectedStudent != null); CreateStudentCommand = new RelayCommandAsync(ExecuteCreateStudentAsync); CreateCompanyCommand = new RelayCommandAsync(ExecuteCreateSocieteAsync); SelectedSeats = new ObservableCollection <SeatItem>(); SelectedSeats.CollectionChanged += (sender, args) => { CancelSeatCommand.RaiseCanExecuteChanged(); ValidateSeatCommand.RaiseCanExecuteChanged(); RefuseSeatCommand.RaiseCanExecuteChanged(); }; CancelSeatCommand = new RelayCommandAsync(ExecuteCancelSeatAsync, () => SelectedSeats.Any()); ValidateSeatCommand = new RelayCommandAsync(ExecuteValidateSeatAsync, () => SelectedSeats.Any()); RefuseSeatCommand = new RelayCommandAsync(ExecuteRefuseSeatAsync, () => SelectedSeats.Any()); RefreshSeatsCommand = new RelayCommandAsync(ExecuteRefreshSeatsAsync); DefineStudentCommand = new RelayCommand(() => { DefineStudent = !DefineStudent; SelectedStudent = null; }); EditStudentCommand = new RelayCommandAsync(ExecuteEditStudentAsync); GenerateAgreementCommand = new RelayCommandAsync(ExecuteGenerateAgreementAsync); OpenAgreementCommand = new RelayCommandAsync(ExecuteOpenAgreementAsync); Security = new Security(applicationService); }
public MainWindowsVm(IApplicationService applicationService, INotificationQueries notificationQueries) { _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _notificationQueries = notificationQueries; OpenTrainingList = new RelayCommandAsync(async() => await OpenDocument <TrainingListVm>()); OpenScheduler = new RelayCommandAsync(async() => await OpenDocument <SessionSchedulerVm>()); OpenTrainerList = new RelayCommandAsync(async() => await OpenDocument <TrainerListVm>()); OpenLocationList = new RelayCommandAsync(async() => await OpenDocument <LocationListVm>()); OpenStudentList = new RelayCommandAsync(async() => await OpenDocument <StudentListVm>()); OpenCompanyList = new RelayCommandAsync(async() => await OpenDocument <CompanyListVm>()); OpenContactList = new RelayCommandAsync(async() => await OpenDocument <ContactListVm>()); OpenUserList = new RelayCommandAsync(async() => await OpenDocument <UserListVm>()); OpenEventReplayer = new RelayCommandAsync(async() => await _applicationService.OpenPopup <EventReplayerWindowVm>()); OpenLoginWindow = new RelayCommandAsync(ExecuteOpenLoginAsync); RefreshNotifications = new RelayCommandAsync(ExecuteRefreshNotificationsAsync); OpenNotificationCommand = new RelayCommandAsync(ExecuteOpenNotificationAsync); OpenHistory = new RelayCommandAsync(async() => await OpenDocument <HistoryWindowVm>()); OpenSeatList = new RelayCommandAsync(async() => await OpenDocument <SeatsListerVm>()); OpenSessionList = new RelayCommandAsync(async() => await OpenDocument <SessionListerVm>()); DeleteSelectedNotification = new RelayCommandAsync(ExecuteDeleteSelectedNotificationAsync, () => SelectedNotification != null); Title = "Gestion formation - non connecté"; Security = new Security(applicationService); }
public WorkersViewModel() { Sexes.Add(new { T = "Male", V = "M" }); Sexes.Add(new { T = "Female", V = "F" }); NewUser = new RelayCommand(newUser); Users = new ObservableCollection <User>(); Teams = new ObservableCollection <Team>(); AddUser = new RelayCommandAsync(addUser); UpdateUser = new RelayCommandAsync(updateUser); DisableUserAccount = new RelayCommandAsync(disableUserAccount); EnableUserAccount = new RelayCommandAsync(enableUserAccount); GetUsers = new RelayCommandAsync(getUsers); GetTeams = new RelayCommandAsync(getTeams); GetRoles = new RelayCommandAsync(getRoles); GetUsers.Execute(null); GetTeams.Execute(null); GetRoles.Execute(null); OnPropertyChanged(nameof(Manager)); }
public UsersViewModel() { _dlgCoord = DialogCoordinator.Instance; _dlgSet = DialogSettings.Instance; LoadedCmd = new RelayCommandAsync(LoadUsersAsync); OpenUserCmd = new RelayCommandAsync(OpenUser); }
public AdrControlViewModel(IRulesAnalyser rulesAnalyser, ISolutionAnalyser solutionAnalyser) { _rulesAnalyser = rulesAnalyser; _solutionAnalyser = solutionAnalyser; ScanCommand = new RelayCommandAsync <object>(Scan); OpenFileCommand = new RelayCommandAsync <string>(OpenFile); }
//-------------------------------------------------------------------------------// public MainViewModel() { FindCommand = new RelayCommandAsync(FindPricesAsync, CanUseFindPrices); UpdateCommand = new RelayCommandAsync(UpdateAsync, CanUseUpdate); PlaceOrderCommand = new RelayCommandAsync(PlaceOrderAsync, CanUsePlaceOrder); ClearCommand = new RelayCommand(Clear, CanUseClear); Order = new OrderViewModel(); }//ctor
protected EditableListVm(IApplicationService applicationService) { ApplicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); LoadCommand = new RelayCommandAsync(ExecuteLoadCommandAsync); DeleteCommand = new RelayCommandAsync(ExecuteDeleteCommandAsync, () => SelectedItem != null); UpdateCommand = new RelayCommandAsync(ExecuteUpdateCommandAsync); CreateCommand = new RelayCommandAsync(ExecuteCreateCommandAsync); }
public LoginRedirectButton() { BindingContext = this; OnLogin = new RelayCommandAsync <object>(LoginRedirect); InitializeComponent(); }
public DemoViewModel() { InnerViewModel = new InnerViewModel(); LoadWithMessage = new RelayCommandAsync(LoadWithMessageExecute); LoadWithCancellation = new RelayCommandAsync(LoadWithCancellationExecute); LoadWithNestedScopes = new RelayCommandAsync(LoadWithNestedScopesExecute); LoadWithCustomBusyBox = new RelayCommandAsync(LoadWithCustomBusyBoxExecute); }
public IssueTreatingViewModel() { MarkAsSolved = new RelayCommandAsync(markAsSolved); GetIssueInfo = new RelayCommandAsync(getIssueInfo); GetIssues = new RelayCommandAsync(getIssues); GetIssues.Execute(null); GetIssueInfo.Execute(null); }
public MembersViewModel() { Users = new ObservableCollection <User>(); TasksDoneByUser = new ObservableCollection <Task>(); IssuesByUser = new ObservableCollection <Issue>(); GetUsers = new RelayCommandAsync(getUsers); GetUsers.Execute(null); }
public override async Task Initialize() { _mediator.Subscribe(ChangeDisplayContentOperationKey, ChangeDisaplyContent); TranslateSource.Instance.PropertyChanged += CultureChanged; CurrentContent = await _windowHelper.GetViewModel <VenueManagementViewModel>(); VenueManagementCommand = new RelayCommandAsync(OnVenueManagement); UserManagementCommand = new RelayCommandAsync(OnUserManagement); ProfileCommand = new RelayCommandAsync(OnProfile); }
public RecordImagesViewModel( IRecordImagesService recordImagesService ) { _recordImagesService = recordImagesService; _recordImagesService.OnImageRecorded += _recordImagesServiceOnOnImageRecorded; _gotoSettingsCommand = new RelayCommandAsync <string>(async x => _gotoSettings()); _saveImagesCommand = new RelayCommandAsync <string>(async x => _saveImages()); }
public MainViewModel(SettingsViewModel settingsViewModel, IFileService fileService) { this.settingsViewModel = settingsViewModel; this.fileService = fileService; ShowSettingsCommand = new RelayCommandAsync(() => ShowContentForAsync <SettingsViewModel>(), () => !IsBusy); OpenGameSettingsCommand = new RelayCommandAsync(OpenGameSettingsAsync, () => !IsBusy && Content is HomeViewModel); CreateNewGameSettingsCommand = new RelayCommand(CreateNewGameSettings, () => !IsBusy); ExitCommand = new RelayCommand(Exit); var ignore = ShowContentForAsync <HomeViewModel>(); }
public EditStudentWindowVm(ObservableCollection <Item> students, Guid currentStudentId, IApplicationService applicationService, IStudentQueries studentQueries) { _previousSelectedStudent = currentStudentId; _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _studentQueries = studentQueries ?? throw new ArgumentNullException(nameof(studentQueries)); SetValiderCommandCanExecute(() => SelectedStudent?.Id != _previousSelectedStudent); CreateStudentCommand = new RelayCommandAsync(ExecuteCreateStudentAsync); Students = students; }
public MenuViewModel(IDbManager dbManager, IViewMainViewModel mainViewModel) { this.dbManager = dbManager; this.mainViewModel = (MainViewModel)mainViewModel; CategoriesCommand = new RelayCommand(this.mainViewModel.OpenCategories); IngredientsCommand = new RelayCommand(this.mainViewModel.OpenIngredients); RecipesCommand = new RelayCommandAsync(this.mainViewModel.OpenRecipes); IngredientQuantitiesCommand = new RelayCommand(this.mainViewModel.OpenIngredientQuantities); }
public void can_execute(bool canExecute) { var relayCommand = new RelayCommandAsync<int>(async obj => await ExecuteAsync(obj), obj => { CheckExecuteParameter(obj); return canExecute; }); _executeParameter = null; relayCommand.CanExecute(_executeParameter).ShouldBe(canExecute); }
public ProductDetailsViewModel( IProductControllerClient productControllerClient, IBasketControllerClient basketControllerClient, ProductsViewModel productsViewModel ) { _productControllerClient = productControllerClient; _basketControllerClient = basketControllerClient; _productsViewModel = productsViewModel; _addToBasketCommand = new RelayCommandAsync<int>(async x => await _addProductToBasket(x)); }
public RegistersViewModel(ILogger <RegistersViewModel> logger, IViceBridge viceBridge, RegistersMapping mapping, IDispatcher dispatcher) { this.logger = logger; this.viceBridge = viceBridge; this.mapping = mapping; this.dispatcher = dispatcher; uiFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext()); commandsManager = new CommandsManager(this, new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext())); viceBridge.ViceResponse += ViceBridge_ViceResponse; UpdateCommand = commandsManager.CreateRelayCommandAsync(Update, () => !IsLoadingMappings && IsLoadingRegisters); }
public override async Task Initialize() { await LoadUserList(); _mediator.Subscribe(UserSavedOperationKey, UserSaved); EditUserCommand = new RelayCommandAsync(OnEditUser); CreateUserCommand = new RelayCommandAsync(OnCreateUser); DeleteUserCommand = new RelayCommandAsync(OnDeleteUser); FindCommand = new RelayCommandAsync(OnFind); ResetCommand = new RelayCommandAsync(OnReset); }
public void InitCommands() { SortCommand = new RelayCommand(o => SortHeader(o.ToString()), o => true); CopyClipboardCommand = new RelayCommand(o => CopyToClipboard(o), o => true); UpdateAccs = new RelayCommandAsync(o => UpdateAccounts(), o => true); AccDialogCommand = new RelayCommand(o => OpenDialog(o), o => true); AddNewAccountCommand = new RelayCommand(o => UpsertAccount(), o => true); DeleteAccountCommand = new RelayCommand(o => DeleteAccount(), o => true); AccountAction.NewFileIsUpdated += UpdateInfos; }
public override async Task Initialize() { AddVenueCommand = new RelayCommandAsync(OnAddVenue); EditVenueCommand = new RelayCommandAsync(OnEditVenue); DeleteVenueCommand = new RelayCommandAsync(OnDeleteVenue); _mediator.Subscribe(VenueSavedOperationKey, VenueSaved); var venues = await _venueService.ToListAsync(); VenueList = new ObservableCollection <Models.Venue>(venues.Select(x => VenueParser.ToVenue(x)).ToList()); }
public TeamsViewModel() { Teams = new ObservableCollection <Team>(); GetTeams = new RelayCommandAsync(getTeams); AddTeam = new RelayCommandAsync(addTeams); UpdateTeam = new RelayCommandAsync(updateTeams); DisassembleTeam = new RelayCommandAsync(disassembleTeam); NewTeam = new RelayCommand(newTeam); GetTeams.Execute(null); }
private PersonsViewModel() { _dlgCoord = DialogCoordinator.Instance; _dispatcher = Application.Current.Dispatcher; _dlgSet = DialogSettings.Instance; LoadedCmd = new RelayCommandAsync(LoadedAsync); RefreshCmd = new RelayCommandAsync(RefreshAsync); NewPersonCmd = new RelayCommandAsync(NewPersonAsync); EditPersonCmd = new RelayCommandAsync(EditPersonAsync); OpenPersonCmd = new RelayCommandAsync(OpenPersonAsync); }
public CreateSessionWindowVm(IApplicationService applicationService, ITrainingQueries trainingQueries, ITrainerQueries trainerQueries, ILocationQueries locationQueries, AppointmentItem appointmentItem) { _appointmentItem = appointmentItem ?? throw new ArgumentNullException(nameof(appointmentItem)); _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _locationQueries = locationQueries ?? throw new ArgumentNullException(nameof(locationQueries)); _trainerQueries = trainerQueries ?? throw new ArgumentNullException(nameof(trainerQueries)); _trainingQueries = trainingQueries ?? throw new ArgumentNullException(nameof(trainingQueries)); AddTrainingCommand = new RelayCommandAsync(ExecuteAddTrainingAsync); AddLocationCommand = new RelayCommandAsync(ExecuteAddLocationAsync); AddTrainerCommand = new RelayCommandAsync(ExecuteAddTrainerAsync); }
public CreateAgreementWindowVm(SessionInfos sessionInfos, IApplicationService applicationService, IContactQueries contactQueries, List <SeatItem> selectedPlaces, IComputerService computerService) { _sessionInfos = sessionInfos ?? throw new ArgumentNullException(nameof(sessionInfos)); _applicationService = applicationService ?? throw new ArgumentNullException(nameof(applicationService)); _contactQueries = contactQueries ?? throw new ArgumentNullException(nameof(contactQueries)); _selectedPlaces = selectedPlaces ?? throw new ArgumentNullException(nameof(selectedPlaces)); _computerService = computerService ?? throw new ArgumentNullException(nameof(computerService)); AddContactCommand = new RelayCommandAsync(ExecuteAddContactAsync); UnknowTypeAgreementCommand = new RelayCommand(ExecuteUnknowTypeConvention); SetValiderCommandCanExecute(() => SelectedContact != null && AgreementType != AgreementType.Unknow); }
public NetDiskType() { OpenCommand = new RelayCommandAsync(async() => { DialogHost.CloseDialogCommand.Invoke(); await TimeSpan.FromMilliseconds(500); if (OnClick != null) { await OnClick(); } }); }
public CwavWindow(CwavBlock block) { InitializeComponent(); ViewModel = block; _sfxPlayer = new WaveOut(); PlaySfxCommand = new RelayCommand<CwavKind>(PlayAudio_Execute, CanExecute_HasAudio); ImportCommand = new RelayCommandAsync<CwavKind, ImportResults>(Import_Execute, null, null, Import_PostExecute); ExportSfxCommand = new RelayCommandAsync<CwavKind, ExportResults>(Export_Execute, CanExecute_HasAudio, null, Export_PostExecute); RemoveSfxCommand = new RelayCommand<CwavKind>(Remove_Execute, CanExecute_HasAudio); ReplaceSfxCommand = new RelayCommand<object>(Replace_Execute); }
partial void SetupThemeCommands() { var loadCommand = new RelayCommandAsync<string, LoadThemeResults>(LoadTheme_Execute, null, str => PreExecute_SetBusy(), LoadTheme_PostExecute); var saveAsCommand = new RelayCommandAsync<string, SaveThemeResults>(SaveTheme_Execute, str => CanExecute_ViewModelLoaded(), str => PreExecute_SetBusy(), SaveTheme_PostExecute); var saveCommand = new RelayCommandAsync<SaveThemeResults>(() => SaveTheme_Execute(ThemePath), CanExecute_ViewModelLoaded, PreExecute_SetBusy, SaveTheme_PostExecute); var newCommand = new RelayCommandAsync<LoadThemeResults>(LoadNullTheme_Execute, null, PreExecute_SetBusy, LoadTheme_PostExecute); LoadThemeCommandWrapper = new GestureCommandWrapper(loadCommand, new KeyGesture(Key.O, ModifierKeys.Control)); SaveThemeCommandWrapper = new GestureCommandWrapper(saveCommand, new KeyGesture(Key.S, ModifierKeys.Control)); SaveAsThemeCommandWrapper = new GestureCommandWrapper(saveAsCommand, new KeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Shift)); NewThemeCommandWrapper = new GestureCommandWrapper(newCommand, new KeyGesture(Key.N, ModifierKeys.Control)); ReloadBGMCommand = new RelayCommandAsync<LoadBGMResults>(LoadBGM_Execute, CanExecute_LoadedFromFile, PreExecute_SetBusy, LoadBGM_PostExecute); }
public ProductSearchResultViewModel(ProductsViewModel productsViewModel) { _productsViewModel = productsViewModel; _selectProductCommand = new RelayCommandAsync<int>(async x => await _selectProduct(x)); }
public ProductSearchViewModel(IProductControllerClient productControllerClient, ProductsViewModel products) { _productControllerClient = productControllerClient; _products = products; _searchProductsCommand = new RelayCommandAsync<string>(async x => await _searchProducts(x)); }
public ReviewOrderViewModel(IOrderControllerClient orderControllerClient, ProductsViewModel products) { _orderControllerClient = orderControllerClient; _products = products; _placeOrderCommand = new RelayCommandAsync<object>(async x => await _placeOrder()); }
partial void SetupImageCommands() { RemoveImageCommand = new RelayCommand<TargetImage>(RemoveImage_Execute, CanExecute_ImageExists); ReplaceImageCommand = new RelayCommandAsync<TargetImage, LoadImageResults>(LoadImage_Execute, image => CanExecute_ViewModelLoaded(), image => PreExecute_SetBusy(), LoadImage_PostExecute); ExportImageCommand = new RelayCommandAsync<TargetImage, SaveImageResults>(ExportImage_Execute, CanExecute_ImageExists, image => PreExecute_SetBusy(), ExportImage_PostExecute); DragImageCommand = new RelayCommand<DragEventArgs>(DragImage_Execute, image => CanExecute_ViewModelLoaded()); DropTopImageCommand = new RelayCommandAsync<DragEventArgs, LoadImageResults>(e => DropImage_Execute(e, TargetImage.Top), image => CanExecute_ViewModelLoaded(), image => PreExecute_SetBusy(), LoadImage_PostExecute); DropBottomImageCommand = new RelayCommandAsync<DragEventArgs, LoadImageResults>(e => DropImage_Execute(e, TargetImage.Bottom), image => CanExecute_ViewModelLoaded(), image => PreExecute_SetBusy(), LoadImage_PostExecute); }
public DeliveryAddressViewModel(IDeliveryAddressControllerClient deliveryAddressControllerClient, ProductsViewModel products) { _products = products; _deliveryAddressControllerClient = deliveryAddressControllerClient; _setDeliveryAddressCommand = new RelayCommandAsync<string>(async x => await _setDeliveryAddress(x), _canSetDeliveryAddressExecute); }