Example #1
0
 public void CreateDiagram()
 {
     CreateDiagram(new DiagramModel());
     if (CurrentDiagrams.Count == 1 && CurrentDiagrams.First().Nodes.Count == 0)
     {
         CurrentProject.IsDirty = false;
     }
 }
Example #2
0
        public void LoadProject(ProjectModel project, bool autoOpenDiagram = false)
        {
            if (CloseProject())
            {
                CurrentProject = project;
                if (CurrentProject == null)
                {
                    return;
                }

                try
                {
                    CurrentProjectChanged?.Invoke();
                    CurrentProject.IsDirty = false;
                    if (autoOpenDiagram && CurrentDiagrams.Any())
                    {
                        CurrentDiagrams.First().IsOpen = true;
                    }
                    else if (autoOpenDiagram)
                    {
                        CreateDiagram();
                    }
                }
                catch
                {
                    // TODO: Make async
                    DownloadProjectDependencies().Wait();
                    CurrentProjectChanged?.Invoke();
                    CurrentProject.IsDirty = false;
                    if (autoOpenDiagram && CurrentDiagrams.Any())
                    {
                        CurrentDiagrams.First().IsOpen = true;
                    }
                }
            }
        }
Example #3
0
 private void OnCurrentProjectChanged()
 {
     Diagrams.Clear();
     CurrentDiagrams?.ForEach(CreateDiagramViewModel);
 }