Пример #1
0
        private void OpenSolutionDlg()
        {
            var dlg = new Microsoft.Win32.OpenFileDialog()
            {
                Filter = "Solution (*.txt)|*.txt|All Files (*.*)|*.*",
                Title  = "Open Solution"
            };

            var res = dlg.ShowDialog();

            if (res == true)
            {
                var fileName = dlg.FileName;
                var canvas   = Editor.Context.CurrentCanvas;

                ModelEditor.Clear(canvas);

                TreeSolution solution = Editor.OpenSolution(fileName);

                if (solution != null)
                {
                    UpdateSolutionState(false, fileName);

                    var tree = Editor.Context.CurrentTree;

                    Editor.Clear(tree, canvas, canvas.GetCounter());
                    Editor.Parse(tree, solution, canvas.GetCounter(), Editor.Context.CreateSolution);
                }
            }
        }
Пример #2
0
        void Item_Selected(object sender, RoutedEventArgs e)
        {
            var item  = sender as ListBoxItem;
            var model = item.Tag as string;

            ModelEditor.Clear(Editor.Context.CurrentCanvas);
            ModelEditor.Parse(model,
                              Editor.Context.CurrentCanvas,
                              Editor.Context.DiagramCreator,
                              0, 0,
                              false, true, false, true);
        }
Пример #3
0
        private void NewSolution()
        {
            UpdateSolutionState(false, null);
            SetProperties(DiagramProperties.Default);
            UpdateDiagramGrid(false);

            ModelEditor.Clear(Editor.Context.CurrentCanvas);

            Editor.Clear(Editor.Context.CurrentTree,
                         Editor.Context.CurrentCanvas,
                         Editor.Context.CurrentCanvas.GetCounter());

            TreeEditor.CreateDefaultSolution(Editor.Context.CurrentTree,
                                             Editor.Context.CreateSolution,
                                             Editor.Context.CreateProject,
                                             Editor.Context.CreateDiagram,
                                             Editor.Context.CurrentCanvas.GetCounter());

            UpdateEditors();
        }