Ejemplo n.º 1
0
        private async Task InitializeInjectorModeAsync()
        {
            _mode = ModeType.Injector;
            _scheduler?.Dispose();

            if (_package == null)
            {
                _package = await _findLastEditedGamePackageQuery.FindAsync();

                _gamePackages = await _findGamesQuery.FindAllAsync();
            }

            _injectionViewModel = new InjectionViewModel(this, _package);
            _scheduler          = new BlockingScheduler(() => _runner.Run(async() => await EstimateInjectorStateAsync(true)), TaskInterval);

            PluginViewModel = new PluginViewModel(
                _pluginFactory.Create(_package),
                _publisher,
                _navigationService,
                _componentViewModelFactory);

            await EstimateInjectorStateAsync();

            Validate();
            EditPluginMainSettings();
            StartScheduler();
        }
Ejemplo n.º 2
0
        private async Task EstimateCommunicatorStateAsync(bool lockingEnabled = false)
        {
            ProxySettings proxySettings = null;
            await _actionBuilder.Dispatch(new LoadProxySettingsCommand())
            .CompleteFor <ProxySettingsLoadedNotification>((context, @event) => proxySettings = @event.ProxySettings)
            .CompleteFor <ErrorOccuredNotification>(async(context, @event) => await PublishUpdateStatusEventAsync(StatusType.Failed, "CommunicationError"))
            .OnTimeout(async() => await PublishTimeoutEventAsync())
            .Execute();

            using (await GetBlockingScope(lockingEnabled))
            {
                if ((_mode == ModeType.Injector) || (proxySettings == null))
                {
                    await InitializeInjectorModeAsync();

                    RebindGames();
                    RebindGameProfiles();
                    Rebind();

                    return;
                }

                if (_stateEqualityComparer.Equals(_proxySettings, proxySettings))
                {
                    EstimateCommunicatorActivationState(proxySettings.ActivationStatus);
                    return;
                }

                await PublishUpdateStatusEventAsync(StatusType.Ok, "CommunicationEstablished");

                _status        = null;
                _proxySettings = proxySettings;

                PluginViewModel = new PluginViewModel(
                    _pluginFactory.Create(proxySettings),
                    _publisher,
                    _navigationService,
                    _componentViewModelFactory);

                _injectionViewModel.GameName        = proxySettings.GameName;
                _injectionViewModel.GameProfileName = proxySettings.GameProfileName;

                GameFilePath       = proxySettings.GameFilePath;
                ProxyDirectoryPath = proxySettings.ProxyDirectoryPath;
                LogsDirectoryPath  = proxySettings.LogsDirectoryPath;
                PluginType         = proxySettings.PluginType;

                EditPluginMainSettings();
                EstimateCommunicatorActivationState(proxySettings.ActivationStatus);
                Validate();
            }
        }
Ejemplo n.º 3
0
        public PluginEffectViewModel(
            IEffect effect,
            PluginViewModel viewModel,
            ComponentViewModelFactory componentViewModelFactory)
        {
            _effect    = effect;
            _viewModel = viewModel;

            Component          = componentViewModelFactory.Create(_effect.Component);
            Component.Changed += OnPropertyChanged;
            MoveDownCommand    = new ActionCommand(async() => await MoveDownAsync(), () => true);
            MoveUpCommand      = new ActionCommand(async() => await MoveUpAsync(), () => true);
            RemoveCommand      = new ActionCommand(async() => await RemoveAsync(), () => true);
        }
Ejemplo n.º 4
0
 private void Validate()
 {
     PluginViewModel.Validate();
     Rebind();
 }