private void MenuFlyoutBehavior_OnCreateMenu(object sender, CreateMenuEventArgs e) { e.Menu = new MenuFlyout(); var changeStateItem = new MenuFlyoutSubItem { Text = SBoardResources.Get("Menu.ChangeStatus"), }; e.Menu.Items.Add(changeStateItem); foreach (var state in this.ViewModel.States) { var stateItem = new MenuFlyoutItem { Text = state.Name, }; changeStateItem.Items.Add(stateItem); stateItem.Click += (_, __) => { this.ViewModel.SelectedState = state; this.ViewModel.ChangeState.ExecuteAsyncTask(); }; } }
private async void Logout() { using (this._loadingService.Show(SBoardResources.Get("Loading.Logout"))) { await this._centronService.LogoutAsync(); this._applicationStateService.SetPassword(string.Empty); await this._applicationStateService.SaveStateAsync(); this.Application.CurrentMode = IoC.Get <LoggedOutApplicationMode>(); } }
public LoggedInApplicationMode(IApplicationStateService applicationStateService, ICentronService centronService, ILoadingService loadingService, IHelpdeskGroupsService helpdeskGroupsService, IEventAggregator eventAggregator) { this._applicationStateService = applicationStateService; this._centronService = centronService; this._loadingService = loadingService; this._helpdeskGroupsService = helpdeskGroupsService; this._eventAggregator = eventAggregator; this._dashboardItem = new NavigatingHamburgerItem(SBoardResources.Get("Navigation.Dashboard"), Symbol.Home, typeof(DashboardViewModel)); this._logoutItem = new ClickableHamburgerItem(SBoardResources.Get("Navigation.Logout"), SymbolEx.Logout, this.Logout); this._newHelpdeskGroupItem = new NavigatingHamburgerItem(SBoardResources.Get("Navigation.NewHelpdeskGroup"), Symbol.Add, typeof(NewHelpdeskGroupViewModel)); this._helpdeskGroupItems = new List <NavigatingHamburgerItem>(); }
public HelpdeskListViewModel(IQueryExecutor queryExecutor, IHelpdeskGroupsService helpdeskGroupsService, INavigationService navigationService, ICommandQueue commandQueue) { this._queryExecutor = queryExecutor; this._helpdeskGroupsService = helpdeskGroupsService; this._navigationService = navigationService; this._commandQueue = commandQueue; this.DisplayName = SBoardResources.Get("ViewModel.HelpdeskList"); this.Delete = ReactiveCommand.CreateAsyncTask(_ => this.DeleteImpl()); this.Delete.AttachExceptionHandler(); this.Delete.AttachLoadingService(SBoardResources.Get("Loading.DeletingHelpdeskGroup")); this.RefreshHelpdesks = ReactiveCommand.CreateAsyncTask(_ => this.RefreshHelpdesksImpl()); this.RefreshHelpdesks.AttachExceptionHandler(); this.RefreshHelpdesks.AttachLoadingService(SBoardResources.Get("Loading.Tickets")); this.RefreshHelpdesks .Select(f => { var result = new ReactiveObservableCollection <HelpdeskListItemViewModel>(); foreach (var helpdesk in f.OrderByDescending(d => d.I3D)) { var viewModel = IoC.Get <HelpdeskListItemViewModel>(); viewModel.Helpdesk = helpdesk; result.Add(viewModel); } return(result); }) .ToLoadedProperty(this, f => f.Helpdesks, out this._helpdesksHelper); this.LoadStates = ReactiveCommand.CreateAsyncTask(_ => this.LoadStatesImpl()); this.LoadStates.AttachExceptionHandler(); this.LoadStates.AttachLoadingService(SBoardResources.Get("Loading.TicketStates")); this.LoadStates.ToLoadedProperty(this, f => f.States, out this._statesHelper); var canChangeState = this.WhenAnyValue(f => f.SelectedState, f => f.SelectedHelpdesk, (state, helpdesk) => state != null && helpdesk != null); this.ChangeState = ReactiveCommand.CreateAsyncTask(canChangeState, _ => this.ChangeStateImpl()); this.ChangeState.AttachExceptionHandler(); this.ChangeState.AttachLoadingService(SBoardResources.Get("Loading.ChangingTicketState")); this.WhenAnyValue(f => f.SelectedSortOrder) .InvokeCommand(this, f => f.RefreshHelpdesks); }
public LoginViewModel([NotNull] ICentronService centronService, [NotNull] IApplicationStateService applicationStateService, [NotNull] IApplication application) { Guard.NotNull(centronService, nameof(centronService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); this._centronService = centronService; this._applicationStateService = applicationStateService; this._application = application; this.DisplayName = SBoardResources.Get("ViewModel.Login"); var canLogin = this.WhenAnyValue(f => f.WebServiceAddress, f => f.Username, f => f.Password, (webServiceAddress, username, password) => string.IsNullOrWhiteSpace(webServiceAddress) == false && string.IsNullOrWhiteSpace(username) == false && string.IsNullOrWhiteSpace(password) == false); this.Login = ReactiveCommand.CreateAsyncTask(canLogin, _ => this.LoginImpl()); this.Login.AttachExceptionHandler(); this.Login.AttachLoadingService(SBoardResources.Get("Loading.Login")); }
public NewHelpdeskGroupViewModel(IHelpdeskGroupsService helpdeskGroupsService, IQueryExecutor queryExecutor, INavigationService navigationService) { Guard.NotNull(helpdeskGroupsService, nameof(helpdeskGroupsService)); Guard.NotNull(queryExecutor, nameof(queryExecutor)); Guard.NotNull(navigationService, nameof(navigationService)); this._helpdeskGroupsService = helpdeskGroupsService; this._queryExecutor = queryExecutor; this._navigationService = navigationService; this.DisplayName = SBoardResources.Get("ViewModel.NewHelpdeskGroup"); this.LoadHelpdeskTypes = ReactiveCommand.CreateAsyncTask(_ => this.LoadHelpdeskTypesImpl()); this.LoadHelpdeskTypes.ToLoadedProperty(this, f => f.HelpdeskTypes, out this._helpdeskTypesHelper); this.LoadHelpdeskTypes.AttachExceptionHandler(); this.LoadHelpdeskTypes.AttachLoadingService(SBoardResources.Get("Loading.TicketTypes")); this.LoadHelpdeskStates = ReactiveCommand.CreateAsyncTask(_ => this.LoadHelpdeskStatesImpl()); this.LoadHelpdeskStates.ToLoadedProperty(this, f => f.HelpdeskStates, out this._helpdeskStatesHelper); this.LoadHelpdeskStates.AttachExceptionHandler(); this.LoadHelpdeskStates.AttachLoadingService(SBoardResources.Get("Loading.TicketStates")); this.SearchCustomers = ReactiveCommand.CreateAsyncTask(_ => this.SearchCustomersImpl()); this.SearchCustomers.ToLoadedProperty(this, f => f.Customers, out this._customersHelper); this.SearchCustomers.IsExecuting.ToLoadedProperty(this, f => f.IsSearchingCustomers, out this._isSearchingCustomersHelper); this.SearchCustomers.AttachExceptionHandler(); this.WhenAnyValue(f => f.CustomerSearchText) .Throttle(TimeSpan.FromMilliseconds(500), RxApp.MainThreadScheduler) .DistinctUntilChanged() .InvokeCommand(this, f => f.SearchCustomers); var canSave = this.WhenAnyValue(f => f.Name, name => string.IsNullOrWhiteSpace(name) == false); this.Save = ReactiveCommand.CreateAsyncTask(canSave, _ => this.SaveImpl()); this.Save.AttachLoadingService(SBoardResources.Get("Loading.Saving")); this.Save.AttachExceptionHandler(); }
public DashboardViewModel() { this.DisplayName = SBoardResources.Get("ViewModel.Dashboard"); }
public override string GetErrorMessage() => SBoardResources.Get("Errors.Message");
public override string GetErrorTitle() => SBoardResources.Get("Errors.Title");
public LoggedOutApplicationMode(INavigationService navigationService) { this._navigationService = navigationService; this._loginItem = new NavigatingHamburgerItem(SBoardResources.Get("Navigation.Login"), SymbolEx.Login, typeof(LoginViewModel)); }