public ManagerViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { packageManageService = Localizer.Localizer.Kernel.Get <IPackageManageService>(); sourcePackageLoadServiceService = Localizer.Localizer.Kernel.Get <SourcePackageLoadService <Package> >(); packedPackageLoadServiceService = Localizer.Localizer.Kernel.Get <PackedPackageLoadService <Package> >(); packageImportService = Localizer.Localizer.Kernel.Get <IPackageImportService>(); fileLoadService = Localizer.Localizer.Kernel.Get <IFileLoadService>(); packageManageService.PackageGroups = new ObservableCollection <IPackageGroup>(); } ReloadCommand = new RelayCommand(Reload, () => !loading && !importing); SaveStateCommand = new RelayCommand(SaveState, () => !loading && !importing); ImportAllCommand = new RelayCommand(ImportAll, () => !loading && !importing); RevertCommand = new RelayCommand(Revert); Application.Current.Dispatcher.InvokeAsync(() => { LoadPackages(); if (Localizer.Localizer.Config.AutoImport) { ImportAll(); } }); }
public AutoImportService(IPackageManageService packageManage, SourcePackageLoad <PackageModel> sourcePackageLoad, PackedPackageLoad <PackageModel> packedPackageLoad, IPackageImportService packageImportPackageImport, IFileLoadService fileLoad) { _packageManage = packageManage ?? throw new ArgumentNullException(nameof(packageManage)); _sourcePackageLoad = sourcePackageLoad ?? throw new ArgumentNullException(nameof(sourcePackageLoad)); _packedPackageLoad = packedPackageLoad ?? throw new ArgumentNullException(nameof(packedPackageLoad)); _packageImportPackageImport = packageImportPackageImport ?? throw new ArgumentNullException(nameof(packageImportPackageImport)); _fileLoad = fileLoad ?? throw new ArgumentNullException(nameof(fileLoad)); LoadPackages(); Hooks.BeforeModCtor += OnBeforeModCtor; Hooks.PostSetupContent += OnPostSetupContent; }
public ManagerViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { packageManageDisposable = Plugin.Kernel.Get <IPackageManageService>(); sourcePackageLoadServiceService = Plugin.Kernel.Get <SourcePackageLoad <Package> >(); packedPackageLoadServiceService = Plugin.Kernel.Get <PackedPackageLoad <Package> >(); packageImportService = Plugin.Kernel.Get <IPackageImportService>(); fileLoadService = Plugin.Kernel.Get <IFileLoadService>(); packageManageDisposable.PackageGroups = new ObservableCollection <IPackageGroup>(); } ReloadCommand = new RelayCommand(Reload, () => !loading && !importing); SaveStateCommand = new RelayCommand(SaveState, () => !loading && !importing); ImportAllCommand = new RelayCommand(ImportAll, () => !loading && !importing); packageManageDisposable.PackageGroups.Clear(); LoadPackages(); }