diff --git a/src/Views/Widgets/Dashboard.xaml.cs b/src/Views/Widgets/Dashboard.xaml.cs index 30ff38ca..3fc4cec3 100644 --- a/src/Views/Widgets/Dashboard.xaml.cs +++ b/src/Views/Widgets/Dashboard.xaml.cs @@ -10,7 +10,6 @@ using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Shell; namespace SourceGit.Views.Widgets { diff --git a/src/Views/Widgets/WorkingCopy.xaml.cs b/src/Views/Widgets/WorkingCopy.xaml.cs index 95406fd4..5d7f583a 100644 --- a/src/Views/Widgets/WorkingCopy.xaml.cs +++ b/src/Views/Widgets/WorkingCopy.xaml.cs @@ -97,6 +97,14 @@ namespace SourceGit.Views.Widgets { if (watcher != null) watcher.RefreshWC(); } + public void Discard(List changes) { + if (changes.Count >= unstagedContainer.Changes.Count && stagedContainer.Changes.Count == 0) { + new Popups.Discard(repo.Path, null).Show(); + } else { + new Popups.Discard(repo.Path, changes).Show(); + } + } + #region STAGE_UNSTAGE private void ViewAssumeUnchanged(object sender, RoutedEventArgs e) { var dialog = new AssumeUnchanged(repo.Path); diff --git a/src/Views/Widgets/WorkingCopyChanges.xaml.cs b/src/Views/Widgets/WorkingCopyChanges.xaml.cs index 79b49c1a..36e8d126 100644 --- a/src/Views/Widgets/WorkingCopyChanges.xaml.cs +++ b/src/Views/Widgets/WorkingCopyChanges.xaml.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using System.Windows.Media; namespace SourceGit.Views.Widgets { /// @@ -385,10 +386,14 @@ namespace SourceGit.Views.Widgets { } private void Disard(List changes) { - if (changes.Count >= Changes.Count) { - new Popups.Discard(repo, null).Show(); - } else { - new Popups.Discard(repo, changes).Show(); + DependencyObject parent = VisualTreeHelper.GetParent(this); + while (parent != null) { + if (parent is WorkingCopy wc) { + wc.Discard(changes); + return; + } + + parent = VisualTreeHelper.GetParent(parent); } }