public ServiceTemporaryWindow(string stencilPath, Dictionary<string, Project> projects, string lastFolder)
    {
      this.lastFolder = lastFolder;

      InitializeComponent();

      addProjectButton.Focus();

      this.Text = "SysCAD.Service (" + Assembly.Load("SysCAD.Service").GetName().Version + ") -- SVN Revision: " + SysCAD.SVNVersion.SVNVersion.version;

      Config config = new Config();
      if (!ServiceConnectCheck(config)) // If service not already there.
      {
        System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
        serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

        BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

        Hashtable ipcProps = new Hashtable();
        ipcProps["portName"] = "SysCAD.Service";
        ipcProps["exclusiveAddressUse"] = false;
        //ipcProps["typeFilterLevel"] = TypeFilterLevel.Full;
        IpcChannel ipcChannel = new IpcChannel(ipcProps, clientProv, serverProv);
        ChannelServices.RegisterChannel(ipcChannel, false);

        logView.LogFile = System.IO.Path.GetTempPath() + "test.log";

        Config.AddProjectHandler addProjectHandler = new Config.AddProjectHandler(AddProject);
        Config.AddProjectAnywayHandler addProjectAnywayHandler = new Config.AddProjectAnywayHandler(AddProjectAnyway);
        configData = new ConfigData();
        configData.Setup(stencilPath, addProjectHandler, addProjectAnywayHandler);

        RemotingServices.Marshal(configData, "Global");

        Dictionary<string, Project> tempProjects = projects;
        
        foreach (Project project in tempProjects.Values)
        {
          AddProject(project);
        }

        this.projects = projects;
      }
    }
Exemple #2
0
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);

      FlowChart flowchart = new FlowChart();

      Config config = new Config();
      if (config.TestUrl(new System.Uri("ipc://SysCAD.Service/Global")))
      {
        config.Syncxxx();

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

        foreach (String key in config.ModelStencils.Keys)
        {
          ModelStencil stencil = config.ModelStencils[key];
          flowchart.DocExtents = flowchart.ClientToDoc(new System.Drawing.Rectangle(0, 0, 17, 17));
          flowchart.ShadowsStyle = ShadowsStyle.None;
          flowchart.BackColor = System.Drawing.SystemColors.Window;
          flowchart.AntiAlias = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
          RectangleF boxRect = flowchart.ClientToDoc(new System.Drawing.Rectangle(1, 1, 13, 13));
          Box box = flowchart.CreateBox(boxRect.X, boxRect.Y, boxRect.Width, boxRect.Height);
          box.Style = BoxStyle.Shape;
          box.Shape = GetShapeTemplate(stencil);
          box.FillColor = System.Drawing.Color.FromArgb(150, System.Drawing.Color.BurlyWood);
          box.FrameColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.BurlyWood);
          box.Locked = true;
          modelThumbnails.Add(key, flowchart.CreateImage());
          flowchart.DeleteObject(box);
        }

        Application.Run(new TestAppForm(modelThumbnails, config.ModelStencils));
      }
    }
Exemple #3
0
    public void Setup(string stencilPath, Config.AddProjectHandler addProject, Config.AddProjectAnywayHandler addProjectAnyway)
    {
      this.addProject = addProject;
      this.addProjectAnyway = addProjectAnyway;

      {
        //int iStencil = 0;
        //LogNote("Srvr : 0 : ModelStencils:");
        String[] files = Directory.GetFiles(stencilPath, "*.modelstencil");
        for (int i = 0; i < files.GetLength(0); i++)
        {
          String fullpath = files[i];

          //try
          //{
          ModelStencil modelStencil = ModelStencil.Deserialize(fullpath);

          if (ConfirmModelStencil(modelStencil))
          {
            TrimAnchorPoints(modelStencil);
            ModelStencils.Add(modelStencil.Tag, modelStencil);
          }

          //Console.WriteLine("  {0}] {1}", iStencil++, Path.GetFileNameWithoutExtension(fullpath));
          //LogNote("Srvr : 0 : " + iStencil++ + " : " + System.IO.Path.GetFileNameWithoutExtension(fullpath));
          //}
          //catch (Exception)
          //{
          //  int asdf = 0;
          //  //Message("Error '" + e.Message + "' loading ModelStencil: " + fullpath, MessageType.Error);
          //}
        }

        Console.WriteLine("\n");
      }

      {
        //int iStencil = 0;
        //LogNote("Srvr : 0 : GraphicStencils:");
        String[] files = Directory.GetFiles(stencilPath, "*.graphicstencil");
        for (int i = 0; i < files.GetLength(0); i++)
        {
          String fullpath = files[i];

          //try
          //{
          GraphicStencil graphicStencil = GraphicStencil.Deserialize(fullpath);

          foreach (String tag in graphicStencil.Tags)
          {
            GraphicStencils.Add(tag, graphicStencil);
          }
          //}
          //catch
          //{
          //  int adsf = 0;
          //  //logNote("Config : Error loading GraphicStencil " + fullpath);
          //}
        }
      }
    }
 private static bool ServiceConnectCheck(Config config)
 {
   return (config.TestUrl(new Uri("ipc://SysCAD.Service/Global")));
 }
 public AttachProjectForm(AttachProjectForm previousAttachProjectForm)
 {
   clientProtocol = previousAttachProjectForm.clientProtocol;
   config = previousAttachProjectForm.config;
 }
Exemple #6
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();
      }
    }
Exemple #7
0
    internal void SetProject(ClientProtocol clientProtocol, Config config, PureComponents.TreeView.TreeView tvNavigation)
    {
      state.FlowChart = fcFlowChart;
      state.ClientProtocol = clientProtocol;
      state.Config = config;
      state.TVNavigation = tvNavigation;

      state.ConnectGraphic(
        new ClientProtocol.PermissionsChangedHandler(fcFlowChart_PermissionsChanged),
        new ClientProtocol.StepHandler(fcFlowChart_Step),
        new ClientProtocol.SyncHandler(fcFlowChart_Sync),
        new ClientProtocol.ChangedHandler(fcFlowChart_Changed),
        new ClientProtocol.PortInfoRequestedHandler(fcFlowChart_PortInfoRequested));

      fcFlowChart.UndoManager.UndoEnabled = false;
      fcFlowChart.UseWaitCursor = true;
      fcFlowChart.ValidityChecks = false;
      fcFlowChart.Visible = false;
      fcFlowChart.Enabled = false;



      foreach (GraphicArea graphicArea in clientProtocol.graphic.Areas.Values)
      {
        state.CreateArea(graphicArea);
      }

      foreach (GraphicNode graphicNode in clientProtocol.graphic.Nodes.Values)
      {
        ModelNode modelNode;
        if (state.ClientProtocol.model.Nodes.TryGetValue(graphicNode.ModelGuid, out modelNode))
        {
          state.CreateNode(modelNode, graphicNode);
        }
        else
        {
          state.CreateNode(null, graphicNode);
          //state.ClientProtocol.LogMessage(out requestId, "ModelNode missing for graphicLink (Tag: " + graphicNode.Tag + ", Guid: " + graphicNode.Guid + ")", SysCAD.Log.MessageType.Error);
        }
      }

      foreach (GraphicLink graphicLink in clientProtocol.graphic.Links.Values)
      {
        ModelLink modelLink;
        if (state.ClientProtocol.model.Links.TryGetValue(graphicLink.ModelGuid, out modelLink))
        {
          state.CreateLink(modelLink, graphicLink);
        }
        else
        {
          state.ClientProtocol.LogMessage(out requestId, "ModelLink missing for graphicLink (Tag: " + graphicLink.Tag + ", Guid: " + graphicLink.Guid + ")", SysCAD.Log.MessageType.Error);
        }
      }

      fcFlowChart.UndoManager.UndoEnabled = true;
      fcFlowChart.UseWaitCursor = false;
      fcFlowChart.ValidityChecks = true;
      fcFlowChart.Visible = true;
      fcFlowChart.Enabled = true;
    }