public void DisposeAndExit() { _backup.Dispose(); _trayIcon.Click -= TrayIconClick; _trayIcon.Dispose(); Shutdown(); }
private void CancelFutureTasks() { BackupTimer?.Dispose(); BackupTimer = null; try { CancelToken?.Cancel(); } catch { } }
private void UpdateTimerInternal(Timer newBackupTimer, bool discardIfDisabled) { if (Disposed) { newBackupTimer.Dispose(); return; } if (discardIfDisabled && BackupTimer == null) { newBackupTimer.Dispose(); return; } BackupTimer?.Dispose(); BackupTimer = newBackupTimer; }
public void UpdateTimer(Timer newBackupTimer, bool discardIfDisabled = false) { using (UpdateBackupTask()) { if (Disposed) { return; } if (discardIfDisabled && BackupTimer == null) { return; } BackupTimer?.Dispose(); BackupTimer = newBackupTimer; } }
public void UpdateTimer(Timer newBackupTimer, bool discardIfDisabled = false) { _updateTimerSemaphore.Wait(); try { if (discardIfDisabled && BackupTimer == null) { return; } BackupTimer?.Dispose(); BackupTimer = newBackupTimer; } finally { _updateTimerSemaphore.Release(); } }
public void DisableFutureBackups() { _updateTimerSemaphore.Wait(); try { BackupTimer?.Dispose(); BackupTimer = null; try { CancelToken?.Cancel(); } catch {} } finally { _updateTimerSemaphore.Release(); } }
public void DisableFutureBackups() { Disposed = true; BackupTimer?.Dispose(); }