Beispiel #1
0
    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);
    }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        public async Task SaveSolutionToDatabaseTask(ISolutionItemDocument document)
        {
            await SaveSolutionToDatabaseTask(document.SolutionItem, document, (_, doc) => doc !.GenerateQuery());

            await sessionService.UpdateQuery(document);
        }