示例#1
0
        public SettingsViewModel(
            IRuntimeConfigurationService configurationService,
            ILicenseService licenseService,
            ICommandManager commandManager, DataPersisterService dataPersisterService,
            GlobalFrontendService globalFrontendService, GlobalService globalService,
            IAdvancedMessageService advancedMessageService,
            AudioService audioService, MidiService midiService
            )
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => licenseService);

            _configurationService   = configurationService;
            _commandManager         = commandManager;
            _globalService          = globalService;
            _advancedMessageService = advancedMessageService;

            ApplicationState = globalFrontendService.ApplicationState;

            OpenVstWorkerLogDirectory = new Command(OnOpenVstWorkerLogDirectoryExecute);
            OpenDataDirectory         = new Command(OnOpenDataDirectoryExecute);
            Title = "Settings";

            PresetDatabaseStatistics = dataPersisterService.GetStorageStatistics();

            TotalPresets = (from p in PresetDatabaseStatistics select p.PresetCount).Sum();
            TotalPresetsUncompressedSize = (from p in PresetDatabaseStatistics select p.PresetUncompressedSize).Sum();
            TotalPresetsCompressedSize   = (from p in PresetDatabaseStatistics select p.PresetCompressedSize).Sum();
            SavedSpace         = (from p in PresetDatabaseStatistics select p.SavedSpace).Sum();
            SavedSpacePercent  = (double)TotalPresetsCompressedSize / TotalPresetsUncompressedSize;
            AudioOutputDevices = audioService.GetOutputDevices();
            MidiInputDevices   = midiService.GetInputDevices();
        }
示例#2
0
        public VstPluginSettingsViewModel(Plugin plugin, IVstService vstService, IOpenFileService openFileService,
                                          ISelectDirectoryService selectDirectoryService, ILicenseService licenseService,
                                          IAdvancedMessageService messageService,
                                          ICommandManager commandManager,
                                          RemoteVstService remoteVstService,
                                          INativeInstrumentsResourceGeneratorService
                                          resourceGeneratorService)
        {
            Argument.IsNotNull(() => vstService);
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => selectDirectoryService);
            Argument.IsNotNull(() => licenseService);
            Argument.IsNotNull(() => resourceGeneratorService);
            Argument.IsNotNull(() => commandManager);

            Plugin = plugin;

            _openFileService          = openFileService;
            _commandManager           = commandManager;
            _selectDirectoryService   = selectDirectoryService;
            _licenseService           = licenseService;
            _vstService               = vstService;
            _resourceGeneratorService = resourceGeneratorService;
            _messageService           = messageService;
            _remoteVstService         = remoteVstService;

            OpenNKSFile               = new TaskCommand(OnOpenNKSFileExecute);
            ClearMappings             = new TaskCommand(OnClearMappingsExecute);
            AddAdditionalPresetFiles  = new TaskCommand(OnAddAdditionalPresetFilesExecute);
            AddAdditionalPresetFolder = new TaskCommand(OnAddAdditionalPresetFolderExecute);
            RemoveAdditionalBankFiles = new Command <object>(OnRemoveAdditionalBankFilesExecute);
            RemoveCategory            = new Command <object>(OnRemoveCategoryExecute);
            AddCategory               = new Command(OnAddCategoryExecute);

            ReplaceVBLogo    = new TaskCommand(OnReplaceVBLogoExecute);
            ReplaceVBArtwork = new TaskCommand(OnReplaceVBArtworkExecute);

            ReplaceMSTLogo    = new TaskCommand(OnReplaceMSTLogoExecute);
            ReplaceMSTArtwork = new TaskCommand(OnReplaceMSTArtworkExecute);
            ReplaceMSTPlugin  = new TaskCommand(OnReplaceMSTPluginExecute);

            ReplaceOSOLogo = new TaskCommand(OnReplaceOSOLogoExecute);

            SubmitResource             = new TaskCommand(OnSubmitResourceExecute);
            QueryOnlineResources       = new TaskCommand(OnQueryOnlineResourcesExecute);
            LoadSelectedOnlineResource = new TaskCommand(OnLoadSelectedOnlineResourceExecute);

            GenerateResources = new TaskCommand(OnGenerateResourcesExecute);


            Title = "Settings for " + Plugin.PluginName;


            GenerateControllerMappingModels();
            PluginLocations = (from pluginLocation in Plugin.PluginLocations
                               where pluginLocation.IsPresent
                               select pluginLocation).ToList();
        }
 public PluginRemoveSelectedPluginsCommandContainer(ICommandManager commandManager,
                                                    IServiceLocator serviceLocator)
     : base(Commands.Plugin.RemoveSelectedPlugins, commandManager, serviceLocator)
 {
     _messageService      = serviceLocator.ResolveType <IAdvancedMessageService>();
     _dataPersister       = serviceLocator.ResolveType <DataPersisterService>();
     _presetDataPersister = serviceLocator.ResolveType <PresetDataPersisterService>();
     _dispatcherService   = serviceLocator.ResolveType <IDispatcherService>();
     _globalService       = serviceLocator.ResolveType <GlobalService>();
     _globalFrontendService.SelectedPlugins.CollectionChanged += SelectedPluginsOnCollectionChanged;
 }
        public VstPluginPresetsViewModel(Plugin plugin, GlobalService globalService,
                                         IUIVisualizerService visualizerService,
                                         DataPersisterService dataPersisterService, IViewModelFactory viewModelFactory,
                                         IAdvancedMessageService advancedMessageService, RemoteVstService remoteVstService,
                                         GlobalFrontendService globalFrontendService,
                                         PresetDataPersisterService presetDataPersisterService)
        {
            _messageService        = advancedMessageService;
            _visualizerService     = visualizerService;
            _viewModelFactory      = viewModelFactory;
            _dataPersisterService  = dataPersisterService;
            _remoteVstService      = remoteVstService;
            _globalService         = globalService;
            _globalFrontendService = globalFrontendService;
            _presetDataPersister   = presetDataPersisterService;

            Plugin = plugin;

            PresetsView = (ListCollectionView)CollectionViewSource.GetDefaultView(Plugin.Presets);
            PresetsView.IsLiveSorting   = false;
            PresetsView.IsLiveFiltering = false;

            Title = $"{plugin.PluginName}: Presets";

            GlobalCharacteristicCollection =
                (ListCollectionView)CollectionViewSource.GetDefaultView(globalService.GlobalCharacteristics);
            GlobalCharacteristicCollection.SortDescriptions.Add(
                new SortDescription(nameof(Characteristic.EffectiveCharacteristicName), ListSortDirection.Ascending));
            GlobalCharacteristicCollection.IsLiveSorting   = false;
            GlobalCharacteristicCollection.IsLiveFiltering = false;

            GlobalTypeCollection = (ListCollectionView)CollectionViewSource.GetDefaultView(globalService.GlobalTypes);
            GlobalTypeCollection.SortDescriptions.Add(new SortDescription(nameof(Type.EffectiveFullTypeName),
                                                                          ListSortDirection.Ascending));
            GlobalTypeCollection.IsLiveSorting   = false;
            GlobalTypeCollection.IsLiveFiltering = false;

            SelectedPresets.CollectionChanged += SelectedPresetsOnCollectionChanged;
            PreviewNotePlayers = globalService.PreviewNotePlayers;
            RenameBankCommand  = new TaskCommand(OnRenameBankCommandExecute, RenameBankCommandCanExecute);
            AddBankCommand     = new TaskCommand(OnAddBankCommandExecute, AddBankCommandCanExecute);
            DeleteBankCommand  = new TaskCommand(OnDeleteBankCommandExecute, DeleteBankCommandCanExecute);

            LoadPluginCommand = new TaskCommand(OnLoadPluginCommandExecute, LoadPluginCommandCanExecute);
            LoadPresetCommand = new TaskCommand(OnLoadPresetCommandExecute, LoadPresetCommandCanExecute);
            ShowEditorCommand = new TaskCommand(OnShowEditorCommandExecute, ShowEditorCommandCanExecute);

            AddToExportListCommand = new TaskCommand(OnAddToExportListCommandExecute, AddToExportListCommandCanExecute);


            Revert = new Command <string>(OnRevertExecute);
        }
示例#5
0
        public TypesCharacteristicsViewModel(DataPersisterService dataPersisterService, GlobalService globalService,
                                             IUIVisualizerService visualizerService, IViewModelFactory viewModelFactory,
                                             CharacteristicsService characteristicsService, TypesService typesService,
                                             IAdvancedMessageService advancedMessageService)
        {
            _dataPersisterService   = dataPersisterService;
            _visualizerService      = visualizerService;
            _viewModelFactory       = viewModelFactory;
            _globalService          = globalService;
            _characteristicsService = characteristicsService;
            _typesService           = typesService;
            _advancedMessageService = advancedMessageService;

            Title = "Edit Types / Characteristics";

            AddTypeCommand       = new TaskCommand(OnAddTypeCommandExecuteAsync);
            EditTypeCommand      = new TaskCommand(OnEditTypeCommandExecuteAsync, EditTypeCanExecute);
            DeleteTypeCommand    = new TaskCommand(OnDeleteTypeCommandExecuteAsync, DeleteTypeCanExecute);
            ShowTypeUsageCommand = new TaskCommand(OnShowTypeUsageCommandExecuteAsync, ShowTypeUsageCanExecute);

            AddCharacteristicCommand  = new TaskCommand(OnAddCharacteristicCommandExecuteAsync);
            EditCharacteristicCommand =
                new TaskCommand(OnEditCharacteristicCommandExecuteAsync, EditCharacteristicCanExecute);
            DeleteCharacteristicCommand =
                new TaskCommand(OnDeleteCharacteristicCommandExecuteAsync, DeleteCharacteristicCanExecute);
            ShowCharacteristicUsageCommand = new TaskCommand(OnShowCharacteristicUsageCommandExecuteAsync,
                                                             ShowCharacteristicUsageCanExecute);

            SelectedTypes.CollectionChanged           += SelectedTypesOnCollectionChanged;
            SelectedCharacteristics.CollectionChanged += SelectedCharacteristicsOnCollectionChanged;

            Types           = _typesService.TypeUsages;
            Characteristics = _characteristicsService.CharacteristicUsages;

            _characteristicsService.UpdateCharacteristicsUsages();
            _typesService.UpdateTypesUsages();

            TypesView = (ListCollectionView)CollectionViewSource.GetDefaultView(_typesService.TypeUsages);
            TypesView.IsLiveSorting   = false;
            TypesView.IsLiveFiltering = false;

            CharacteristicsView =
                (ListCollectionView)CollectionViewSource.GetDefaultView(
                    _characteristicsService.CharacteristicUsages);
            CharacteristicsView.IsLiveSorting   = false;
            CharacteristicsView.IsLiveFiltering = false;
        }
示例#6
0
        protected AbstractScanPluginsCommandContainer(string command, ICommandManager commandManager,
                                                      IServiceLocator serviceLocator)
            : base(command, commandManager, serviceLocator)
        {
            _messageService             = ServiceLocator.ResolveType <IAdvancedMessageService>();
            _applicationService         = ServiceLocator.ResolveType <IApplicationService>();
            _dispatcherService          = ServiceLocator.ResolveType <IDispatcherService>();
            _commandManager             = commandManager;
            _dataPersisterService       = ServiceLocator.ResolveType <DataPersisterService>();
            _presetDataPersisterService = ServiceLocator.ResolveType <PresetDataPersisterService>();
            ;
            _resourceGeneratorService =
                ServiceLocator.ResolveType <INativeInstrumentsResourceGeneratorService>();
            _pluginService    = ServiceLocator.ResolveType <PluginService>();
            GlobalService     = ServiceLocator.ResolveType <GlobalService>();
            _remoteVstService = ServiceLocator.ResolveType <RemoteVstService>();

            GlobalService.Plugins.CollectionChanged += OnPluginsListChanged;
        }
示例#7
0
        public ApplicationService(DataPersisterService dataPersisterService,
                                  IDispatcherService dispatcherService,
                                  ICustomStatusService statusService, IPleaseWaitService pleaseWaitService,
                                  IAdvancedMessageService messageService, GlobalService globalService,
                                  GlobalFrontendService globalFrontendService)
        {
            Argument.IsNotNull(() => statusService);
            Argument.IsNotNull(() => pleaseWaitService);
            Argument.IsNotNull(() => messageService);

            _pleaseWaitService          = pleaseWaitService;
            _statusService              = statusService;
            _messageService             = messageService;
            _dispatcherService          = dispatcherService;
            _dataPersisterService       = dataPersisterService;
            _globalService              = globalService;
            _globalFrontendService      = globalFrontendService;
            _applicationOperationStatus = new ApplicationOperationStatus();

            _updateWorkerPoolStatsTimer = new Timer(500);
            _updateDatabaseSizeTimer    = new Timer(2000);
        }