示例#1
0
        public PackagesListViewModel(
            IBusyManager busyManager,
            IMsixHeroApplication application,
            IInteractionService interactionService)
        {
            this.busyManager        = busyManager;
            this.application        = application;
            this.interactionService = interactionService;
            this.Items                  = new ObservableCollection <InstalledPackageViewModel>();
            this.ItemsCollection        = CollectionViewSource.GetDefaultView(this.Items);
            this.ItemsCollection.Filter = row => this.IsPackageVisible((InstalledPackageViewModel)row);

            // reloading packages
            this.application.EventAggregator.GetEvent <UiExecutingEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesExecuting);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <GetPackagesCommand, IList <InstalledPackage> > >().Subscribe(this.OnGetPackagesExecuted, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiFailedEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesFailed);
            this.application.EventAggregator.GetEvent <UiCancelledEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesCancelled);

            // filtering
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetPackageFilterCommand> >().Subscribe(this.OnSetPackageFilterCommand, ThreadOption.UIThread);

            // sorting ang grouping
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetPackageSortingCommand> >().Subscribe(this.OnSetPackageSorting, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetPackageGroupingCommand> >().Subscribe(this.OnSetPackageGrouping, ThreadOption.UIThread);

            // is running indicator
            this.application.EventAggregator.GetEvent <PubSubEvent <ActivePackageFullNames> >().Subscribe(this.OnActivePackageIndication);
            this.application.EventAggregator.GetEvent <PubSubEvent <ActivePackageFullNames> >().Subscribe(this.OnActivePackageIndicationFinished, ThreadOption.UIThread);

            this.busyManager.StatusChanged += BusyManagerOnStatusChanged;
            this.SetSortingAndGrouping();
        }
示例#2
0
        public VolumeManagementHandler(
            UIElement parent,
            IMsixHeroApplication application,
            IInteractionService interactionService,
            IConfigurationService configurationService,
            ISelfElevationProxyProvider <IAppxVolumeManager> volumeManagerProvider,
            IBusyManager busyManager,
            IDialogService dialogService,
            IModuleManager moduleManager)
        {
            this.application           = application;
            this.interactionService    = interactionService;
            this.dialogService         = dialogService;
            this.moduleManager         = moduleManager;
            this.configurationService  = configurationService;
            this.volumeManagerProvider = volumeManagerProvider;
            this.busyManager           = busyManager;

            parent.CommandBindings.Add(new CommandBinding(NavigationCommands.Refresh, this.OnRefresh));
            parent.CommandBindings.Add(new CommandBinding(ApplicationCommands.New, this.OnNew));
            parent.CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, this.OnDelete, this.CanDelete));
            parent.CommandBindings.Add(new CommandBinding(MsixHeroCommands.SetVolumeAsDefault, this.OnSetVolumeAsDefault, this.CanSetVolumeAsDefault));
            parent.CommandBindings.Add(new CommandBinding(MsixHeroCommands.MountVolume, this.OnMountVolume, this.CanMountVolume));
            parent.CommandBindings.Add(new CommandBinding(MsixHeroCommands.DismountVolume, this.OnDismountVolume, this.CanDismountVolume));
        }
示例#3
0
 public VolumeManagementViewModel(
     IMsixHeroApplication application,
     PrismServices prismServices)
 {
     this.application   = application;
     this.prismServices = prismServices;
     application.EventAggregator.GetEvent <UiExecutedEvent <SelectVolumesCommand> >().Subscribe(this.OnSelectVolumes, ThreadOption.UIThread);
 }
示例#4
0
 public EventViewerViewModel(
     IMsixHeroApplication application,
     PrismServices prismServices)
 {
     this.application   = application;
     this.prismServices = prismServices;
     application.EventAggregator.GetEvent <UiExecutedEvent <SelectLogCommand> >().Subscribe(this.OnSelectLogCommand);
 }
示例#5
0
 public VolumesSearchViewModel(
     IMsixHeroApplication application,
     IBusyManager busyManager,
     IInteractionService interactionService)
 {
     this.application        = application;
     this.busyManager        = busyManager;
     this.interactionService = interactionService;
     this.application.EventAggregator.GetEvent <UiExecutedEvent <SetVolumeFilterCommand> >().Subscribe(this.OnSetVolumeFilterCommand);
 }
示例#6
0
        public EventViewerFilterSortViewModel(IMsixHeroApplication application, IInteractionService interactionService)
        {
            this.application        = application;
            this.interactionService = interactionService;

            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetEventViewerFilterCommand> >().Subscribe(this.OnSetEventViewerFilter);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetEventViewerSortingCommand> >().Subscribe(this.OnSetEventViewerSorting);

            this.Clear = new DelegateCommand <object>(this.OnClearFilter);
        }
示例#7
0
 public WhatsNewViewModel(
     IMsixHeroApplication application,
     IInteractionService interactionService,
     IConfigurationService configurationService)
 {
     this.application          = application;
     this.interactionService   = interactionService;
     this.configurationService = configurationService;
     this.Dismiss          = new DelegateCommand(this.OnDismiss);
     this.OpenReleaseNotes = new DelegateCommand(this.OnOpenReleaseNotes);
 }
        public SidebarViewModel(
            IMsixHeroApplication application,
            IInteractionService interactionService,
            IEventAggregator eventAggregator,
            IModuleManager moduleManager,
            IDialogService dialogService)
        {
            this.application        = application;
            this.interactionService = interactionService;
            this.moduleManager      = moduleManager;
            this.dialogService      = dialogService;
            this.SidebarItems       = new ObservableCollection <SidebarItemViewModel>
            {
                new SidebarItemViewModel(
                    ApplicationMode.Dashboard,
                    NavigationPaths.Dashboard,
                    "Dashboard",
                    TabOverview),

                new SidebarItemViewModel(
                    ApplicationMode.Packages,
                    NavigationPaths.PackageManagement,
                    "Packages",
                    TabPackages),

                new SidebarItemViewModel(
                    ApplicationMode.VolumeManager,
                    NavigationPaths.VolumeManagement,
                    "Volumes",
                    TabVolumes),

                new SidebarItemViewModel(
                    ApplicationMode.EventViewer,
                    NavigationPaths.EventViewer,
                    "Event viewer",
                    TabEventViewer),

                new SidebarItemViewModel(
                    ApplicationMode.SystemStatus,
                    NavigationPaths.SystemStatus,
                    "System overview",
                    TabSystemStatus),

                new SidebarItemViewModel(
                    ApplicationMode.WhatsNew,
                    NavigationPaths.WhatsNew)
            };

            this.selectedItem = this.SidebarItems.First();

            eventAggregator.GetEvent <UiExecutedEvent <SetCurrentModeCommand> >().Subscribe(this.OnSetCurrentMode);

            this.SettingsCommand = new DelegateCommand(this.OnSettingsCommand);
        }
示例#9
0
        public EventViewerListView(IMsixHeroApplication application)
        {
            this.application = application;
            this.InitializeComponent();

            this.application.EventAggregator.GetEvent <UiFailedEvent <GetLogsCommand> >().Subscribe(this.OnGetLogsCommandFailed, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiExecutingEvent <GetLogsCommand> >().Subscribe(this.OnGetLogsCommandExecuting);
            this.application.EventAggregator.GetEvent <UiCancelledEvent <GetLogsCommand> >().Subscribe(this.OnGetLogsCommandCancelled, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <GetLogsCommand> >().Subscribe(this.OnGetLogsCommandExecuted, ThreadOption.UIThread);
            this.InitializeComponent();
            this.ListBox.PreviewKeyDown += ListBoxOnKeyDown;
            this.ListBox.PreviewKeyUp   += ListBoxOnKeyUp;
        }
示例#10
0
        public EventViewerCommandHandler(
            UIElement parent,
            IMsixHeroApplication application,
            IInteractionService interactionService,
            IBusyManager busyManager)
        {
            this.application        = application;
            this.interactionService = interactionService;
            this.busyManager        = busyManager;

            parent.CommandBindings.Add(new CommandBinding(NavigationCommands.Refresh, this.OnRefresh, this.CanRefresh));
            parent.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, this.OnCopy, this.CanCopy));
        }
示例#11
0
        public HelpViewModel(IUpdateChecker updateChecker, IMsixHeroApplication application)
        {
            this.CloseCommand     = new DelegateCommand(((IDialogAware)this).OnDialogClosed, ((IDialogAware)this).CanCloseDialog);
            this.ShowReleaseNotes = new DelegateCommand(this.OnShowReleaseNotes);

            this.updateChecker = updateChecker;
            this.application   = application;
            this.Check         = new DelegateCommand(this.CheckExecute, this.CheckCanExecute);
            this.UpdateCheck   = new AsyncProperty <UpdateCheckResult>();

            var assemblyLocation = (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly()).Location;

            this.Version = FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion;
        }
示例#12
0
        public PackagesSearchViewModel(
            IEventAggregator eventAggregator,
            IMsixHeroApplication application,
            IBusyManager busyManager,
            IInteractionService interactionService)
        {
            this.application        = application;
            this.busyManager        = busyManager;
            this.interactionService = interactionService;
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetPackageFilterCommand> >().Subscribe(this.OnSetPackageFilterCommand);
            this.isAllUsers = application.ApplicationState.Packages.Mode == PackageContext.AllUsers;

            eventAggregator.GetEvent <UiExecutedEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackages);
            eventAggregator.GetEvent <UiFailedEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackages);
            eventAggregator.GetEvent <UiCancelledEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackages);
        }
示例#13
0
        public PackagesListView(
            IMsixHeroApplication application,
            IConfigurationService configService)
        {
            this.application   = application;
            this.configService = configService;

            application.EventAggregator.GetEvent <ToolsChangedEvent>().Subscribe(payload => this.tools = null);
            application.EventAggregator.GetEvent <UiFailedEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesFailed, ThreadOption.UIThread);
            application.EventAggregator.GetEvent <UiExecutingEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesExecuting);
            application.EventAggregator.GetEvent <UiCancelledEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesCancelled, ThreadOption.UIThread);
            application.EventAggregator.GetEvent <UiExecutedEvent <GetPackagesCommand> >().Subscribe(this.OnGetPackagesExecuted, ThreadOption.UIThread);

            this.InitializeComponent();
            this.ListBox.PreviewKeyDown += ListBoxOnKeyDown;
            this.ListBox.PreviewKeyUp   += ListBoxOnKeyUp;
        }
        public PackagesManagementCommandHandler(
            IMsixHeroApplication application,
            IInteractionService interactionService,
            IConfigurationService configurationService,
            PrismServices prismServices,
            ISelfElevationProxyProvider <IAppxPackageRunner> packageRunnerProvider,
            ISelfElevationProxyProvider <IAppxPackageInstaller> packageInstallerProvider,
            ISelfElevationProxyProvider <IRegistryManager> registryManagerProvider,
            IBusyManager busyManager)
        {
            this.application              = application;
            this.interactionService       = interactionService;
            this.configurationService     = configurationService;
            this.dialogService            = prismServices.DialogService;
            this.moduleManager            = prismServices.ModuleManager;
            this.packageRunnerProvider    = packageRunnerProvider;
            this.packageInstallerProvider = packageInstallerProvider;
            this.registryManagerProvider  = registryManagerProvider;
            this.busyManager              = busyManager;
            this.fileInvoker              = new FileInvoker(this.interactionService, this.configurationService);

            this.Refresh                       = new DelegateCommand(this.OnRefresh, this.CanRefresh);
            this.AddPackage                    = new DelegateCommand <object>(this.OnAddPackage, this.CanAddPackage);
            this.OpenExplorer                  = new DelegateCommand(this.OnOpenExplorer, this.CanOpenExplorer);
            this.OpenUserExplorer              = new DelegateCommand(this.OnOpenUserExplorer, this.CanOpenUserExplorer);
            this.OpenManifest                  = new DelegateCommand(this.OnOpenManifest, this.CanOpenManifest);
            this.OpenConfigJson                = new DelegateCommand(this.OnOpenConfigJson, this.CanOpenPsfConfig);
            this.OpenStore                     = new DelegateCommand(this.OnOpenStore, this.CanOpenStore);
            this.CheckUpdates                  = new DelegateCommand(this.OnCheckUpdates, this.CanCheckUpdates);
            this.RunTool                       = new DelegateCommand <object>(this.OnRunTool, this.CanRunTool);
            this.RemovePackage                 = new DelegateCommand(this.OnRemovePackage, this.CanRemovePackage);
            this.Copy                          = new DelegateCommand <object>(this.OnCopy, this.CanCopy);
            this.ViewDependencies              = new DelegateCommand(this.OnViewDependencies, this.CanViewDependencies);
            this.ChangeVolume                  = new DelegateCommand(this.OnChangeVolume, this.CanChangeVolume);
            this.ShowAppInstallerDialog        = new DelegateCommand <object>(this.OnShowAppInstallerDialog);
            this.ShowModificationPackageDialog = new DelegateCommand <object>(this.OnShowModificationPackageDialog);
            this.ShowWingetDialog              = new DelegateCommand <object>(this.OnShowWingetDialog);
            this.MountRegistry                 = new DelegateCommand(this.OnMountRegistry, this.CanMountRegistry);
            this.DismountRegistry              = new DelegateCommand(this.OnDismountRegistry, this.CanDismountRegistry);
            this.StartApp                      = new DelegateCommand <object>(this.OnStartApp, this.CanStartApp);
            this.StopApp                       = new DelegateCommand(this.OnStopApp, this.CanStopApp);
            this.Settings                      = new DelegateCommand(this.OnSettings);
        }
示例#15
0
        public ChangeVolumeViewModel(
            IMsixHeroApplication application,
            IInteractionService interactionService,
            IModuleManager moduleManager,
            IDialogService dialogService,
            ISelfElevationProxyProvider <IAppxVolumeManager> volumeManagerFactory) : base("Change volume", interactionService)
        {
            this.application          = application;
            this.interactionService   = interactionService;
            this.moduleManager        = moduleManager;
            this.dialogService        = dialogService;
            this.volumeManagerFactory = volumeManagerFactory;

            // This can be longer...
            var taskForFreeLetters = this.GetAllVolumes();

            taskForFreeLetters.ContinueWith(t =>
            {
                if (t.IsCanceled || t.IsFaulted)
                {
                    return;
                }

                var dr = t.Result.FirstOrDefault();
                if (dr != null)
                {
                    this.TargetVolume.CurrentValue = dr.Name;
                    this.TargetVolume.Commit();
                }

#pragma warning disable 4014
                this.AllVolumes.Load(Task.FromResult(t.Result));
#pragma warning restore 4014
            });

            this.AllVolumes    = new AsyncProperty <List <VolumeCandidateViewModel> >();
            this.TargetVolume  = new ChangeableProperty <string>();
            this.CurrentVolume = new AsyncProperty <VolumeCandidateViewModel>();

            this.AddChildren(this.TargetVolume);
        }
示例#16
0
 public VolumeManagementView(
     IMsixHeroApplication application,
     IInteractionService interactionService,
     IConfigurationService configurationService,
     ISelfElevationProxyProvider <IAppxVolumeManager> volumeManagerProvider,
     IBusyManager busyManager,
     IDialogService dialogService,
     IModuleManager moduleManager)
 {
     this.application = application;
     this.InitializeComponent();
     this.commandHandler = new VolumeManagementHandler(
         this,
         application,
         interactionService,
         configurationService,
         volumeManagerProvider,
         busyManager,
         dialogService,
         moduleManager);
 }
示例#17
0
        public VolumesListViewModel(
            IMsixHeroApplication application,
            IBusyManager busyManager,
            IInteractionService interactionService)
        {
            this.busyManager        = busyManager;
            this.application        = application;
            this.interactionService = interactionService;
            this.Items                  = new ObservableCollection <VolumeViewModel>();
            this.ItemsCollection        = CollectionViewSource.GetDefaultView(this.Items);
            this.ItemsCollection.Filter = row => this.IsVolumeVisible((VolumeViewModel)row);

            this.application.EventAggregator.GetEvent <UiExecutingEvent <GetVolumesCommand> >().Subscribe(this.OnGetVolumesExecuting);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <GetVolumesCommand, IList <AppxVolume> > >().Subscribe(this.OnGetVolumesExecuted, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiFailedEvent <GetVolumesCommand> >().Subscribe(this.OnGetVolumesFailed);
            this.application.EventAggregator.GetEvent <UiCancelledEvent <GetVolumesCommand> >().Subscribe(this.OnGetVolumesCancelled);

            // filtering
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetVolumeFilterCommand> >().Subscribe(this.OnSetVolumeFilterCommand, ThreadOption.UIThread);

            this.busyManager.StatusChanged += BusyManagerOnStatusChanged;
        }
示例#18
0
        public PackageManagementViewModel(
            IMsixHeroApplication application,
            IInteractionService interactionService,
            ISelfElevationProxyProvider <IAppxPackageManager> packageManagerProvider,
            ISelfElevationProxyProvider <IRegistryManager> registryManagerProvider,
            PrismServices prismServices,
            IBusyManager busyManager,
            IConfigurationService configurationService)
        {
            this.application    = application;
            this.prismServices  = prismServices;
            this.CommandHandler = new PackagesManagementCommandHandler(
                application,
                interactionService,
                configurationService,
                prismServices,
                packageManagerProvider,
                registryManagerProvider,
                busyManager);

            application.EventAggregator.GetEvent <UiExecutedEvent <SelectPackagesCommand> >().Subscribe(this.OnSelectPackages, ThreadOption.UIThread);
        }
示例#19
0
        public NewVolumeViewModel(
            IMsixHeroApplication application,
            IInteractionService interactionService,
            ISelfElevationProxyProvider <IAppxVolumeManager> volumeManager) : base("New volume", interactionService)
        {
            this.application   = application;
            this.volumeManager = volumeManager;
            this.Path          = new ChangeableProperty <string>("WindowsApps");

            // This can be longer...
            var taskForFreeLetters = this.GetLetters();

            taskForFreeLetters.ContinueWith(t =>
            {
                if (t.IsCanceled || t.IsFaulted)
                {
                    return;
                }

                var dr = t.Result.FirstOrDefault();
                if (dr != null)
                {
                    this.SelectedLetter.CurrentValue = dr.PackageStorePath;
                    this.SelectedLetter.Commit();
                }

#pragma warning disable 4014
                this.Letters.Load(Task.FromResult(t.Result));
#pragma warning restore 4014
            });

            this.Letters                = new AsyncProperty <List <VolumeCandidateViewModel> >();
            this.SelectedLetter         = new ChangeableProperty <string>();
            this.PathType               = new ChangeableProperty <NewVolumePathType>();
            this.SetAsDefault           = new ChangeableProperty <bool>();
            this.PathType.ValueChanged += this.PathTypeOnValueChanged;

            this.AddChildren(this.Path, this.PathType, this.SetAsDefault);
        }
示例#20
0
        public EventViewerListViewModel(
            IMsixHeroApplication application,
            IBusyManager busyManager,
            IInteractionService interactionService)
        {
            this.application        = application;
            this.busyManager        = busyManager;
            this.interactionService = interactionService;
            this.Logs             = new ObservableCollection <LogViewModel>();
            this.LogsView         = CollectionViewSource.GetDefaultView(this.Logs);
            this.LogsView.Filter += Filter;
            this.Sort(nameof(Log.DateTime), false);
            this.MaxLogs = 250;
            this.End     = DateTime.Now;
            this.Start   = this.End.Subtract(TimeSpan.FromDays(5));

            this.busyManager.StatusChanged += BusyManagerOnStatusChanged;
            this.Progress = new ProgressProperty();
            this.application.EventAggregator.GetEvent <UiExecutedEvent <GetLogsCommand, IList <Log> > >().Subscribe(this.OnGetLogs, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetEventViewerFilterCommand> >().Subscribe(this.OnSetEventViewerFilterCommand, ThreadOption.UIThread);
            this.application.EventAggregator.GetEvent <UiExecutedEvent <SetEventViewerSortingCommand> >().Subscribe(this.OnSetEventViewerSortingCommand, ThreadOption.UIThread);
            this.SetSortingAndGrouping();
        }
示例#21
0
 public EventViewerView(IMsixHeroApplication application, IInteractionService interactionService, IBusyManager busyManager)
 {
     this.application = application;
     this.InitializeComponent();
     this.commandHandler = new EventViewerCommandHandler(this, application, interactionService, busyManager);
 }
 public VolumesSearchViewModel(IMsixHeroApplication application)
 {
     this.application = application;
     this.application.EventAggregator.GetEvent <UiExecutedEvent <SetVolumeFilterCommand> >().Subscribe(this.OnSetVolumeFilterCommand);
 }
示例#23
0
 public DashboardSearchViewModel(IMsixHeroApplication application, IEventAggregator eventAggregator)
 {
     this.application = application;
     eventAggregator.GetEvent <UiExecutedEvent <SetToolFilterCommand> >().Subscribe(this.OnSetToolFilterCommand);
 }
示例#24
0
 public InitialScreen(IMsixHeroApplication application, IConfigurationService configurationService)
 {
     this.application          = application;
     this.configurationService = configurationService;
 }