private void OpenToolStripMenuItem_Click( object sender, EventArgs e) { this.openFileDialog.FileName = String.Empty; this.openFileDialog.Filter = C45Constants.FILTER_C45PROJECTS; this.openFileDialog.ShowDialog(); try { this.project = C45Project.CreateInstance(this.openFileDialog.FileName); this.c45Settings = C45Settings.CreateFromFile(project.C45ConfigFile); if (project.ProjectType == C45ProjectType.HRT) { hRTMapperToolStripMenuItem.Visible = true; } else { hRTMapperToolStripMenuItem.Visible = false; } this.c45Settings.C45SchemaFilename = Path.GetFileNameWithoutExtension(project.SchemaFile); this.groupBoxStats.Text = project.ProjectName; this.CreateColumns(); this.AcquireColumnWidth(); this.EnableControls(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static public C45Project CreateInstance(String filename) { try { C45Project instance = new C45Project(filename); instance.C45ConfigFile = "C45Interop.config"; instance.columnWidth = new ColumnWidthCollection(instance.doc); instance.columnWidth.DirtyStateChanged += new DirtyStateChangedEventHandler(ColumnWidth_DirtyStateChanged); return(instance); } catch (Exception ex) { throw (new Exception("An error occured while parsing C45-Project file", ex)); } }