Skip to content

Commit

Permalink
Merge pull request #116 from DHancock/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
DHancock authored Oct 12, 2023
2 parents a18e70d + a59d935 commit 7aeb787
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion WinAppSdkCleaner/ViewModels/SdkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public override string HeadingText

public override string OtherAppsCount => $"+{SdkRecord.OtherAppsCount}";

public override Visibility OtherAppsCountVisibity => SdkRecord.OtherAppsCount > 0 ? Visibility.Visible : Visibility.Collapsed;
public bool HasOtherApps => SdkRecord.OtherAppsCount > 0;

public override Visibility OtherAppsCountVisibity => HasOtherApps ? Visibility.Visible : Visibility.Collapsed;

public override Visibility LogoVisibity => Visibility.Collapsed;

Expand Down
4 changes: 3 additions & 1 deletion WinAppSdkCleaner/ViewModels/SdkList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ public void RestoreState(IEnumerable<ItemBase> otherList)
RestoreState(otherItem.Children);
}
}
}

public bool SelectedSdkHasDependentApps => (GetSelectedItem(this) is SdkItem item) && item.HasOtherApps;
}
14 changes: 11 additions & 3 deletions WinAppSdkCleaner/Views/SdkView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async void ExecuteSearch(object? param = null)
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
MessageBox.Show(ex.Message, "Search Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(Application.Current.MainWindow, ex.Message, "Search Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
finally
{
Expand All @@ -58,6 +58,14 @@ private async void ExecuteRemove(object? param)
{
try
{
if (viewModel.SdkList.SelectedSdkHasDependentApps)
{
string message = $"This WinAppSdk has dependent applications.{Environment.NewLine}Are you sure that you want to remove it?";

if (MessageBox.Show(Application.Current.MainWindow, message, "Caution", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel)
return;
}

IsIdle = false;
await viewModel.ExecuteRemove();
}
Expand All @@ -69,12 +77,12 @@ private async void ExecuteRemove(object? param)
+ "This can occur if an unpackaged application, "
+ "that depends on this Windows App SDK is currently executing";

MessageBox.Show(message, "Remove Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(Application.Current.MainWindow, message, "Remove Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
MessageBox.Show(ex.Message, "Remove Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(Application.Current.MainWindow, ex.Message, "Remove Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions WinAppSdkCleaner/WinAppSdkCleaner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<FileVersion>1.4.1.0</FileVersion>
<AssemblyVersion>1.4.2.0</AssemblyVersion>
<FileVersion>1.4.2.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
</PropertyGroup>
Expand Down

0 comments on commit 7aeb787

Please sign in to comment.