コード例 #1
0
 public MarkInfoTuple(GridColumnWithMark row, GridColumnWithMark column, string rowValue, string columnValue)
 {
     RowMark     = row;
     ColumnMark  = column;
     RowValue    = rowValue;
     ColumnValue = columnValue;
 }
コード例 #2
0
        public void EnableValuePanel(GridColumnWithMark selectedColumn)
        {
            this.selectedColumn = selectedColumn;

            if (!selectedColumn.Qualitative)
            {
                PanelScroll.Enabled = true;

                int min = selectedColumn.Min.Value;
                int max = selectedColumn.Max.Value;

                ValueTrackBar.Minimum = ValueTrackBar.Minimum = 0; // нужно, ибо возникает ошибка : Minimal value is greather than maximal one
                ValueTrackBar.Maximum = max;
                ValueTrackBar.Minimum = min;
                ValueTrackBar.Value   = selectedColumn.Border.Value;

                ValueTextBox.MinValue = min;
                ValueTextBox.MaxValue = max;
                ValueTextBox.Text     = ValueTrackBar.Value.ToString();

                minValueLabel.Text = min.ToString();
                maxValueLabel.Text = max.ToString();
            }
            else
            {
                PanelScroll.Enabled = false;
                ValueTextBox.Text   = "0";
                minValueLabel.Text  = "-";
                maxValueLabel.Text  = "-";
                ValueTrackBar.Value = ValueTrackBar.Minimum;
            }

            UpdateValueLabel();
        }
コード例 #3
0
        public void DownloadDataFromFile(string dataSource)
        {
            FileDataSource = dataSource;

            DataTable dataTable = null;
            string pathExtension = System.IO.Path.GetExtension(dataSource);
            switch (pathExtension)
            {
                case ".xls":
                case ".xlsx":
                    dataTable = GetDataFromExcel(dataSource, pathExtension);
                    break;

                case ".csv":
                case ".txt":
                    dataTable = GetDataFromTxt(dataSource, pathExtension);
                    break;

                default:
                    break;
            }

            DataCreationGrid.Rows.Clear();
            DataCreationGrid.Columns.Clear();

            foreach (var item in dataTable.Columns)
            {
                GridColumnWithMark column = new GridColumnWithMark() { HeaderText = item.ToString(), Name = item.ToString() };
                DataCreationGrid.Columns.Add(column);
            }

            for (int row = 0; row < dataTable.Rows.Count; row++)
            {
                DataCreationGrid.Rows.Add();

                for (int column = 0; column < dataTable.Columns.Count; column++)
                {
                    DataCreationGrid.Rows[row].Cells[column].Value = dataTable.Rows[row].ItemArray[column].ToString();

                }
            }

            DataSaved = true;
            
        }
コード例 #4
0
        private void List_mouseDown(object sender, MouseEventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            if (listBox.Items.Count == 0)
            {
                return;
            }
            int index = listBox.IndexFromPoint(e.X, e.Y);

            if (index < 0)
            {
                return;
            }

            // todo PanelValue change color

            /*
             * int R = 209, G = 17, B = 65;
             * int d = 10;
             * int interval_R = R / d,
             *  interval_G = G / d,
             *  interval_B = B / d;
             *
             */

            string             markName       = listBox.Items[index].ToString();
            GridColumnWithMark selectedColumn = (GridColumnWithMark)_data.Columns[markName];

            DragDropEffects dde1 = DoDragDrop(selectedColumn.GetName(false),
                                              DragDropEffects.All);

            EnableValuePanel(selectedColumn);



            if (dde1 == DragDropEffects.All)
            {
                listBox.Items.RemoveAt(listBox.IndexFromPoint(e.X, e.Y));
            }
        }
コード例 #5
0
        private void DataCreationGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {

            DataSaved = false;
            MetroFramework.Controls.MetroGrid metroGrid = (MetroFramework.Controls.MetroGrid)sender;

            if (e.RowIndex == -1)
                return;
            var value = metroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

            GridColumnWithMark column = (GridColumnWithMark)metroGrid.Columns[e.ColumnIndex];

            if (value != null && !metroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().All(char.IsDigit) && !column.Qualitative)
            {
                MessageBox.Show("Нельзя вводить строковые значения в количественные признаки");
                metroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = null;
            }

            ((GridColumnWithMark)metroGrid.Columns[e.ColumnIndex]).CellValueChanged(e.RowIndex, metroGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);

            

              
        }
コード例 #6
0
        private List <object> getUniqueVariations(string columnName)
        {
            GridColumnWithMark column = _dataColumns.Find(e => e.Name.Equals(columnName));

            List <object> variationList = new List <object>();

            if (column.Qualitative)
            {
                var query = column.Items
                            .GroupBy(s => s.ToString())
                            .Select(g => new { Name = g.Key });

                foreach (var item in query)
                {
                    variationList.Add(item.Name);
                }
            }
            else
            {
                variationList.Add(column.Border);
            }

            return(variationList);
        }
コード例 #7
0
 public void ShowContextMenuColumn(GridColumnWithMark column, Point mouseLocation)
 {
     column.ShowContextMenu(DataCreationGrid, mouseLocation);
 }
コード例 #8
0
 private void dc_addColumn_Click(object sender, EventArgs e)
 {
     GridColumnWithMark column = new GridColumnWithMark() { HeaderText = "Признак " + (DataCreationGrid.ColumnCount + 1),Name = "Признак " + (DataCreationGrid.ColumnCount + 1) };
     DataCreationGrid.Columns.Add(column);
 }