Skip to content

Commit

Permalink
replace event handling with base virtual methode.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgoldstein committed Mar 29, 2022
1 parent 284a629 commit 036e947
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ImageChecker/ViewModel/VMResultView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ImageChecker.Helper;
using Microsoft.Win32;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows;
Expand Down Expand Up @@ -130,8 +131,6 @@ public VMResultView(IEnumerable<ImageCompareResult> items, int totalFilesProcess
WindowTitle = "ResultView";
WindowIcon = @"/ImageChecker;component/Icon/app.ico";

PropertyChanged += VMResultView_PropertyChanged;

Results.Clear();
Results.AddRange(items.OrderByDescending(a => a.FLANN));

Expand Down Expand Up @@ -168,9 +167,11 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
}
#endregion ctor

#region Event-Handler
private void VMResultView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
#region Methods
protected override void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnPropertyChanged(sender, e);

switch (e.PropertyName)
{
case nameof(SelectedResult):
Expand All @@ -179,7 +180,7 @@ private void VMResultView_PropertyChanged(object sender, System.ComponentModel.P
var selectedResult_Snapshot = SelectedResult;
_ = Task.Run(async () =>
{
CancellationToken ct;
CancellationToken ct;
try
{
await _cancelSlimmy.WaitAsync();
Expand Down Expand Up @@ -209,9 +210,7 @@ private void VMResultView_PropertyChanged(object sender, System.ComponentModel.P
break;
}
}
#endregion Event-Handler

#region Methods
private void RefreshImageCompareResultState()
{
foreach (var r in Results)
Expand Down Expand Up @@ -982,8 +981,6 @@ protected override void Dispose(bool disposing)

SelectedResult = null;

PropertyChanged -= VMResultView_PropertyChanged;

foreach (var result in Results)
{
result.FileA.Dispose();
Expand Down

0 comments on commit 036e947

Please sign in to comment.