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 }
// 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(); } }
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; } }
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; } } }