Changeset 10938 for branches/DataPreprocessing
- Timestamp:
- 06/04/14 13:08:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs
r10934 r10938 36 36 private bool notOwnEvent = true; 37 37 private bool isSearching = false; 38 private bool isReplacing = false; 38 39 private bool updateOnMouseUp = false; 39 40 private SearchAndReplaceDialog findAndReplaceDialog; … … 80 81 protected override void dataGridView_SelectionChanged(object sender, EventArgs e) { 81 82 if (Content != null) { 82 if (!isSearching ) {83 if (!isSearching && !isReplacing) { 83 84 84 85 if (Control.MouseButtons == MouseButtons.Left) { … … 373 374 private void Replace(IDictionary<int, IList<int>> cells) { 374 375 if (findAndReplaceDialog != null) { 375 switch (findAndReplaceDialog.GetReplaceAction()) { 376 case ReplaceAction.Value: 377 Content.ManipulationLogic.ReplaceIndicesByValue(cells, findAndReplaceDialog.GetReplaceText()); 378 break; 379 case ReplaceAction.Average: 380 Content.ManipulationLogic.ReplaceIndicesByAverageValue(cells, false); 381 break; 382 case ReplaceAction.Median: 383 Content.ManipulationLogic.ReplaceIndicesByMedianValue(cells, false); 384 break; 385 case ReplaceAction.Random: 386 Content.ManipulationLogic.ReplaceIndicesByRandomValue(cells, false); 387 break; 388 case ReplaceAction.MostCommon: 389 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(cells, false); 390 break; 391 case ReplaceAction.Interpolation: 392 Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(cells); 393 break; 394 } 376 ReplaceTransaction(() => { 377 switch (findAndReplaceDialog.GetReplaceAction()) { 378 case ReplaceAction.Value: 379 Content.ManipulationLogic.ReplaceIndicesByValue(cells, findAndReplaceDialog.GetReplaceText()); 380 break; 381 case ReplaceAction.Average: 382 Content.ManipulationLogic.ReplaceIndicesByAverageValue(cells, false); 383 break; 384 case ReplaceAction.Median: 385 Content.ManipulationLogic.ReplaceIndicesByMedianValue(cells, false); 386 break; 387 case ReplaceAction.Random: 388 Content.ManipulationLogic.ReplaceIndicesByRandomValue(cells, false); 389 break; 390 case ReplaceAction.MostCommon: 391 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(cells, false); 392 break; 393 case ReplaceAction.Interpolation: 394 Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(cells); 395 break; 396 } 397 }); 395 398 } 396 399 } … … 522 525 } 523 526 527 private void StartReplacing() { 528 isReplacing = true; 529 SuspendRepaint(); 530 } 531 532 private void StopReplacing() { 533 isReplacing = false; 534 ResumeRepaint(true); 535 } 536 537 private void ReplaceTransaction(Action action) { 538 StartReplacing(); 539 action(); 540 StopReplacing(); 541 } 542 524 543 private void ReplaceWithAverage_Column_Click(object sender, EventArgs e) { 525 Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), false); 544 ReplaceTransaction(() => { 545 Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), false); 546 }); 526 547 } 527 548 private void ReplaceWithAverage_Selection_Click(object sender, EventArgs e) { 528 Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), true); 549 ReplaceTransaction(() => { 550 Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), true); 551 }); 529 552 } 530 553 531 554 private void ReplaceWithMedian_Column_Click(object sender, EventArgs e) { 532 Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), false); 555 ReplaceTransaction(() => { 556 Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), false); 557 }); 533 558 } 534 559 private void ReplaceWithMedian_Selection_Click(object sender, EventArgs e) { 535 Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), true); 560 ReplaceTransaction(() => { 561 Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), true); 562 }); 536 563 } 537 564 538 565 private void ReplaceWithRandom_Column_Click(object sender, EventArgs e) { 539 Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), false); 566 ReplaceTransaction(() => { 567 Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), false); 568 }); 540 569 } 541 570 private void ReplaceWithRandom_Selection_Click(object sender, EventArgs e) { 542 Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), true); 571 ReplaceTransaction(() => { 572 Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), true); 573 }); 543 574 } 544 575 545 576 private void ReplaceWithMostCommon_Column_Click(object sender, EventArgs e) { 546 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), false); 577 ReplaceTransaction(() => { 578 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), false); 579 }); 547 580 } 548 581 private void ReplaceWithMostCommon_Selection_Click(object sender, EventArgs e) { 549 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), true); 582 ReplaceTransaction(() => { 583 Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), true); 584 }); 550 585 } 551 586 552 587 private void ReplaceWithInterpolation_Column_Click(object sender, EventArgs e) { 553 Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(GetSelectedCells()); 588 ReplaceTransaction(() => { 589 Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(GetSelectedCells()); 590 }); 554 591 } 555 592 556 593 private void ReplaceWithSmoothing_Selection_Click(object sender, EventArgs e) { 557 Content.ManipulationLogic.ReplaceIndicesBySmoothing(GetSelectedCells()); 594 ReplaceTransaction(() => { 595 Content.ManipulationLogic.ReplaceIndicesBySmoothing(GetSelectedCells()); 596 }); 558 597 } 559 598
Note: See TracChangeset
for help on using the changeset viewer.