Beispiel #1
0
 public void DisposeAndExit()
 {
     _backup.Dispose();
     _trayIcon.Click -= TrayIconClick;
     _trayIcon.Dispose();
     Shutdown();
 }
Beispiel #2
0
        private void CancelFutureTasks()
        {
            BackupTimer?.Dispose();
            BackupTimer = null;

            try
            {
                CancelToken?.Cancel();
            }
            catch
            {
            }
        }
Beispiel #3
0
        private void UpdateTimerInternal(Timer newBackupTimer, bool discardIfDisabled)
        {
            if (Disposed)
            {
                newBackupTimer.Dispose();
                return;
            }

            if (discardIfDisabled && BackupTimer == null)
            {
                newBackupTimer.Dispose();
                return;
            }

            BackupTimer?.Dispose();
            BackupTimer = newBackupTimer;
        }
Beispiel #4
0
        public void UpdateTimer(Timer newBackupTimer, bool discardIfDisabled = false)
        {
            using (UpdateBackupTask())
            {
                if (Disposed)
                {
                    return;
                }

                if (discardIfDisabled && BackupTimer == null)
                {
                    return;
                }

                BackupTimer?.Dispose();
                BackupTimer = newBackupTimer;
            }
        }
Beispiel #5
0
        public void UpdateTimer(Timer newBackupTimer, bool discardIfDisabled = false)
        {
            _updateTimerSemaphore.Wait();

            try
            {
                if (discardIfDisabled && BackupTimer == null)
                {
                    return;
                }

                BackupTimer?.Dispose();
                BackupTimer = newBackupTimer;
            }
            finally
            {
                _updateTimerSemaphore.Release();
            }
        }
Beispiel #6
0
        public void DisableFutureBackups()
        {
            _updateTimerSemaphore.Wait();

            try
            {
                BackupTimer?.Dispose();
                BackupTimer = null;

                try
                {
                    CancelToken?.Cancel();
                }
                catch {}
            }
            finally
            {
                _updateTimerSemaphore.Release();
            }
        }
Beispiel #7
0
 public void DisableFutureBackups()
 {
     Disposed = true;
     BackupTimer?.Dispose();
 }