コード例 #1
0
ファイル: Program.cs プロジェクト: ChrisMoreton/Test3
    static int Main(string[] args)
    {
#if (DEBUG)
      try
      {
#endif
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        String stencilPath = "..\\BaseFiles\\Stencils";

        Dictionary<string, Project> projects = new Dictionary<string, Project>();

        if (Properties.Service.Default.projects == null)
        {
          Properties.Service.Default.projects = new System.Collections.Specialized.StringCollection();
        }

        if (args.Length == 2)
        {
          Project project = new Project(args[1], args[0]);
          projects.Add(project.Path, project);
        }

        foreach (string projectString in Properties.Service.Default.projects)
        {
          string[] projectStrings = projectString.Split('\t');
          Project project = new Project(projectStrings[0], projectStrings[1]);
          projects.Add(project.Path, project);
        }

        ServiceTemporaryWindow serviceTemporaryWindow = new ServiceTemporaryWindow(stencilPath, projects, Properties.Service.Default.lastFolder);
        Application.Run(serviceTemporaryWindow);
        serviceTemporaryWindow.Dispose();

        Properties.Service.Default.projects.Clear();
        foreach (Project project in projects.Values)
        {
          Properties.Service.Default.projects.Add(project.Name + '\t' + project.Path);
        }

        Properties.Service.Default.lastFolder = serviceTemporaryWindow.lastFolder;

        Properties.Service.Default.Save();

        return 0;
#if (DEBUG)
      }
      catch (Exception e)
      {
        ShowStackTraceBox(e);
        return -1;
      }
#endif
    }
コード例 #2
0
    // Add project even though there aren't any 10 files -- for use in syscad9's export.
    // Should really be re-thought once we've sorted how 9 does it's thing.
    public void AddProjectAnyway(Project project)
    {
      if (InvokeRequired)
      {
        Invoke(new AddProjectAnywayDelegate(AddProjectAnyway), new object[] { project });
      }
      else
      {
        configData.ProjectList.Add(project.Name);
        ListViewItem listItem = new ListViewItem(project.Name);
        listItem.ToolTipText = project.Name;
        listItem.SubItems.Add(project.Path);
        projectListView.Items.Add(listItem);
        projects.Add(project.Path, project);

        project.FlowChart = flowChart;
        project.LogView = logView;

        project.ConfigData = configData;

        project.ConnectClientServiceProtocol();
      }
    }
コード例 #3
0
 public bool TestProject(Project project)
 {
   if (InvokeRequired)
   {
     return (bool)Invoke(new TestProjectDelegate(TestProject), new object[] { project });
   }
   else
   {
     if (project != null)
     {
       Int64 requestId;
       return project.LoadGraphics(out requestId);
     }
     else return false;
   }
 }
コード例 #4
0
 public bool AddProject(Project project)
 {
   if (InvokeRequired)
   {
     return (bool)Invoke(new AddProjectDelegate(AddProject), new object[] { project });
   }
   else
   {
     if (TestProject(project))
     {
       AddProjectAnyway(project);
       return true;
     }
     else
     {
       return false;
     }
   }
 }