/// <summary> /// new column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btNew_Click(object sender, RoutedEventArgs e) { //get the column position int position = 0; if (_Columns.Count > 0) { position = _Columns.Max(c => c.OrdinalPosition) + 1; } //create the new item IColumnMetadata col = new ColumnMetadata(Table); col.OrdinalPosition = position; //open the window ColumnConfig window = new ColumnConfig(col, ""); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) { return; } //add to list _Columns.Add(col); Table.ColumnsMetadata.Add(col.ColumnName, col); }
/// <summary> /// handle double click on column for edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = sender as ListBoxItem; if (item == null || !item.IsSelected) { return; } IColumnMetadata sel = item.Content as IColumnMetadata; IColumnMetadata column = new ColumnMetadata(Table); BermudaConfigUtil.CopyColumn(sel, column); ColumnConfig window = new ColumnConfig(column, column.ColumnName); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) { return; } BermudaConfigUtil.CopyColumn(column, sel); lbColumns.Items.Refresh(); }
/// <summary> /// copy a column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btCopy_Click(object sender, RoutedEventArgs e) { //get the column position int position = 0; if (_Columns.Count > 0) { position = _Columns.Max(c => c.OrdinalPosition) + 1; } //get the selected item if (lbColumns.SelectedItem == null) { return; } IColumnMetadata copy = lbColumns.SelectedItem as IColumnMetadata; //copy fields var col = new ColumnMetadata(Table); BermudaConfigUtil.CopyColumn(copy, col); col.OrdinalPosition = position; //open the window ColumnConfig window = new ColumnConfig(col, ""); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) { return; } //add to list _Columns.Add(col); Table.ColumnsMetadata.Add(col.ColumnName, col); }
/// <summary> /// copy a column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btCopy_Click(object sender, RoutedEventArgs e) { //get the column position int position = 0; if (_Columns.Count > 0) position = _Columns.Max(c => c.OrdinalPosition) + 1; //get the selected item if (lbColumns.SelectedItem == null) return; IColumnMetadata copy = lbColumns.SelectedItem as IColumnMetadata; //copy fields var col = new ColumnMetadata(Table); BermudaConfigUtil.CopyColumn(copy, col); col.OrdinalPosition = position; //open the window ColumnConfig window = new ColumnConfig(col, ""); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) return; //add to list _Columns.Add(col); Table.ColumnsMetadata.Add(col.ColumnName, col); }
/// <summary> /// new column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btNew_Click(object sender, RoutedEventArgs e) { //get the column position int position = 0; if (_Columns.Count > 0) position = _Columns.Max(c => c.OrdinalPosition) + 1; //create the new item IColumnMetadata col = new ColumnMetadata(Table); col.OrdinalPosition = position; //open the window ColumnConfig window = new ColumnConfig(col, ""); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) return; //add to list _Columns.Add(col); Table.ColumnsMetadata.Add(col.ColumnName, col); }
/// <summary> /// handle double click on column for edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = sender as ListBoxItem; if (item == null || !item.IsSelected) return; IColumnMetadata sel = item.Content as IColumnMetadata; IColumnMetadata column = new ColumnMetadata(Table); BermudaConfigUtil.CopyColumn(sel, column); ColumnConfig window = new ColumnConfig(column, column.ColumnName); var ret = window.ShowDialog(); if (!ret.HasValue || ret.Value == false) return; BermudaConfigUtil.CopyColumn(column, sel); lbColumns.Items.Refresh(); }