Example #1
0
        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>();
        }
Example #2
0
        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);
        }
Example #3
0
        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();
        }
Example #4
0
 public HelpdeskGroupQueryHandler(ICentronService centronService, IHelpdeskGroupsService helpdeskGroupsService, IScriptEngine scriptEngine)
 {
     this._centronService        = centronService;
     this._helpdeskGroupsService = helpdeskGroupsService;
     this._scriptEngine          = scriptEngine;
 }