private bool IsItemAlreadyOpened(DatabaseTableSolutionItem fakeSolutionItem, out ISolutionItemDocument document) { document = null !; if (sessionService.IsOpened && !sessionService.IsPaused && documentManager.Value.TryFindDocument(fakeSolutionItem) is { } openedDocument) { document = openedDocument; return(true); } return(false); }
public async Task Save(ISolutionItemDocument document) { if (document.Save?.CanExecute(null) ?? false) { if (document is IBeforeSaveConfirmDocument confirm) { if (await confirm.ShallSavePreventClosing()) { return; } } if (document.Save is IAsyncCommand async) { await async.ExecuteAsync(); } else { document.Save.Execute(null); } await sessionService.UpdateQuery(document); if (CanReloadRemotely) { await ReloadSolutionRemotelyTask(document.SolutionItem); } } else { if (CanSaveAndReloadRemotely) { await SaveAndReloadSolutionTask(document.SolutionItem); await sessionService.UpdateQuery(document); } else if (CanSaveToDatabase) { await SaveSolutionToDatabaseTask(document); } } }
public async Task SaveSolutionToDatabaseTask(ISolutionItemDocument document) { await SaveSolutionToDatabaseTask(document.SolutionItem, document, (_, doc) => doc !.GenerateQuery()); await sessionService.UpdateQuery(document); }