private void Add(string file) { try { string ext = Path.GetExtension(file).ToLower().TrimStart(".".ToCharArray()); Type ppType = this.dropExtensions[ext]; if (ppType == null) { return; } PdfProjectElement ppe = (PdfProjectElement)Activator.CreateInstance(ppType, new object[] { file }); ppe.Analyze(); this.Project.Elements.Add(ppe); this.listView1.VirtualListSize = this.Project.Elements.Count; this.SomethingChanged(); } catch (Exception e) { if (MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.Retry) { this.Add(file); } } }
private void listView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { if (e.ItemIndex < this.Project.Elements.Count) { PdfProjectElement ppe = this.Project.Elements[e.ItemIndex]; string text = this.Adapt(ppe.Path, this.listView1.Columns[0].Width - 40, "..."); ListViewItem lvi = new ListViewItem(new string[] { text, ppe.Detail }); lvi.Checked = false; lvi.Checked = ppe.Enabled; lvi.ImageIndex = ppe.Enabled ? 1 : 0; e.Item = lvi; } else { ListViewItem lvi = new ListViewItem(new string[] { "", "", "", "" }); lvi.Checked = false; e.Item = lvi; } }
private void buttonUpDown_Click(object sender, EventArgs e) { if (this.listView1.SelectedIndices.Count == 1) { int index = this.listView1.SelectedIndices[0]; int index2 = sender == this.buttonDown ? index + 1 : index - 1; PdfProjectElement ppe1 = this.Project.Elements[index]; this.Project.Elements[index] = this.Project.Elements[index2]; this.Project.Elements[index2] = ppe1; this.listView1.SelectedIndices.Clear(); this.listView1.SelectedIndices.Add(index2); if (sender == buttonDown) { this.listView1.RedrawItems(index, index2, true); } else { this.listView1.RedrawItems(index2, index, true); } this.listView1.Focus(); } }
private void UpdateDetailPanel() { PdfProjectElement ppe = this.CurrentElement; if (ppe == null) { this.panelCommonDetails.Visible = false; this.panelDetails.Visible = false; } else { this.panelCommonDetails.Visible = true; this.checkBoxDetailInclude.Checked = ppe.Enabled; this.labelDetailPath.Text = ppe.Path; this.panelDetails.Visible = false; // this.CurrentElement.Analyze(); this.panelDetails.Controls.Clear(); this.panelDetails.Controls.Add(this.detailPanels[ppe.GetType()]); this.detailPanels[ppe.GetType()].SetElement(this.CurrentElement); this.panelDetails.Visible = true; } this.IncrementCounter(); }
public PdfProjectElementListViewItem(PdfProjectElement ppe) { //this.SubItems = new ListViewSubItemCollection(this); this.Checked = ppe.Enabled; }
public virtual void SetElement(PdfProjectElement ppe) { throw new NotImplementedException(); }