private void Save(FullEditor editor, bool forceFilePrompt) { lblProgress.Text = "Saving file..."; editor.Save(forceFilePrompt).ContinueWith(t => { if (t.IsFaulted) lblProgress.Text = t.Exception.Message; else if (t.IsCanceled || !t.Result) lblProgress.Text = ""; else { lblProgress.Text = "File saved"; if (_proxy != null && _proxy.ConnData != null) { SnippetManager.Instance.SetLastQueryByConnection(_proxy.ConnData.ConnectionName, new Snippet() { Action = this.SoapAction, Text = editor.Text }); Properties.Settings.Default.LastConnection = _proxy.ConnData.ConnectionName; Properties.Settings.Default.Save(); Properties.Settings.Default.Reload(); } } UpdateTitle(null); }, TaskScheduler.FromCurrentSynchronizationContext()); }
private void OpenFile(FullEditor control, string path) { lblProgress.Text = "Opening file..."; control.OpenFile(path).ContinueWith(t => { if (t.IsCanceled) lblProgress.Text = ""; else if (t.IsFaulted) lblProgress.Text = t.Exception.Message; else { lblProgress.Text = "File opened"; AddRecentDocument(path); } UpdateTitle(null); }, TaskScheduler.FromCurrentSynchronizationContext()); }