protected async Task <Maybe <IModelNode> > TryAddCurrentSymbolToDiagramAsync()
        {
            var maybeSymbol = await RoslynWorkspaceProvider.TryGetCurrentSymbolAsync();

            if (!maybeSymbol.HasValue)
            {
                return(Maybe <IModelNode> .Nothing);
            }

            var modelNode = RoslynBasedModelService.GetOrAddNode(maybeSymbol.Value);

            DiagramService.AddNode(modelNode.Id);
            return(Maybe.Create(modelNode));
        }
Beispiel #2
0
        public override async Task <bool> IsEnabledAsync()
        {
            var maybeSymbol = await RoslynWorkspaceProvider.TryGetCurrentSymbolAsync();

            return(maybeSymbol.Select(RoslynBasedModelService.CanAddSymbol).Match(i => i, () => false));
        }
 public override async Task <bool> IsEnabledAsync() => (await RoslynWorkspaceProvider.TryGetCurrentSymbolAsync()).HasValue;