コード例 #1
0
ファイル: TableConfig.xaml.cs プロジェクト: melnx/Bermuda
        /// <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);
        }
コード例 #2
0
ファイル: TableConfig.xaml.cs プロジェクト: melnx/Bermuda
        /// <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();
        }
コード例 #3
0
ファイル: TableConfig.xaml.cs プロジェクト: melnx/Bermuda
        /// <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);
        }
コード例 #4
0
ファイル: TableConfig.xaml.cs プロジェクト: yonglehou/Bermuda
        /// <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);
        }
コード例 #5
0
ファイル: TableConfig.xaml.cs プロジェクト: yonglehou/Bermuda
        /// <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);
        }
コード例 #6
0
ファイル: TableConfig.xaml.cs プロジェクト: yonglehou/Bermuda
 /// <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();
 }