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); }
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"); }
public void ForceSaveNow() { LoggerSingleton.Inst.Trace("HierarchyConfigCache", $"Force Save"); invSave.CancelPendingRequests(); SaveDirect(); }
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 }
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; } }
private void SearchTextChanged() { _invSearch.CancelPendingRequests(); SearchTextInternal = SearchText; }
public void ForceSaveNow() { invSave.CancelPendingRequests(); SaveDirect(); }