Пример #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 PluginToolsDisablePluginsCommandContainer(ICommandManager commandManager,
                                                  IServiceLocator serviceLocator)
     : base(Commands.PluginTools.DisablePlugins, commandManager, serviceLocator)
 {
     _dataPersisterService = ServiceLocator.ResolveType <DataPersisterService>();
     _globalFrontendService.SelectedPlugins.CollectionChanged += OnSelectedPluginsListChanged;
 }
Пример #3
0
        static void Main(string[] args)
        {
            var sw = new Stopwatch();

            var dp = new DataPersisterService();

            dp.Load();


            sw.Start();
            Type.GlobalTypes.BeginEdit();
            Characteristic.GlobalCharacteristics.BeginEdit();

            foreach (var plugin in dp.Plugins)
            {
                plugin.BeginEdit();
            }
            Console.WriteLine("BeginEdit: " + sw.ElapsedMilliseconds + "ms");

            sw.Restart();

            Type.GlobalTypes.CancelEdit();
            Characteristic.GlobalCharacteristics.CancelEdit();

            foreach (var plugin in dp.Plugins)
            {
                plugin.CancelEdit();
            }
            Console.WriteLine("CancelEdit: " + sw.ElapsedMilliseconds + "ms");
        }
 public ApplicationApplyConfigurationCommandContainer(ICommandManager commandManager,
                                                      IServiceLocator serviceLocator)
     : base(Commands.Application.ApplyConfiguration, commandManager, serviceLocator)
 {
     _globalService        = ServiceLocator.ResolveType <GlobalService>();
     _dataPersisterService = ServiceLocator.ResolveType <DataPersisterService>();
     _commandManager       = commandManager;
 }
Пример #5
0
 public PluginRefreshPluginsCommandContainer(ICommandManager commandManager,
                                             IServiceLocator serviceLocator)
     : base(Commands.Plugin.RefreshPlugins, commandManager, serviceLocator)
 {
     _pluginService        = ServiceLocator.ResolveType <PluginService>();
     _applicationService   = ServiceLocator.ResolveType <IApplicationService>();
     _globalService        = ServiceLocator.ResolveType <GlobalService>();
     _dataPersisterService = ServiceLocator.ResolveType <DataPersisterService>();
 }
Пример #6
0
 public PresetExportDoExportCommandContainer(ICommandManager commandManager,
                                             IServiceLocator serviceLocator)
     : base(Commands.PresetExport.DoExport, commandManager, serviceLocator)
 {
     _presetDataPersisterService = ServiceLocator.ResolveType <PresetDataPersisterService>();
     _applicationService         = ServiceLocator.ResolveType <IApplicationService>();
     _remoteVstService           = ServiceLocator.ResolveType <RemoteVstService>();
     _dataPersisterService       = ServiceLocator.ResolveType <DataPersisterService>();
     _globalService = ServiceLocator.ResolveType <GlobalService>();
 }
 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);
        }
Пример #9
0
        public VstService(IApplicationService applicationService, GlobalService globalService,
                          DataPersisterService dataPersister, PresetDataPersisterService presetDataPersisterService)
        {
            Argument.IsNotNull(() => applicationService);
            Argument.IsNotNull(() => dataPersister);
            Argument.IsNotNull(() => presetDataPersisterService);

            _applicationService         = applicationService;
            _presetDataPersisterService = presetDataPersisterService;
            _dataPersister = dataPersister;
            _globalService = globalService;

            Plugins = _globalService.Plugins;
        }
Пример #10
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;
        }
        protected AbstractReportPluginsCommandContainer(string command, ICommandManager commandManager,
                                                        IServiceLocator serviceLocator)
            : base(command, commandManager, serviceLocator)
        {
            _licenseService       = serviceLocator.ResolveType <ILicenseService>();
            _applicationService   = serviceLocator.ResolveType <IApplicationService>();
            _dataPersisterService = serviceLocator.ResolveType <DataPersisterService>();
            GlobalService         = serviceLocator.ResolveType <GlobalService>();
            GlobalFrontendService = Catel.IoC.ServiceLocator.Default.ResolveType <GlobalFrontendService>();

            var wrapper = new ChangeNotificationWrapper(GlobalService.Plugins);

            wrapper.CollectionItemPropertyChanged += OnPluginItemPropertyChanged;
            wrapper.CollectionChanged             += OnPluginListChanged;

            ReportAll = false;
        }
Пример #12
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;
        }
        public HelpLinkMessageBoxViewModel(IMessageService messageService, IClipboardService clipboardService,
                                           GlobalService globalService, DataPersisterService dataPersisterService)
        {
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => clipboardService);

            _messageService       = messageService;
            _clipboardService     = clipboardService;
            _globalService        = globalService;
            _dataPersisterService = dataPersisterService;

            CopyToClipboard = new Command(OnCopyToClipboardExecute);

            OkCommand     = new TaskCommand(OnOkCommandExecuteAsync);
            YesCommand    = new TaskCommand(OnYesCommandExecuteAsync);
            NoCommand     = new TaskCommand(OnNoCommandExecuteAsync);
            CancelCommand = new TaskCommand(OnCancelCommandExecuteAsync);
            EscapeCommand = new TaskCommand(OnEscapeCommandExecuteAsync);

            Result = MessageResult.None;
        }
Пример #14
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);
        }
Пример #15
0
 public Ef6MigrationService(DataPersisterService dataPersister, PresetDataPersisterService presetDataPersister)
 {
     _dataPersister       = dataPersister;
     _presetDataPersister = presetDataPersister;
 }
 public RefreshPluginsCommand(IServiceLocator serviceLocator) : base(serviceLocator)
 {
     _pluginService        = ServiceLocator.ResolveType <PluginService>();
     _dataPersisterService = ServiceLocator.ResolveType <DataPersisterService>();
 }