public FileCreationData(string name, BaseTemplate template) { this.Name = name; this.Template = template; }
/// <summary> /// This event is raised when the type of template to use is changed. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">The event information.</param> private void c_ProjectTypeListView_SelectedIndexChanged(object sender, EventArgs e) { // Determine whether or not the selection is invalid. this.c_FileTypeInvalidPictureBox.Visible = (this.c_FileTypeListView.SelectedItems.Count == 0); // Only attempt to determine the description if there is one // item selected. if (this.c_FileTypeListView.SelectedItems.Count == 1) { // Get the name of the selected item and pair it up with // the appropriate BaseTemplate. string name = this.c_FileTypeListView.SelectedItems[0].Name; this.p_SelectedTemplate = null; foreach (Type t in this.m_TemplateTypes) if (name == "Item_" + t.Name) { this.p_SelectedTemplate = t.GetConstructor(Type.EmptyTypes).Invoke(null) as BaseTemplate; break; } // Check to make sure that we've actually got a template. if (this.p_SelectedTemplate == null) { this.c_FileTypeInvalidPictureBox.Visible = true; this.c_TemplateDescriptionTextBox.Text = "Unknown template type selected."; return; } // Update the description area. this.c_TemplateDescriptionTextBox.Text = "Creates " + this.p_SelectedTemplate.TemplateDescription; } }