Пример #1
0
        public MainWindowModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;
            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.PlanPackageBegin += SetPackagePlannedState;
            this.Bootstrapper.PlanMsiFeature += SetFeaturePlannedState;
            this.Bootstrapper.PlanComplete += PlanComplete;

            _settingsStorage = new SettingsStorage();
            _settings = _settingsStorage.LoadSettings();

            if (_settings.GtaPath == null)
            {
                _settings.GtaPath = "";
            }

            if (!Util.IsValidGtaFolder(_settings.GtaPath))
            {
                var registryPath = Util.GetGtaInstallPathFromRegistry();
                if (Util.IsValidGtaFolder(registryPath))
                {
                    _settings.GtaPath = registryPath;
                }
                else
                {
                    _settings.GtaPath = "";
                }
            }
            StatusText = "Ready.";
            _updater = new Updater(_settings);
            _updater.ModInstalled += UpdaterOnModInstalled;
            _updater.ScriptHookVInstalled += UpdaterOnScriptHookVInstalled;
            _updater.ScriptHookVRemoved += UpdaterOnScriptHookVRemoved;
            _updater.ModRemoved += UpdaterOnModRemoved;
            _updater.UpdatesChecked += UpdaterOnUpdatesChecked;
        }