private void CreateUninstallerRegistryEntryCallback(Action <UpdateStatus, int> progressCallback, Action <Exception> errCallback, string installPath) { if (_updateManager == null) { return; // Disposing } _updateManager.Dispose(); Log.Info("Squirrel: Launching new version."); progressCallback(UpdateStatus.Restarting, 100); try { var executablePath = Path.Combine(installPath, "GoToWindow.exe"); if (File.Exists(executablePath)) { Process.Start(executablePath, "--squirrel-firstrunafterupdate"); } Log.Info("Squirrel: Shutting down."); Application.Current.Dispatcher.InvokeAsync(() => Application.Current.Shutdown(1)); } catch (Exception exc) { HandleAsyncError(errCallback, exc); } }
//========================================================= // Interface Implementations //========================================================= #region IDisposeable Implementation protected override void OnDispose() { if (updateManager != null) { updateManager.Dispose(); } updateManager = null; }
public override void Update(double time, bool focused = false) { if (_ex != null) { throw _ex; } if (_needToUpdate && InputSystem.NewKeys.Contains(Key.Enter)) { _statusString = "Updating..."; Task.Run(() => { lock (_lock) { _updateManager.UpdateApp().Wait(); } }).ContinueWith((prevTask) => { lock (_lock) { _statusString = "Restarting"; } }).ContinueWith((prevTask) => Task.Delay(500).Wait()).ContinueWith((prevTask) => { lock (_lock) { _updateManager.Dispose(); _updateManager = null; } UpdateManager.RestartApp(); SceneManager.RemoveScene(this, true); SceneManager.GameWindow.Exit(); }); } if (_continue || InputSystem.NewKeys.Contains(Key.Escape)) { SceneManager.RemoveScene(this, true); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _updateManager.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public void Dispose() => _updateManager.Dispose();
private void Application_Exit(object sender, ExitEventArgs e) { Settings.Save(); _updateManager?.Dispose(); }
public SettingsWindow() { SetExceptionHandlers(); this.ShowActivated = false; logger.Info("App started"); if (Settings.UpgradeRequired) { Settings.Upgrade(); Settings.UpgradeRequired = false; Settings.Save(); } InitializeComponent(); var v = Assembly.GetExecutingAssembly().GetName().Version; Title = $"HotsStats v{v.Major}.{v.Minor}" + (v.Build == 0 ? "" : $".{v.Build}"); if (Settings.SettingsWindowTop <= 0) { WindowStartupLocation = WindowStartupLocation.CenterScreen; } GameModeCombo.ItemsSource = new List <GameMode> { GameMode.QuickMatch, GameMode.HeroLeague, GameMode.TeamLeague }; icon = new System.Windows.Forms.NotifyIcon(); icon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); icon.Visible = false; icon.Click += (o, e) => { Show(); WindowState = WindowState.Normal; icon.Visible = false; }; var mon = new FileMonitor(); mon.BattleLobbyCreated += (o, e) => Dispatcher.BeginInvoke(new Action(() => { ProcessLobbyFile(e.Data); })); mon.RejoinFileCreated += (o, e) => Dispatcher.BeginInvoke(new Action(() => { ProcessRejoinFile(e.Data); })); mon.ReplayFileCreated += (o, e) => Dispatcher.BeginInvoke(new Action(() => { ProcessReplayFile(e.Data); })); mon.StartMonitoring(); hotKey = new HotKey(Key.Tab, KeyModifier.Shift | KeyModifier.NoRepeat); hotKey.Pressed += (o, e) => { if (currentWindow != null) { currentWindow.Visibility = currentWindow.IsVisible ? Visibility.Collapsed : Visibility.Visible; } }; Closed += (o, e) => { Settings.Save(); updateManager?.Dispose(); }; if (!App.Debug && Settings.AutoUpdate) { CheckForUpdates(); } }
public void Dispose() { updateManager?.Dispose(); }