private async void OnCreateGraph()
        {
            IsReady = false;

            Save();

            var request = new AnalysisRequest
            {
                Spec = Document.Text,
                PackagesToAnalyze = PackagesToAnalyze != null?PackagesToAnalyze.ToArray() : null,
                                        OutputFile    = Path.GetTempFileName(),
                                        UsedTypesOnly = UsedTypesOnly,
                                        AllEdges      = AllEdges,
                                        CreateClustersForNamespaces = CreateClustersForNamespaces
            };

            try
            {
                myCTS = new CancellationTokenSource();

                var doc = await AnalysisService.Analyse(request, myCTS.Token);

                myCTS = null;

                if (doc != null)
                {
                    BuildGraph(doc);
                }
            }
            finally
            {
                IsReady = true;
            }
        }
        public ChromelyResponse Run(ChromelyRequest request)
        {
            try {
                // Run analysis
                _service.Analyse(request);

                return(new ChromelyResponse());
            } catch (NotCalibratedException e) {
                Logger.Error(e);

                return(new ErrorResponse(e, NotCalibratedException.Code));
            } catch (Exception e) {
                Logger.Error(e);

                return(new ErrorResponse(e));
            }
        }