private async Task OnCheckForUpdatesExecuteAsync() { UpdateCustomChannels(); var result = await _updateService.CheckForUpdatesAsync(new SquirrelContext()); IsUpdateAvailable = result.IsUpdateInstalledOrAvailable; }
public async Task GoAsync() { AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; // Attempt to restore user settings - this is required because after an update any // user settings will have been lost due to Squirrel changing the app directory // with each update _settingsService.RestoreSettings(); _mainWindow.Show(); await _updateService.CheckForUpdatesAsync(); }
public async Task GoAsync() { AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; // Attempt to restore user settings - this is required because after an update any // user settings will have been lost due to Squirrel changing the app directory // with each update _settingsService.RestoreSettings(); _itemFilterScriptDirectoryService.PromptForFilterScriptDirectoryIfRequired(); _mainWindow.Show(); // If there were scripts open the last time the application was closed, reopen them if (!string.IsNullOrWhiteSpace(Settings.Default.LastOpenScripts)) { await _scriptLoadingService.LoadScriptsAsync(Settings.Default.LastOpenScripts.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); } await _updateService.CheckForUpdatesAsync(); }
private async void OnStartup() { _updateService.Init(Constants.UpdateUrl, Constants.AssemblyName, delegate(FileInfo path, bool isManaged) { if (isManaged) { _ = Process.Start(path.FullName, "/SILENT /NOCANCEL"); //INNO //_ = Process.Start(path.FullName, "/qr"); //Advanced Installer } else { // move installer helper var basedir = new DirectoryInfo(Path.GetDirectoryName(System.AppContext.BaseDirectory)); var shippedInstaller = new FileInfo(Path.Combine(basedir.FullName, "lib", Constants.UpdaterName)); var newPath = Path.Combine(ISettingsManager.GetAppData(), Constants.UpdaterName); try { shippedInstaller.MoveTo(newPath, true); } catch (Exception) { _loggerService.Error("Could not initialize auto-installer."); return; } // start installer helper var psi = new ProcessStartInfo { FileName = "CMD.EXE", Arguments = $"/K {newPath} install -i \"{path}\" -o \"{basedir.FullName}\" -r {Constants.AppName}" }; var p = Process.Start(psi); } Application.Current.Shutdown(); }); await _updateService.CheckForUpdatesAsync(); }
/// <summary> /// Class constructor /// </summary> public AppViewModel( IProjectManager projectManager, ILoggerService loggerService, IGameControllerFactory gameControllerFactory, IUpdateService updateService, ISettingsManager settingsManager, INotificationService notificationService, IRecentlyUsedItemsService recentlyUsedItemsService ) { _updateService = updateService; _projectManager = projectManager; _loggerService = loggerService; _gameControllerFactory = gameControllerFactory; _settingsManager = settingsManager; _notificationService = notificationService; _recentlyUsedItemsService = recentlyUsedItemsService; #region commands ShowLogCommand = new RelayCommand(ExecuteShowLog, CanShowLog); ShowProjectExplorerCommand = new RelayCommand(ExecuteShowProjectExplorer, CanShowProjectExplorer); //ShowImportUtilityCommand = new RelayCommand(ExecuteShowImportUtility, CanShowImportUtility); ShowPropertiesCommand = new RelayCommand(ExecuteShowProperties, CanShowProperties); ShowAssetsCommand = new RelayCommand(ExecuteAssetBrowser, CanShowAssetBrowser); //ShowVisualEditorCommand = new RelayCommand(ExecuteVisualEditor, CanShowVisualEditor); //ShowAudioToolCommand = new RelayCommand(ExecuteAudioTool, CanShowAudioTool); //ShowVideoToolCommand = new RelayCommand(ExecuteVideoTool, CanShowVideoTool); //ShowCodeEditorCommand = new RelayCommand(ExecuteCodeEditor, CanShowCodeEditor); ShowImportExportToolCommand = new RelayCommand(ExecuteImportExportTool, CanShowImportExportTool); //ShowPackageInstallerCommand = new RelayCommand(ExecuteShowInstaller, CanShowInstaller); OpenFileCommand = new DelegateCommand <FileModel>(async(p) => await ExecuteOpenFile(p), CanOpenFile); PackModCommand = new RelayCommand(ExecutePackMod, CanPackMod); //BackupModCommand = new RelayCommand(ExecuteBackupMod, CanBackupMod); //PublishModCommand = new RelayCommand(ExecutePublishMod, CanPublishMod); NewFileCommand = new DelegateCommand <string>(ExecuteNewFile, CanNewFile); SaveFileCommand = new RelayCommand(ExecuteSaveFile, CanSaveFile); SaveAllCommand = new RelayCommand(ExecuteSaveAll, CanSaveAll); FileSelectedCommand = new DelegateCommand <FileModel>(async(p) => await ExecuteSelectFile(p), CanSelectFile); OpenProjectCommand = ReactiveCommand.CreateFromTask <string, Unit>(OpenProjectAsync); DeleteProjectCommand = ReactiveCommand.Create <string>(DeleteProject); NewProjectCommand = ReactiveCommand.CreateFromTask(NewProjectAsync); #endregion commands OnStartup(); DockedViews = new ObservableCollection <IDockElement> { Log, ProjectExplorer, PropertiesViewModel, AssetBrowserVM, ImportExportToolVM, }; _settingsManager .WhenAnyValue(x => x.UpdateChannel) .Subscribe(_ => { _updateService.SetUpdateChannel((WolvenManager.Installer.Models.EUpdateChannel)_settingsManager.UpdateChannel); Task.Run(() => _updateService.CheckForUpdatesAsync()); }); }