/// <summary> /// Rename an item /// </summary> private void RenameToolStripMenuItemClick(object sender, EventArgs e) { using (var getName = new FormGetName("Rename item")) { getName.Name = lvItems.SelectedItems[0].Text; if (getName.ShowDialog() == DialogResult.OK) { try { controller.MoveItem(lvItems.SelectedItems[0].ToolTipText, GetItemPath(lvItems.SelectedItems[0].ToolTipText, false) + "/" + getName.Name, (ReportItemTypes)lvItems.SelectedItems[0].Tag); toolStripStatusLabel.Text = String.Format("Renamed item '{0}' to '{1}'", lvItems.SelectedItems[0].Text, GetItemPath(lvItems.SelectedItems[0].ToolTipText, false) + "/" + getName.Name); if ((ReportItemTypes)lvItems.SelectedItems[0].Tag == ReportItemTypes.Folder) { controller.PopulateTreeView(SelectedServer.Alias); } controller.PopulateItems(tvReportServer.SelectedNode.ToolTipText); } catch (Exception ex) { MessageBox.Show(String.Format("An error has occured: {0}", ex.Message)); LogHandler.WriteLogEntry(ex); } } } }
/// <summary> /// Create a new folder, add the new folder to the TreeView en ListView /// </summary> private void NewFolderToolStripMenuItemClick(object sender, EventArgs e) { if (tvReportServer.SelectedNode != null) { var getName = new FormGetName("Create new folder"); if (getName.ShowDialog() == DialogResult.OK) { try { if (getName.Name.Trim() == "") { MessageBox.Show("Name cannot be blank"); } controller.CreateFolder(getName.Name, tvReportServer.SelectedNode); toolStripStatusLabel.Text = String.Format("Created folder '{0}'", getName.Name); } catch (Exception ex) { MessageBox.Show(String.Format("An error occured: {0}", ex.Message)); LogHandler.WriteLogEntry(ex); } } try { controller.PopulateItems(tvReportServer.SelectedNode.ToolTipText); } catch (Exception ex) { LogHandler.WriteLogEntry(ex); MessageBox.Show(String.Format("An error has occured: {0}", ex.Message)); } } }