Show a Notice Dialog, small Code Style Fix, function rename

This commit is contained in:
Error504TimeOut
2025-02-25 13:37:03 +01:00
parent d0f3d38ce6
commit 799c2d829e
9 changed files with 29 additions and 22 deletions

View File

@@ -54,7 +54,7 @@ namespace WinDurango.UI.Controls
await Packages.RemovePackage(_package, controller);
});
NoticeDialog good = new NoticeDialog($"{_Name} has been uninstalled.", "Uninstalled");
await good.Show();
await good.ShowAsync();
}
App.InstalledPackages.RemovePackage(_package);
@@ -71,7 +71,7 @@ namespace WinDurango.UI.Controls
{
Logger.WriteWarning($"Not implemented");
NoticeDialog impl = new NoticeDialog($"This feature has not been implemented yet.", "Not Implemented");
await impl.Show();
await impl.ShowAsync();
}
private async void ShowModManager(object sender, RoutedEventArgs e)
@@ -97,7 +97,7 @@ namespace WinDurango.UI.Controls
await WinDurangoPatcher.PatchPackage(_package, true, progress);
});
NoticeDialog good = new NoticeDialog($"WinDurango was reinstalled in package {_Name}", "Reinstalled");
await good.Show();
await good.ShowAsync();
App.MainWindow.ReloadAppList();
}
@@ -112,7 +112,7 @@ namespace WinDurango.UI.Controls
if (!progress.failed)
{
NoticeDialog good = new NoticeDialog($"WinDurango has been uninstalled from package {_Name}", "Uninstalled");
await good.Show();
await good.ShowAsync();
}
App.MainWindow.ReloadAppList();
}
@@ -128,7 +128,7 @@ namespace WinDurango.UI.Controls
if (!progress.failed)
{
NoticeDialog good = new NoticeDialog($"WinDurango has been installed in package {_Name}", "Installed");
await good.Show();
await good.ShowAsync();
}
App.MainWindow.ReloadAppList();
}
@@ -240,18 +240,18 @@ namespace WinDurango.UI.Controls
if (_package.Status.LicenseIssue)
{
Logger.WriteError($"Could not launch {_Name} due to licensing issue.");
_ = new NoticeDialog($"There is a licensing issue... Do you own this package?", $"Could not launch {_Name}").Show();
_ = new NoticeDialog($"There is a licensing issue... Do you own this package?", $"Could not launch {_Name}").ShowAsync();
return;
}
if (firstAppListEntry == null)
{
_ = new NoticeDialog($"Could not get the applist entry of \"{_Name}\"", $"Could not launch {_Name}").Show();
_ = new NoticeDialog($"Could not get the applist entry of \"{_Name}\"", $"Could not launch {_Name}").ShowAsync();
return;
}
Logger.WriteInformation($"Launching {_Name}");
if (await firstAppListEntry.LaunchAsync() == false)
_ = new NoticeDialog($"Failed to launch \"{_Name}\"!", $"Could not launch {_Name}").Show();
_ = new NoticeDialog($"Failed to launch \"{_Name}\"!", $"Could not launch {_Name}").ShowAsync();
};
}
}

View File

@@ -7,7 +7,7 @@
PrimaryButtonText="Add"
PrimaryButtonClick="AddToAppList"
SecondaryButtonText="Cancel"
SecondaryButtonClick="hideDialog">
SecondaryButtonClick="HideDialog">
<Grid>
<ListView x:Name="appListView" Loaded="AppListView_Loaded">
</ListView>

View File

@@ -117,7 +117,7 @@ namespace WinDurango.UI.Dialogs
_ = App.MainWindow.AppsListPage.InitAppListAsync();
}
private void hideDialog(ContentDialog sender, ContentDialogButtonClickEventArgs args)
private void HideDialog(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
this.Hide();
}

View File

@@ -17,7 +17,7 @@ namespace WinDurango.UI.Dialogs
_title = title;
}
public async Task Show()
public async Task ShowAsync()
{
_messageDialog = new ContentDialog
{

View File

@@ -47,7 +47,7 @@ namespace WinDurango.UI.Dialogs
{
_dialog.Hide();
NoticeDialog oops = new NoticeDialog(title, reason);
await oops.Show();
await oops.ShowAsync();
});
}
@@ -59,7 +59,7 @@ namespace WinDurango.UI.Dialogs
{
_dialog.Hide();
NoticeDialog oops = new NoticeDialog(title, ex.Message);
await oops.Show();
await oops.ShowAsync();
});
}
@@ -96,7 +96,7 @@ namespace WinDurango.UI.Dialogs
{
_dialog.Hide();
NoticeDialog oops = new NoticeDialog(ex.Message, "Error");
await oops.Show();
await oops.ShowAsync();
}
}
@@ -112,7 +112,7 @@ namespace WinDurango.UI.Dialogs
{
_dialog.Hide();
NoticeDialog oops = new NoticeDialog(ex.Message, "Error");
await oops.Show();
await oops.ShowAsync();
}
}
}

View File

@@ -98,7 +98,7 @@ namespace WinDurango.UI
{
// have to do it here otherwise instance error
var devNotice = new NoticeDialog($"This UI is very early in development, and mainly developed by a C# learner... There WILL be bugs, and some things will NOT work...\n\nDevelopers, check Readme.md in the repo for the todolist.", "Important");
await devNotice.Show();
await devNotice.ShowAsync();
if (ExtendsContentIntoTitleBar)
{
SetupTitleBar();

View File

@@ -21,8 +21,8 @@
<StackPanel>
<CheckBox Content="Add to App List" Name="addToAppListCheckBox" Unchecked="UpdateCheckboxes" Checked="UpdateCheckboxes" IsChecked="True"/>
<CheckBox Content="Auto symlink DLLs" Name="autoSymlinkCheckBox" Unchecked="UpdateCheckboxes" Checked="UpdateCheckboxes" IsChecked="True"/>
<Button x:Name="eraScan" Margin="0 10 0 10" Click="ShowInstalledEraApps">Scan for installed Era/XbUWP apps</Button>
<Button x:Name="addExistingPackageButton" Click="ShowAppListView">Add existing package</Button>
<Button x:Name="eraScan" Margin="0 10 0 10" Click="ShowInstalledEraApps">Scan for installed Era/XbUWP apps</Button>
<Button x:Name="addExistingPackageButton" Click="ShowAppListView">Add existing package</Button>
</StackPanel>
</Flyout>
</SplitButton.Flyout>

View File

@@ -59,7 +59,14 @@ namespace WinDurango.UI.Pages
private async void ShowInstalledEraApps(object sender, RoutedEventArgs e)
{
AppListDialog dl = new(XHandler.GetXPackages(Packages.GetInstalledPackages().ToList()), true);
List<Windows.ApplicationModel.Package> eraApps = XHandler.GetXPackages(Packages.GetInstalledPackages().ToList());
if (eraApps.Count <= 0)
{
NoticeDialog dialog = new NoticeDialog("No Era/XUWP Apps have been found.");
await dialog.ShowAsync();
return;
}
AppListDialog dl = new(eraApps, true);
dl.Title = "Installed Era/XUWP apps";
dl.XamlRoot = this.Content.XamlRoot;
await dl.ShowAsync();
@@ -148,13 +155,13 @@ namespace WinDurango.UI.Pages
{
// there is no AppxManifest inside.
Logger.WriteError($"Could not find AppxManifest.xml in {folder.Path} and {mountFolder}");
await new NoticeDialog(GetLocalizedText("/Packages/ManifestNotFoundMulti", folder.Path, mountFolder), "Error").Show();
await new NoticeDialog(GetLocalizedText("/Packages/ManifestNotFoundMulti", folder.Path, mountFolder), "Error").ShowAsync();
}
}
else
{
Logger.WriteError($"Could not find AppxManifest.xml in {folder.Path} and no Mount folder exists");
await new NoticeDialog(GetLocalizedText("/Packages/ManifestNotFoundNoMount", folder.Path), "Error").Show();
await new NoticeDialog(GetLocalizedText("/Packages/ManifestNotFoundNoMount", folder.Path), "Error").ShowAsync();
}
return;

View File

@@ -67,7 +67,7 @@ namespace WinDurango.UI.Utils
if (!Directory.Exists(mountDir))
{
await new NoticeDialog(GetLocalizedText($"/Errors/NotFound", mountDir), "Error").Show();
await new NoticeDialog(GetLocalizedText($"/Errors/NotFound", mountDir), "Error").ShowAsync();
return;
}