Ejemplo n.º 1
0
        private void MenuItem_Load_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openDlg = new OpenFileDialog();

            openDlg.DefaultExt = ".json";
            openDlg.Filter     = "Dialog files (*.json)|*.json";

            Nullable <bool> result = openDlg.ShowDialog();

            if (result == true)
            {
                Area.ClearLayout();
                mGraph.Clear();

                mOpenFile = openDlg.FileName;
                Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(openDlg.FileName));
                var page = DialogLoader.Load(openDlg.FileName);
                BuildGraph(page, null);
                mRootNode = page.Vertex;

                Area.GenerateGraph(true, true);
                zoomctrl.ZoomToFill();
                Area.RelayoutGraph();
            }
        }
Ejemplo n.º 2
0
 private void MenuItem_Save_Click(object sender, RoutedEventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(mOpenFile))
     {
         var page = mRootNode.Page as DialogPage;
         DialogLoader.Save(page, mOpenFile);
     }
     else
     {
         MenuItem_SaveAs_Click(sender, e);
     }
 }
Ejemplo n.º 3
0
        private void MenuItem_SaveAs_Click(object sender, RoutedEventArgs e)
        {
            var page = mRootNode.Page as DialogPage;

            SaveFileDialog saveDlg = new SaveFileDialog();

            saveDlg.FileName   = mOpenFile;
            saveDlg.DefaultExt = ".json";
            saveDlg.Filter     = "Dialog files (*.json)|*.json";

            Nullable <bool> result = saveDlg.ShowDialog();

            if (result == true)
            {
                DialogLoader.Save(page, saveDlg.FileName);
                mOpenFile = saveDlg.FileName;
            }
        }
Ejemplo n.º 4
0
        void DialogWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
            {
                var json = args[1];
                Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(json));
                this.Title += " " + System.IO.Path.GetFileName(json);



                if (File.Exists(json))
                {
                    Area.ClearLayout();
                    mGraph.Clear();
                    var page = DialogLoader.Load(json);
                    BuildGraph(page, null);
                    mRootNode = page.Vertex;

                    Area.GenerateGraph(true, true);
                    zoomctrl.ZoomToFill();
                    Area.RelayoutGraph();
                }
                else
                {
                    SetupGraph();


                    DialogPage page = new DialogPage(this);
                    mRootNode            = createNewVertex(page);
                    mRootNode.Page.Label = "Starting Point";
                    AddNode(mRootNode);



                    Area.GenerateGraph(true, true);
                    zoomctrl.ZoomToFill();
                    Area.RelayoutGraph();
                }

                mOpenFile = json;
            }
        }