/// <summary> /// Performs the job as a background task /// </summary> /// <param name="arg"></param> public override void ExecuteWork() { DataDictionary.Util.UnlockAllFiles(); try { if (Dictionary != null) { Dictionary.save(); } else { // Save all dictionaries foreach (DataDictionary.Dictionary dictionary in System.Dictionaries) { dictionary.save(); } } } finally { DataDictionary.Util.LockAllFiles(); System.ShouldSave = false; MainWindow.Invoke((MethodInvoker) delegate { MainWindow.UpdateTitle(); }); } }
private void RefreshMainWindow() { DateTime now = DateTime.Now; TimeSpan span = now - LastRefresh; if (span > TimeSpan.FromSeconds(1)) { MainWindow.Invoke((MethodInvoker) delegate { MainWindow.UpdateTitle(); }); LastRefresh = now; } }