Exemplo n.º 1
0
        private void OnClose(EventArgs args)
        {
            try
            {
                _repository.Shutdown();
            }
            catch (Exception e)
            {
                App.Logger.Error("Main", "Shutting down connection failed", e);
                ExceptionDialog.Show(Owner, "Shutting down connection failed.\r\nConnection will be forcefully aborted.", e, string.Empty);
                _repository.KillThread();
            }

            if (Settings.RememberScroll)
            {
                _scrollCache.ForceSaveNow();
            }

            if (Settings.RememberPositionAndSize || Settings.RememberWindowState)
            {
                SettingsHelper.ApplyWindowState(Owner, Settings, Settings.RememberPositionAndSize, Settings.RememberPositionAndSize, Settings.RememberWindowState);
                RequestSettingsSave();
            }

            if (_invSaveSettings.HasPendingRequests())
            {
                _invSaveSettings.CancelPendingRequests();
                SaveSettings();
            }

            Owner.MainWindow_OnClosed(args);
        }
Exemplo n.º 2
0
        public void Shutdown(bool lastSync = true)
        {
            var sw = Stopwatch.StartNew();

            _invSaveNotesLocal.CancelPendingRequests();
            SaveAllDirtyNotes();

            if (lastSync && Notes.Any(n => !n.IsRemoteSaved && !n.IsConflictNote))
            {
                _thread.SyncNowAndStopAsync();
            }
            else
            {
                _thread.StopAsync();
            }

            if (lastSync)
            {
                _dispatcher.Invoke(() => _rawFilesystemRepo.SyncNow());
            }
            _rawFilesystemRepo.Shutdown();

            _lock.Release();
            _lock = null;

            _logger.Trace("Repository", $"SyncThread shutdown took {sw.ElapsedMilliseconds}ms");
        }
Exemplo n.º 3
0
        public void ForceSaveNow()
        {
            LoggerSingleton.Inst.Trace("HierarchyConfigCache", $"Force Save");

            invSave.CancelPendingRequests();
            SaveDirect();
        }
Exemplo n.º 4
0
        public void SyncNow()         // = StartSyncNow, real sync happens asynchronous
        {
            _logger.Info("Repository", "Sync Now");

            _invSaveNotesRemote.CancelPendingRequests();

            _dispatcher.Invoke(() => _rawFilesystemRepo.SyncNow());             //synchron

            _thread.SyncNowAsync();

            CommitToLocalGitBackup();             // without invoker
        }
Exemplo n.º 5
0
        public void Shutdown()
        {
            if (!_enabled)
            {
                return;
            }

            LoggerSingleton.Inst.Debug("RawFolderSync", $"Local folder repository shutdown ('{_path}')");

            try
            {
                _invSyncRequest.CancelPendingRequests();
            }
            catch (Exception e)
            {
                LoggerSingleton.Inst.ShowExceptionDialog("Local folder repository shutdown failed", e);
                _enabled = false;
            }
        }
Exemplo n.º 6
0
 private void SearchTextChanged()
 {
     _invSearch.CancelPendingRequests();
     SearchTextInternal = SearchText;
 }
Exemplo n.º 7
0
 public void ForceSaveNow()
 {
     invSave.CancelPendingRequests();
     SaveDirect();
 }