- Timestamp:
- 04/15/10 01:34:27 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r3346 r3350 82 82 Caption = "StringConvertibleMatrix View"; 83 83 rowsTextBox.Text = ""; 84 rowsTextBox.Enabled = false;85 84 columnsTextBox.Text = ""; 86 columnsTextBox.Enabled = false;87 85 dataGridView.Rows.Clear(); 88 86 dataGridView.Columns.Clear(); 89 dataGridView.Enabled = false;90 87 virtualRowIndizes = new int[0]; 91 88 } else { 92 89 Caption = "StringConvertibleMatrix (" + Content.GetType().Name + ")"; 93 UpdateReadOnlyControls();94 90 UpdateData(); 91 } 92 SetEnableStateOfControls(); 93 } 94 protected override void OnReadOnlyChanged() { 95 base.OnReadOnlyChanged(); 96 SetEnableStateOfControls(); 97 } 98 private void SetEnableStateOfControls() { 99 if (Content == null) { 100 rowsTextBox.Enabled = false; 101 columnsTextBox.Enabled = false; 102 dataGridView.Enabled = false; 103 } else { 104 rowsTextBox.Enabled = true; 105 columnsTextBox.Enabled = true; 106 dataGridView.Enabled = true; 107 rowsTextBox.ReadOnly = ReadOnly; 108 columnsTextBox.ReadOnly = ReadOnly; 109 dataGridView.ReadOnly = ReadOnly; 95 110 } 96 111 } … … 338 353 339 354 foreach (KeyValuePair<int, SortOrder> pair in sortedIndizes.Where(p => p.Value != SortOrder.None)) { 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 355 string1 = matrix.GetValue(x, pair.Key); 356 string2 = matrix.GetValue(y, pair.Key); 357 if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2)) 358 result = double1.CompareTo(double2); 359 else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2)) 360 result = dateTime1.CompareTo(dateTime2); 361 else { 362 if (string1 != null) 363 result = string1.CompareTo(string2); 364 else if (string2 != null) 365 result = string2.CompareTo(string1) * -1; 366 } 367 if (pair.Value == SortOrder.Descending) 368 result *= -1; 369 if (result != 0) 370 return result; 356 371 } 357 372 return result;
Note: See TracChangeset
for help on using the changeset viewer.