예제 #1
0
    public void LoadProject(ClientProtocol clientProtocol, Config config)
    {

      if (InvokeRequired)
      {
        BeginInvoke(new LoadProjectDelegate(LoadProject), new object[] { clientProtocol, config });
      }
      else
      {
        // Close the one selected.
        if (frmFlowChart != null)
          FileCloseProject();

        clientProtocol.Connect("SysCAD10\nConnection: Client");
        config.Syncxxx();

        Refresh();

        frmFlowChart = new FrmFlowChart(this);

        SuspendLayout();
        frmFlowChart.SuspendLayout();
        frmFlowChart.FlowChart.SuspendLayout();
        NavigationTreeView.SuspendLayout();

        frmFlowChart.WindowState = System.Windows.Forms.FormWindowState.Maximized;

        frmFlowChart.MdiParent = this;
        frmFlowChart.Text = clientProtocol.Name;

        frmFlowChart.SetProject(clientProtocol, config, NavigationTreeView);

        ovOverview.Document = frmFlowChart.FlowChart;

        frmFlowChart.FlowChart.SelectionChanged += new SelectionEvent(this.frmFlowChart_fcFlowChart_SelectionChanged);

        graphicPropertyGrid.LinkChanged += frmFlowChart.PropertyGridLinkChanged;
        graphicPropertyGrid.NodeChanged += frmFlowChart.PropertyGridNodeChanged;

        {
          Dictionary<String, Bitmap> modelThumbnails = new Dictionary<String, Bitmap>();
          //Dictionary<String, Bitmap> graphicThumbnails = new Dictionary<String, Bitmap>();

          FlowChart thumbnailFlowchart = new FlowChart();

          foreach (String key in frmFlowChart.State.Config.ModelStencils.Keys)
          {
            ModelStencil stencil = config.ModelStencils[key];
            thumbnailFlowchart.DocExtents = frmFlowChart.FlowChart.ClientToDoc(new System.Drawing.Rectangle(0, 0, 17, 17));
            thumbnailFlowchart.ShadowsStyle = ShadowsStyle.None;
            thumbnailFlowchart.BackColor = System.Drawing.SystemColors.Window;
            thumbnailFlowchart.AntiAlias = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            RectangleF boxRect = thumbnailFlowchart.ClientToDoc(new System.Drawing.Rectangle(1, 1, 13, 13));
            Box box = thumbnailFlowchart.CreateBox(boxRect.X, boxRect.Y, boxRect.Width, boxRect.Height);
            box.Style = BoxStyle.Shape;
            box.Shape = State.GetShapeTemplate(stencil, false, false);
            box.FillColor = System.Drawing.Color.FromArgb(220, 222, 184, 136);
            box.FrameColor = System.Drawing.Color.FromArgb(255, 111, 92, 68);
            box.Locked = true;
            modelThumbnails.Add(key, thumbnailFlowchart.CreateImage());
            thumbnailFlowchart.DeleteObject(box);
          }

          stencilChooser1.PopulateTree(modelThumbnails, config.ModelStencils);
        }

        frmFlowChart.State.ProjectAttached = true;
        SetButtonStates();

        frmFlowChart.Show();

        this.NavigationTreeView.NodeSelectionChange += new System.EventHandler(this.tvNavigation_NodeSelectionChange);
        this.NavigationTreeView.AfterNodePositionChange += new PureComponents.TreeView.TreeView.AfterNodePositionChangeEventHandler(this.tvNavigation_AfterNodePositionChange);
        this.NavigationTreeView.NodeMouseClick += new PureComponents.TreeView.TreeView.NodeMouseClickEventHandler(this.tvNavigation_NodeMouseClick);

        NavigationTreeView.ClearNodeSelection();

        foreach (PureComponents.TreeView.Node node in NavigationTreeView.Nodes)
        {
          node.Select();
          node.Expand();
          SelectSubNodes(node);
        }

        NavigationTreeView.ResumeLayout(true);
        frmFlowChart.FlowChart.ResumeLayout(true);
        frmFlowChart.ResumeLayout(true);
        ResumeLayout(true);

        frmFlowChart.ZoomToVisible();
      }
    }
예제 #2
0
        public void LoadProject(ClientProtocol clientProtocol, Config config)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new LoadProjectDelegate(LoadProject), new object[] { clientProtocol, config });
            }
            else
            {
                // Close the one selected.
                if (frmFlowChart != null)
                {
                    FileCloseProject();
                }

                clientProtocol.Connect("SysCAD10\nConnection: Client");
                config.Syncxxx();

                Refresh();

                frmFlowChart = new FrmFlowChart(this);

                SuspendLayout();
                frmFlowChart.SuspendLayout();
                frmFlowChart.FlowChart.SuspendLayout();
                NavigationTreeView.SuspendLayout();

                frmFlowChart.WindowState = System.Windows.Forms.FormWindowState.Maximized;

                frmFlowChart.MdiParent = this;
                frmFlowChart.Text      = clientProtocol.Name;

                frmFlowChart.SetProject(clientProtocol, config, NavigationTreeView);

                ovOverview.Document = frmFlowChart.FlowChart;

                frmFlowChart.FlowChart.SelectionChanged += new SelectionEvent(this.frmFlowChart_fcFlowChart_SelectionChanged);

                graphicPropertyGrid.LinkChanged += frmFlowChart.PropertyGridLinkChanged;
                graphicPropertyGrid.NodeChanged += frmFlowChart.PropertyGridNodeChanged;

                {
                    Dictionary <String, Bitmap> modelThumbnails = new Dictionary <String, Bitmap>();
                    //Dictionary<String, Bitmap> graphicThumbnails = new Dictionary<String, Bitmap>();

                    FlowChart thumbnailFlowchart = new FlowChart();

                    foreach (String key in frmFlowChart.State.Config.ModelStencils.Keys)
                    {
                        ModelStencil stencil = config.ModelStencils[key];
                        thumbnailFlowchart.DocExtents   = frmFlowChart.FlowChart.ClientToDoc(new System.Drawing.Rectangle(0, 0, 17, 17));
                        thumbnailFlowchart.ShadowsStyle = ShadowsStyle.None;
                        thumbnailFlowchart.BackColor    = System.Drawing.SystemColors.Window;
                        thumbnailFlowchart.AntiAlias    = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                        RectangleF boxRect = thumbnailFlowchart.ClientToDoc(new System.Drawing.Rectangle(1, 1, 13, 13));
                        Box        box     = thumbnailFlowchart.CreateBox(boxRect.X, boxRect.Y, boxRect.Width, boxRect.Height);
                        box.Style      = BoxStyle.Shape;
                        box.Shape      = State.GetShapeTemplate(stencil, false, false);
                        box.FillColor  = System.Drawing.Color.FromArgb(220, 222, 184, 136);
                        box.FrameColor = System.Drawing.Color.FromArgb(255, 111, 92, 68);
                        box.Locked     = true;
                        modelThumbnails.Add(key, thumbnailFlowchart.CreateImage());
                        thumbnailFlowchart.DeleteObject(box);
                    }

                    stencilChooser1.PopulateTree(modelThumbnails, config.ModelStencils);
                }

                frmFlowChart.State.ProjectAttached = true;
                SetButtonStates();

                frmFlowChart.Show();

                this.NavigationTreeView.NodeSelectionChange     += new System.EventHandler(this.tvNavigation_NodeSelectionChange);
                this.NavigationTreeView.AfterNodePositionChange += new PureComponents.TreeView.TreeView.AfterNodePositionChangeEventHandler(this.tvNavigation_AfterNodePositionChange);
                this.NavigationTreeView.NodeMouseClick          += new PureComponents.TreeView.TreeView.NodeMouseClickEventHandler(this.tvNavigation_NodeMouseClick);

                NavigationTreeView.ClearNodeSelection();

                foreach (PureComponents.TreeView.Node node in NavigationTreeView.Nodes)
                {
                    node.Select();
                    node.Expand();
                    SelectSubNodes(node);
                }

                NavigationTreeView.ResumeLayout(true);
                frmFlowChart.FlowChart.ResumeLayout(true);
                frmFlowChart.ResumeLayout(true);
                ResumeLayout(true);

                frmFlowChart.ZoomToVisible();
            }
        }