/// <summary>
        /// Creates a new instance.
        /// </summary>
        public DiagramToolApplication(IRoslynModelProvider roslynModelProvider, IHostUiServices hostUiServices)
        {
            _visualizationService = CreateVisualizationService(roslynModelProvider, hostUiServices);
            _diagramId            = _visualizationService.CreateDiagram(AppDefaults.MinZoom, AppDefaults.MaxZoom, AppDefaults.InitialZoom);

            RoslynModelService.HideTrivialBaseNodes = AppDefaults.HideTrivialBaseNodes;

            ApplicationUiService.ImageExportDpi           = Dpi.Dpi150;
            ApplicationUiService.DiagramNodeInvoked      += OnShowSourceRequested;
            ApplicationUiService.ShowModelItemsRequested += OnShowItemsRequestedAsync;
        }
        public DiagramToolApplication(
            [NotNull] IVisualizationService visualizationService,
            [NotNull] IRoslynWorkspaceProvider roslynWorkspaceProvider,
            [NotNull] IRoslynBasedModelService roslynBasedModelService,
            [NotNull] IHostUiService hostUiService)
        {
            var diagramId = visualizationService.CreateDiagram();

            DiagramService = visualizationService.GetDiagramService(diagramId);

            DiagramWindowService = (IDiagramWindowService)visualizationService.GetDiagramUiService(diagramId);
            DiagramWindowService.ImageExportDpi           = Dpi.Dpi150;
            DiagramWindowService.DiagramNodeInvoked      += OnShowSourceRequested;
            DiagramWindowService.ShowModelItemsRequested += OnShowItemsRequested;

            RoslynWorkspaceProvider = roslynWorkspaceProvider;
            RoslynBasedModelService = roslynBasedModelService;
            HostUiService           = hostUiService;
        }
Esempio n. 3
0
        public MainWindowViewModel([NotNull] IVisualizationService visualizationService)
        {
            SelectedDpi = 300;

            _testModelService = (ITestModelService)visualizationService.GetModelService();
            var diagramId = visualizationService.CreateDiagram(minZoom: 0.2, maxZoom: 5, initialZoom: 1);

            _diagramService = visualizationService.GetDiagramService(diagramId);
            _uiService      = (IWpfUiService)visualizationService.GetUiService(diagramId);

            _uiService.DiagramNodeInvoked      += i => Debug.WriteLine($"DiagramNodeInvoked: {i}");
            _uiService.ShowModelItemsRequested += OnShowModelItemsRequested;

            AddCommand             = new DelegateCommand(AddShapes);
            RemoveCommand          = new DelegateCommand(RemoveShapes);
            ZoomToContentCommand   = new DelegateCommand(ZoomToContent);
            CopyToClipboardCommand = new DelegateCommand(CopyToClipboardAsync);

            PopulateModel(_testModelService);
        }