protected BaseManageItemsViewModel(IShell shell, IDomain0Service domain0, IMapper mapper)
        {
            _shell   = shell;
            _domain0 = domain0;
            _mapper  = mapper;

            OpenCreateFlyoutCommand = ReactiveCommand
                                      .Create(() =>
            {
                IsCreateFlyoutOpen = !IsCreateFlyoutOpen;
                IsEditFlyoutOpen   = false;
            }, OpenCreateFlyoutCommandObservable)
                                      .DisposeWith(Disposables);

            OpenEditFlyoutCommand = ReactiveCommand
                                    .Create(() =>
            {
                IsCreateFlyoutOpen = false;
                IsEditFlyoutOpen   = !IsEditFlyoutOpen;
            }, OpenEditFlyoutCommandObservable)
                                    .DisposeWith(Disposables);

            EditSelectedCommand = ReactiveCommand
                                  .CreateFromTask(EditSelected)
                                  .DisposeWith(Disposables);
            CreateCommand = ReactiveCommand
                            .CreateFromTask(Create)
                            .DisposeWith(Disposables);

            CreatedItemInList = new Interaction <TViewModel, Unit>();

            DeleteSelectedCommand = ReactiveCommand
                                    .CreateFromTask(DeleteSelected, DeleteSelectedCommandObservable)
                                    .DisposeWith(Disposables);

            UpdateFilters = ReactiveCommand
                            .Create <PropertyFilter>(UpdateFilter)
                            .DisposeWith(Disposables);

            ModelFilters = new SourceCache <ModelFilter, PropertyInfo>(x => x.Property)
                           .DisposeWith(Disposables);

            var dynamicFilter = ModelFilters.Connect()
                                .StartWithEmpty()
                                .ToCollection()
                                .Select(Filters.CreateModelFilter <TViewModel>);

            Initialize();

            Models.Connect()
            .Transform(TransformToViewModel)
            .Filter(dynamicFilter)
            .Sort(SortExpressionComparer <TViewModel> .Ascending(x => x.Id), SortOptimisations.ComparesImmutableValuesOnly, 25)
            .ObserveOnDispatcher()
            .Bind(out _items)
            .DisposeMany()
            .Subscribe()
            .DisposeWith(Disposables);

            this.WhenAnyValue(x => x.SelectedItem)
            .Subscribe(SelectionChanged)
            .DisposeWith(Disposables);
        }
Beispiel #2
0
 public ManagePermissionsViewModel(IShell shell, IDomain0Service domain0, IMapper mapper) : base(shell, domain0, mapper)
 {
 }
        public ManageToolsViewModel(
            IShell shell,
            IDomain0Service domain0,
            IAuthenticationContext authContext,
            IAppConfigStorage appConfigStorage)
        {
            _shell            = shell;
            _domain0          = domain0;
            _authContext      = authContext;
            _appConfigStorage = appConfigStorage;

            LogoutCommand = ReactiveCommand
                            .Create(Logout)
                            .DisposeWith(Disposables);
            ReloadCommand = ReactiveCommand
                            .CreateFromTask(Reload)
                            .DisposeWith(Disposables);
            CopyTokenToClipboardCommand = ReactiveCommand
                                          .Create(CopyTokenToClipboard)
                                          .DisposeWith(Disposables);
            ChangePasswordCommand = ReactiveCommand
                                    .CreateFromTask(ChangePassword)
                                    .DisposeWith(Disposables);

            OpenUsersCommand = ReactiveCommand
                               .Create(shell.ShowUsers)
                               .DisposeWith(Disposables);
            OpenRolesCommand = ReactiveCommand
                               .Create(shell.ShowRoles)
                               .DisposeWith(Disposables);
            OpenPermissionsCommand = ReactiveCommand
                                     .Create(shell.ShowPermissions)
                                     .DisposeWith(Disposables);
            OpenApplicationsCommand = ReactiveCommand
                                      .Create(shell.ShowApplications)
                                      .DisposeWith(Disposables);
            OpenEnvironmentsCommand = ReactiveCommand
                                      .Create(shell.ShowEnvironments)
                                      .DisposeWith(Disposables);
            OpenMessagesCommand = ReactiveCommand
                                  .Create(shell.ShowMessages)
                                  .DisposeWith(Disposables);

            AccentColors = ThemeManager.ColorSchemes
                           .Select(a => new ColorData(_appConfigStorage,
                                                      (x, v) => x.AccentColor = v)
            {
                Name       = a.Name,
                ColorBrush = a.ShowcaseBrush,
            })
                           .ToList();
            AppThemes = ThemeManager.Themes
                        .GroupBy(x => x.Type)
                        .Select(x => x.First())
                        .Select(a => new ColorData(_appConfigStorage,
                                                   (x, v) => x.AppTheme = v)
            {
                Name             = a.BaseColorScheme,
                BorderColorBrush = a.Resources["MahApps.Brushes.Black"] as Brush,
                ColorBrush       = a.Resources["MahApps.Brushes.White"] as Brush,
            })
                        .ToList();
        }
Beispiel #4
0
 public ManageMessagesViewModel(IShell shell, IDomain0Service domain0, IMapper mapper)
     : base(shell, domain0, mapper)
 {
 }
Beispiel #5
0
 protected ManageMultipleItemsWithPermissionsViewModel(IShell shell, IDomain0Service domain0, IMapper mapper) : base(shell, domain0, mapper)
 {
 }
Beispiel #6
0
 public ManageEnvironmentsViewModel(IShell shell, IDomain0Service domain0, IMapper mapper)
     : base(shell, domain0, mapper)
 {
 }