Merge pull request #7 from Error504TimeOut/main

Minor QOL Changes
This commit is contained in:
Dexrn ZacAttack
2025-02-25 16:51:21 -08:00
committed by GitHub
17 changed files with 64 additions and 45 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

@@ -39,7 +39,7 @@
ItemInvoked="NavigationInvoked"
x:Name="navView">
<NavigationView.MenuItems>
<NavigationViewItem Icon="AllApps" Content="Home" Tag="AppsListPage"/>
<NavigationViewItem Icon="AllApps" Content="Home" Tag="AppsListPage" IsSelected="True"/>
</NavigationView.MenuItems>
<NavigationView.FooterMenuItems>
<NavigationViewItem Content="About" Tag="AboutPage">

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

@@ -16,14 +16,15 @@
<controls:ContributorInfo Margin="0 10 10 10" x:Name="dexrn_Info" HorizontalAlignment="Left"/>
<controls:ContributorInfo Margin="0 10 10 10" x:Name="danilwhale_Info" HorizontalAlignment="Left"/>
</StackPanel>
<TextBlock Text="Repo Contributors" FontSize="24"/>
<TextBlock>
<Run Text="Coming soon (maybe)"/>
<LineBreak/>
<Run Text="contrib.rocks apparently returns some svg instead of a png..."/>
<LineBreak/>
<Run Text="which makes it hard for me to use here."/>
</TextBlock>
<!---
<TextBlock Text="Repo Contributors" FontSize="24"/>
<TextBlock>
<Run Text="Coming soon (maybe)"/>
<LineBreak/>
<Run Text="contrib.rocks apparently returns some svg instead of a png..."/>
<LineBreak/>
<Run Text="which makes it hard for me to use here."/>
</TextBlock>
-->
</StackPanel>
</Page>

View File

@@ -7,19 +7,19 @@ namespace WinDurango.UI.Pages
{
public sealed partial class AboutPage : Page
{
private static string GetGitHubPfp(string username)
private static Uri GetGitHubPfp(string username)
{
return $"https://github.com/{username}.png";
return new Uri($"https://github.com/{username}.png");
}
public AboutPage()
{
this.InitializeComponent();
dexrn_Info.developerPicture.ProfilePicture = new BitmapImage(new Uri(GetGitHubPfp("DexrnZacAttack")));
dexrn_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("DexrnZacAttack"));
dexrn_Info.developerName.Content = "DexrnZacAttack";
dexrn_Info.developerName.NavigateUri = new Uri("https://github.com/DexrnZacAttack");
dexrn_Info.developerInfo.Text = "UI design, functionality, learning C#";
danilwhale_Info.developerPicture.ProfilePicture = new BitmapImage(new Uri(GetGitHubPfp("danilwhale")));
danilwhale_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("danilwhale"));
danilwhale_Info.developerName.Content = "danilwhale";
danilwhale_Info.developerName.NavigateUri = new Uri("https://github.com/danilwhale");
danilwhale_Info.developerInfo.Text = "Refactoring, teaching, bug fixing, etc";
@@ -27,7 +27,7 @@ namespace WinDurango.UI.Pages
windurango_Info.developerInfo.Text = $"Version {App.Version}";
windurango_Info.developerName.Content = "WinDurango.UI";
windurango_Info.developerName.NavigateUri = new Uri("https://github.com/WinDurango/WinDurango.UI");
windurango_Info.developerPicture.ProfilePicture = new BitmapImage(new Uri(GetGitHubPfp("WinDurango")));
windurango_Info.developerPicture.ProfilePicture = new BitmapImage(GetGitHubPfp("WinDurango"));
}
}
}

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

@@ -51,7 +51,14 @@ namespace WinDurango.UI.Pages
private async void ShowAppListView(object sender, RoutedEventArgs e)
{
AppListDialog dl = new(Packages.GetInstalledPackages().ToList(), true);
List<Windows.ApplicationModel.Package> uwpApps = Packages.GetInstalledPackages().ToList();
if (uwpApps.Count <= 0)
{
NoticeDialog dialog = new NoticeDialog("No UWP Apps have been found.");
await dialog.ShowAsync();
return;
}
AppListDialog dl = new(uwpApps, true);
dl.Title = "Installed UWP apps";
dl.XamlRoot = this.Content.XamlRoot;
await dl.ShowAsync();
@@ -59,7 +66,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 +162,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

@@ -8,8 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<StackPanel>
<ScrollView>
<StackPanel Padding="16">
<TextBlock Margin="0 5 0 5" Text="Theme"/>
<ComboBox
x:Name="themeButton"
@@ -38,5 +38,5 @@
<ToggleSwitch OnContent="Enable debug logging" OffContent="Enable debug logging" Toggled="OnDebugLogToggled" Name="DebugLogToggle" Loaded="OnDebugLogToggleLoaded"/>
<Button Name="appdataButton" Margin="0 5 0 5" Click="OpenAppData">Open WinDurango AppData folder</Button>
</StackPanel>
</Grid>
</ScrollView>
</Page>

View File

@@ -10,7 +10,7 @@
BorderThickness="0">
<ScrollViewer>
<StackPanel>
<StackPanel Padding="16">
<TextBlock Margin="0 5 0 5" Text="Layer Settings" FontSize="16" FontWeight="Bold"/>
<Button Margin="0 5 0 5" Click="ManageUsers">Manage users</Button>
<TextBlock Margin="0 5 0 5" Text="Debug" FontSize="16" FontWeight="Bold"/>

View File

@@ -16,9 +16,10 @@
IsBackButtonVisible="Collapsed"
ItemInvoked="NavigationInvoked"
IsSettingsVisible="False"
x:Name="navView">
x:Name="navView"
>
<NavigationView.MenuItems>
<NavigationViewItem Icon="XboxOneConsole" Content="WinDurango Settings" Tag="LayerSettings"/>
<NavigationViewItem Icon="XboxOneConsole" Content="WinDurango Settings" Tag="LayerSettings" IsSelected="True"/>
<NavigationViewItem Icon="NewWindow" Content="UI Settings" Tag="UiSettings"/>
</NavigationView.MenuItems>
<Frame x:Name="contentFrame"/>

View File

@@ -22,7 +22,6 @@ namespace WinDurango.UI.Pages
"UiSettings" => typeof(UiSettings),
_ => typeof(WdSettingsPage)
};
contentFrame.Navigate(pageType);
}

View File

@@ -49,6 +49,7 @@ public class UiConfig : IConfig
{
Logger.WriteWarning($"Settings file doesn't exist");
Generate();
return;
}
try
@@ -108,6 +109,9 @@ public class UiConfig : IConfig
JsonSerializerOptions options = new();
options.WriteIndented = true;
File.WriteAllText(_settingsFile, JsonSerializer.Serialize(Settings, options));
/* FIXME: For some reason unknown to me, App.MainWindow is null here, but only if the Settings were generated before e.g. on first launch
* No biggy in that case as nothing has been customized yet, but depending on the reason this might cause problems.
*/
App.MainWindow.LoadSettings();
}
catch (Exception ex)

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;
}