private async Task ShowProgressAndUpdateModelAsync()
        {
            using (var progressDialog = await UiService.CreateProgressDialogAsync("Updating model nodes:"))
            {
                await progressDialog.ShowWithDelayAsync();

                try
                {
                    await UpdateModelAsync(progressDialog.CancellationToken, progressDialog.Progress);
                }
                catch (OperationCanceledException)
                {
                }
            }
        }
예제 #2
0
        private async Task <IReadOnlyList <IDiagramNode> > ShowProgressAndAddItemsAsync(IReadOnlyList <IRoslynModelNode> modelEntities)
        {
            IReadOnlyList <IDiagramNode> diagramNodes = null;

            using (var progressDialog = await UiService.CreateProgressDialogAsync("Adding model items:", modelEntities.Count))
            {
                await progressDialog.ShowWithDelayAsync();

                try
                {
                    diagramNodes = await ShowEntitiesAsync(modelEntities, progressDialog.CancellationToken, progressDialog.Progress);
                }
                catch (OperationCanceledException)
                {
                }
            }

            return(diagramNodes);
        }
예제 #3
0
        private async Task <IReadOnlyList <IDiagramNode> > ExtendModelAndDiagramAsync(IRoslynModelNode modelNode)
        {
            IReadOnlyList <IDiagramNode> diagramNodes = null;

            using (var progressDialog = await UiService.CreateProgressDialogAsync("Extending model with entities:"))
            {
                await progressDialog.ShowWithDelayAsync();

                try
                {
                    await ExtendModelWithRelatedEntitiesAsync(modelNode, progressDialog.CancellationToken, progressDialog.Progress);

                    progressDialog.Reset("Adding diagram nodes:");

                    diagramNodes = await ExtendDiagramAsync(modelNode, progressDialog.CancellationToken, progressDialog.Progress);
                }
                catch (OperationCanceledException)
                {
                }
            }

            return(diagramNodes);
        }
        protected async Task CreateAndProcessDiagramImageAsync(Action <BitmapSource> imageProcessingAction, string imageProcessingMessage)
        {
            // Using int.MaxValue for max progress because the real max value is not yet known.
            using (var progressDialog = await UiService.CreateProgressDialogAsync("Generating image..", int.MaxValue))
            {
                progressDialog.ShowProgressNumber = false;
                await progressDialog.ShowWithDelayAsync();

                try
                {
                    var bitmapSource = await UiService.CreateDiagramImageAsync(progressDialog.CancellationToken,
                                                                               progressDialog.Progress, progressDialog.MaxProgress);

                    if (bitmapSource != null)
                    {
                        progressDialog.Reset(imageProcessingMessage, showProgressNumber: false);
                        await Task.Factory.StartSTA(() => imageProcessingAction(bitmapSource), progressDialog.CancellationToken);
                    }
                }
                catch (OperationCanceledException)
                {
                }
            }
        }