public static void Rename(WorksheetController ctrl)
 {
   TextValueInputController tvctrl = new TextValueInputController(ctrl.Doc.Name,"Enter a name for the worksheet:");
   tvctrl.Validator = new WorksheetRenameValidator(ctrl.Doc,ctrl);
   if(Current.Gui.ShowDialog(tvctrl,"Rename worksheet",false))
     ctrl.Doc.Name = tvctrl.InputText.Trim();
 }
Example #2
0
		/// <summary>
		/// Shows a dialog to rename the table.
		/// </summary>
		/// <param name="table">The table to rename.</param>
		public static void ShowRenameDialog(this DataTable table)
		{
			TextValueInputController tvctrl = new TextValueInputController(table.Name, "Enter a name for the worksheet:");
			tvctrl.Validator = new WorksheetRenameValidator(table);
			if (Current.Gui.ShowDialog(tvctrl, "Rename worksheet", false))
				table.Name = tvctrl.InputText.Trim();
		}
 /// <summary>
 /// Renames the selected data column or property column.
 /// </summary>
 /// <param name="ctrl">The worksheet controller for the table.</param>
 public static void RenameSelectedColumn(WorksheetController ctrl)
 {
   if(ctrl.SelectedDataColumns.Count==1 && ctrl.SelectedPropertyColumns.Count==0)
   {
     Altaxo.Data.DataColumn col = ctrl.Doc.DataColumns[ctrl.SelectedDataColumns[0]];
     TextValueInputController tvctrl = new TextValueInputController(col.Name,"new column name:");
     tvctrl.Validator = new DataColumnRenameValidator(col,ctrl);
     if(Current.Gui.ShowDialog(tvctrl,"Rename column",false))
       ctrl.Doc.DataColumns.SetColumnName(col,tvctrl.InputText);
   }
   if(ctrl.SelectedDataColumns.Count==0 && ctrl.SelectedPropertyColumns.Count==1)
   {
     Altaxo.Data.DataColumn col = ctrl.Doc.PropCols[ctrl.SelectedPropertyColumns[0]];
     TextValueInputController tvctrl = new TextValueInputController(col.Name,"new property column name:");
     tvctrl.Validator = new PropertyColumnRenameValidator(col,ctrl);
     if(Current.Gui.ShowDialog(tvctrl,"Rename property column",false))
       ctrl.Doc.PropCols.SetColumnName(col,tvctrl.InputText);
   }
 }
Example #4
0
		/// <summary>
		/// Asks for a new name and then renames the selected data column or property column.
		/// </summary>
		/// <param name="col">The data column to rename.</param>
		public static bool ShowRenameColumnDialog(this DataColumn col)
		{
			var parent = col.ParentObject as DataColumnCollection;
			if (null == parent)
			{
				Current.Gui.ErrorMessageBox("Can not rename column since it is not a member of a DataColumnCollection");
				return false;
			}

			TextValueInputController tvctrl = new TextValueInputController(col.Name, "new column name:");
			tvctrl.Validator = new ColumnRenameValidator(col, parent);
			if (Current.Gui.ShowDialog(tvctrl, "Rename column", false))
			{
				parent.SetColumnName(col, tvctrl.InputText);
				return true;
			}
			else
			{
				return false;
			}
		}