Example #1
0
		/// <summary>
		/// Moves the selected row(s) to a new position. The new position must be entered by the user.
		/// </summary>
		/// <param name="ctrl">The worksheet controller for the table.</param>
		public static string SetSelectedRowPosition(IWorksheetController ctrl)
		{
			if (ctrl.SelectedDataRows.Count == 0)
				return null; // nothing to do

			int newposition = int.MinValue;

			IntegerValueInputController ivictrl = new IntegerValueInputController(0, "Please enter the new position (>=0):");

			ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
			if (Current.Gui.ShowDialog(ivictrl, "New row position", false))
			{
				newposition = ivictrl.EnteredContents;
			}
			else
				return null;

			SetSelectedRowPosition(ctrl, newposition);

			return null;
		}
    public static void QuestPreferredNumberOfFactors(MultivariateContentMemento plsMemo)
    {
      // quest the number of factors to export
      IntegerValueInputController ivictrl = new IntegerValueInputController(1,"Please choose preferred number of factors(>0):");
        

      ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
      if(!Current.Gui.ShowDialog(ivictrl,"Number of factors",false))
        return;

      plsMemo.PreferredNumberOfFactors = ivictrl.EnteredContents;
    }
    public static void ExportPLSCalibration(Altaxo.Data.DataTable table)
    {
      // quest the number of factors to export
      IntegerValueInputController ivictrl = new IntegerValueInputController(1,"Please choose number of factors to export (>0):");
      ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
      if(!Current.Gui.ShowDialog(ivictrl,"Number of factors",false))
        return;

    
      // quest the filename
      System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
      dlg.DefaultExt="xml";
      if(System.Windows.Forms.DialogResult.OK!=dlg.ShowDialog(Current.MainWindow))
        return;

      PredictionModelExporter exporter = new PredictionModelExporter(table,ivictrl.EnteredContents);
      exporter.Export(dlg.FileName);
    }
    public static void PCAOnColumns(WorksheetController ctrl)
    {
      int maxFactors = 3;
      IntegerValueInputController ivictrl = new IntegerValueInputController(maxFactors,"Please enter the maximum number of factors to calculate:");
        

      ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
      if(Current.Gui.ShowDialog(ivictrl,"Set maximum number of factors",false))
      {
        string err= PrincipalComponentAnalysis(Current.Project,ctrl.Doc,ctrl.SelectedDataColumns,ctrl.SelectedDataRows,false,ivictrl.EnteredContents);
        if(null!=err)
          Current.Gui.ErrorMessageBox(err);
      }
    }
Example #5
0
 /// <summary>
 /// Ask the user for the number of data rows to insert in a data table.
 /// </summary>
 /// <param name="ctrl">The worksheet controller.</param>
 /// <param name="rowBeforeToInsert">Number of the row before which to insert the rows.</param>
 public static void InsertDataRows(WorksheetController ctrl,int rowBeforeToInsert)
 {
   // ask for the number of rows to insert
   Altaxo.Gui.Common.IntegerValueInputController ictrl = new IntegerValueInputController(1, "Enter the number of rows to insert:");
   if (Current.Gui.ShowDialog(ictrl, "Insert rows", false))
     InsertDataRows(ctrl, rowBeforeToInsert, ictrl.EnteredContents);
 }
    /// <summary>
    /// Moves the selected column to a new position. The new position must be entered by the user.
    /// </summary>
    /// <param name="ctrl">The worksheet controller for the table.</param>
    public static string SetSelectedColumnPosition(WorksheetController ctrl)
    {
      // check condition - either DataColumns or propertycolumns can be selected - but not both
      if(ctrl.SelectedDataColumns.Count>0 && ctrl.SelectedPropertyColumns.Count>0)
        return "Don't know what to do - both data and property columns are selected";

      if(ctrl.SelectedDataColumns.Count==0 && ctrl.SelectedPropertyColumns.Count==0)
        return null; // nothing to do

      int newposition = int.MinValue;
        
      IntegerValueInputController ivictrl = new IntegerValueInputController(0,"Please enter the new position (>=0):");
      ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
      if(Current.Gui.ShowDialog(ivictrl,"New column position",false))
      {
        newposition = ivictrl.EnteredContents;
      }
      else
        return null;

      SetSelectedColumnPosition(ctrl,newposition);

      return null;
    }
 /// <summary>
 /// Sets the group number of the selected column
 /// </summary>
 /// <param name="ctrl">The worksheet controller for the table.</param>
 public static void SetSelectedColumnGroupNumber(WorksheetController ctrl)
 {
   if(ctrl.SelectedDataColumns.Count>0 || ctrl.SelectedPropertyColumns.Count>0)
   {
     int grpNumber = 0;
     if(ctrl.SelectedDataColumns.Count>0)
       grpNumber = ctrl.DataTable.DataColumns.GetColumnGroup(ctrl.SelectedDataColumns[0]);
     else if(ctrl.SelectedPropertyColumns.Count>0)
       grpNumber = ctrl.DataTable.PropertyColumns.GetColumnGroup(ctrl.SelectedPropertyColumns[0]);
     
     IntegerValueInputController ivictrl = new IntegerValueInputController(grpNumber,"Please enter a group number (>=0):");
     ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
     if(Current.Gui.ShowDialog(ivictrl,"Set group number",false))
     {
       SetSelectedColumnGroupNumber(ctrl,ivictrl.EnteredContents);
     }
   }
 }
Example #8
0
		/// <summary>
		/// Sets the group number of the selected column
		/// </summary>
		/// <param name="dataTable">The data table</param>
		/// <param name="selectedDataColumns">Indices of the currently selected data column of the table</param>
		/// <param name="selectedPropColumns">Indices of the currently selected property columns of the table.</param>
		public static bool ShowSetColumnGroupNumberDialog(this DataTable dataTable,
			IAscendingIntegerCollection selectedDataColumns,
			IAscendingIntegerCollection selectedPropColumns)
		{
			if (selectedDataColumns.Count > 0 || selectedPropColumns.Count > 0)
			{
				int grpNumber = 0;
				if (selectedDataColumns.Count > 0)
					grpNumber = dataTable.DataColumns.GetColumnGroup(selectedDataColumns[0]);
				else if (selectedPropColumns.Count > 0)
					grpNumber = dataTable.PropertyColumns.GetColumnGroup(selectedPropColumns[0]);

				IntegerValueInputController ivictrl = new IntegerValueInputController(grpNumber, "Please enter a group number (>=0):");
				ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
				if (Current.Gui.ShowDialog(ivictrl, "Set group number", false))
				{
					SetColumnGroupNumber(dataTable, selectedDataColumns, selectedPropColumns, ivictrl.EnteredContents);
					return true;
				}
			}
			return false;
		}
Example #9
0
		public static void ExportPLSCalibration(Altaxo.Data.DataTable table)
		{
			// quest the number of factors to export
			IntegerValueInputController ivictrl = new IntegerValueInputController(1, "Please choose number of factors to export (>0):");
			ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator();
			if (!Current.Gui.ShowDialog(ivictrl, "Number of factors", false))
				return;

			// quest the filename
			SaveFileOptions options = new SaveFileOptions();
			options.AddFilter("*.xml", "Xml files (*.xml)");
			options.FilterIndex = 0;
			if (!Current.Gui.ShowSaveFileDialog(options))
				return;

			PredictionModelExporter exporter = new PredictionModelExporter(table, ivictrl.EnteredContents);
			exporter.Export(options.FileName);
		}