示例#1
0
        public static void ShowExpandCyclingVariableColumnDialog(this DataTable srcTable, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns)
        {
            DataTableMultipleColumnProxy       proxy   = null;
            ExpandCyclingVariableColumnOptions options = null;

            try
            {
                proxy = new DataTableMultipleColumnProxy(ExpandCyclingVariableColumnDataAndOptions.ColumnsParticipatingIdentifier, srcTable, selectedDataRows, selectedDataColumns);
                proxy.EnsureExistenceOfIdentifier(ExpandCyclingVariableColumnDataAndOptions.ColumnWithCyclingVariableIdentifier, 1);
                proxy.EnsureExistenceOfIdentifier(ExpandCyclingVariableColumnDataAndOptions.ColumnsToAverageIdentifier);

                options = new ExpandCyclingVariableColumnOptions();
            }
            catch (Exception ex)
            {
                Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in preparation of 'Expand Cycling Variable'");
                return;
            }

            var dataAndOptions = new ExpandCyclingVariableColumnDataAndOptions(proxy, options);

            // in order to show the column names etc in the dialog, it is neccessary to set the source
            if (true == Current.Gui.ShowDialog(ref dataAndOptions, "Choose options", false))
            {
                var destTable = new DataTable();
                proxy   = dataAndOptions.Data;
                options = dataAndOptions.Options;

                string error = null;
                try
                {
                    error = ExpandCyclingVariableColumn(dataAndOptions.Data, dataAndOptions.Options, destTable);
                }
                catch (Exception ex)
                {
                    error = ex.ToString();
                }
                if (null != error)
                {
                    Current.Gui.ErrorMessageBox(error);
                }

                destTable.Name = srcTable.Name + "_Expanded";

                // Create a DataSource
                var dataSource = new ExpandCyclingVariableColumnDataSource(proxy, options, new Altaxo.Data.DataSourceImportOptions());
                destTable.DataSource = dataSource;

                Current.Project.DataTableCollection.Add(destTable);
                Current.IProjectService.ShowDocumentView(destTable);
            }
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpandCyclingVariableColumnDataSource"/> class.
 /// </summary>
 /// <param name="from">Another instance to copy from.</param>
 public ExpandCyclingVariableColumnDataSource(ExpandCyclingVariableColumnDataSource from)
 {
     CopyFrom(from);
 }
		public static void ShowExpandCyclingVariableColumnDialog(this DataTable srcTable, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns)
		{
			DataTableMultipleColumnProxy proxy = null;
			ExpandCyclingVariableColumnOptions options = null;

			try
			{
				proxy = new DataTableMultipleColumnProxy(ExpandCyclingVariableColumnDataAndOptions.ColumnsParticipatingIdentifier, srcTable, selectedDataRows, selectedDataColumns);
				proxy.EnsureExistenceOfIdentifier(ExpandCyclingVariableColumnDataAndOptions.ColumnWithCyclingVariableIdentifier, 1);
				proxy.EnsureExistenceOfIdentifier(ExpandCyclingVariableColumnDataAndOptions.ColumnsToAverageIdentifier);

				options = new ExpandCyclingVariableColumnOptions();
			}
			catch (Exception ex)
			{
				Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in preparation of 'Expand Cycling Variable'");
				return;
			}

			var dataAndOptions = new ExpandCyclingVariableColumnDataAndOptions(proxy, options);

			// in order to show the column names etc in the dialog, it is neccessary to set the source
			if (true == Current.Gui.ShowDialog(ref dataAndOptions, "Choose options", false))
			{
				var destTable = new DataTable();
				proxy = dataAndOptions.Data;
				options = dataAndOptions.Options;

				string error = null;
				try
				{
					error = ExpandCyclingVariableColumn(dataAndOptions.Data, dataAndOptions.Options, destTable);
				}
				catch (Exception ex)
				{
					error = ex.ToString();
				}
				if (null != error)
					Current.Gui.ErrorMessageBox(error);

				destTable.Name = srcTable.Name + "_Expanded";

				// Create a DataSource
				ExpandCyclingVariableColumnDataSource dataSource = new ExpandCyclingVariableColumnDataSource(proxy, options, new Altaxo.Data.DataSourceImportOptions());
				destTable.DataSource = dataSource;

				Current.Project.DataTableCollection.Add(destTable);
				Current.ProjectService.ShowDocumentView(destTable);
			}
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="ExpandCyclingVariableColumnDataSource"/> class.
		/// </summary>
		/// <param name="from">Another instance to copy from.</param>
		public ExpandCyclingVariableColumnDataSource(ExpandCyclingVariableColumnDataSource from)
		{
			CopyFrom(from);
		}