mirror of
https://github.com/WinDurango/WinDurango.UI.git
synced 2026-01-31 00:55:24 +01:00
BIN
Assets/no_img64.png
Normal file
BIN
Assets/no_img64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -159,7 +159,7 @@ namespace WinDurango.UI.Controls
|
||||
{
|
||||
Flyout flyout = new Flyout();
|
||||
TextBlock title = new TextBlock { Text = $"Rename {_displayName}" };
|
||||
TextBox box = new TextBox();
|
||||
TextBox box = new TextBox { Text = _displayName };
|
||||
Button button = new Button();
|
||||
box.KeyDown += (sender, e) =>
|
||||
{
|
||||
|
||||
@@ -10,13 +10,13 @@ using Image = Microsoft.UI.Xaml.Controls.Image;
|
||||
|
||||
namespace WinDurango.UI.Dialogs
|
||||
{
|
||||
public sealed partial class AppListDialog : ContentDialog
|
||||
public sealed partial class AppListDialog
|
||||
{
|
||||
public List<Package> Pkgs { get; set; } = new List<Package>();
|
||||
public List<Package> Packages { get; set; }
|
||||
|
||||
public AppListDialog(List<Package> packages, bool multiSelect = false)
|
||||
{
|
||||
this.Pkgs = packages;
|
||||
this.Packages = packages;
|
||||
|
||||
this.DataContext = this;
|
||||
|
||||
@@ -35,15 +35,13 @@ namespace WinDurango.UI.Dialogs
|
||||
|
||||
var listView = (ListView)sender;
|
||||
|
||||
foreach (var pkg in Pkgs)
|
||||
foreach (Package pkg in Packages)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.MinWidth = 200;
|
||||
|
||||
var stackPanel = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal
|
||||
};
|
||||
// if we already have the package "installed" we will skip it (not show it in the AppListView)
|
||||
if (App.InstalledPackages.GetPackages().Find(p => p.FamilyName == pkg.Id.FamilyName) != null) continue;
|
||||
|
||||
ListViewItem item = new() { MinWidth = 200 };
|
||||
StackPanel stackPanel = new() { Orientation = Orientation.Horizontal };
|
||||
|
||||
// NOTE: DO NOT TOUCH THIS MAGICAL SHIT
|
||||
// it throws massive error if the image is invalid somehow or whatever...
|
||||
@@ -51,21 +49,23 @@ namespace WinDurango.UI.Dialogs
|
||||
try
|
||||
{
|
||||
pkLogo = pkg.Logo;
|
||||
} catch (Exception ex) {
|
||||
Logger.WriteError($"pkg.Logo threw {ex.GetType().ToString()} for {pkg.Id.FamilyName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteError($"pkg.Logo threw {ex.GetType()} for {pkg.Id.FamilyName}");
|
||||
Logger.WriteException(ex);
|
||||
}
|
||||
|
||||
var packageLogo = new Image
|
||||
// Some app logos are "empty" but pkg.Logo isn't null on them, why microsoft??
|
||||
Image packageLogo = new()
|
||||
{
|
||||
Width = 64,
|
||||
Height = 64,
|
||||
Margin = new Thickness(5),
|
||||
Source = new BitmapImage(pkLogo ?? new Uri("ms-appx:///Assets/testimg.png"))
|
||||
Source = new BitmapImage(pkLogo ?? new Uri("ms-appx:///Assets/no_img64.png"))
|
||||
};
|
||||
//packageLogo.ImageFailed += LogoFailed;
|
||||
|
||||
var packageInfo = new StackPanel
|
||||
StackPanel packageInfo = new()
|
||||
{
|
||||
Orientation = Orientation.Vertical,
|
||||
Margin = new Thickness(5)
|
||||
@@ -81,16 +81,13 @@ namespace WinDurango.UI.Dialogs
|
||||
displayName = pkg.Id.Name;
|
||||
}
|
||||
|
||||
var packageName = new TextBlock
|
||||
TextBlock packageName = new()
|
||||
{
|
||||
Text = displayName ?? "Unknown",
|
||||
FontWeight = FontWeights.Bold
|
||||
};
|
||||
|
||||
var publisherName = new TextBlock
|
||||
{
|
||||
Text = pkg.PublisherDisplayName ?? "Unknown"
|
||||
};
|
||||
TextBlock publisherName = new() { Text = pkg.PublisherDisplayName ?? "Unknown" };
|
||||
|
||||
packageInfo.Children.Add(packageName);
|
||||
packageInfo.Children.Add(publisherName);
|
||||
@@ -105,15 +102,7 @@ namespace WinDurango.UI.Dialogs
|
||||
listView.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LogoFailed(object sender, ExceptionRoutedEventArgs e)
|
||||
{
|
||||
//var image = sender as Image;
|
||||
//image.Source = new BitmapImage(new Uri("ms-appx:///Assets/testimg.png"));
|
||||
}
|
||||
|
||||
|
||||
private void AddToAppList(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
foreach (ListViewItem listViewItem in appListView.SelectedItems)
|
||||
|
||||
@@ -9,6 +9,36 @@
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<ct:DockPanel>
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" ct:DockPanel.Dock="Bottom" Name="controlList">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition MinWidth="189" Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<SplitButton
|
||||
Grid.Column="0"
|
||||
Margin="0,10,0,10"
|
||||
Click="InstallButton_Tapped"
|
||||
x:Name="installButton">
|
||||
|
||||
Install Package
|
||||
<SplitButton.Flyout>
|
||||
<Flyout Placement="Top">
|
||||
<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>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
<!-- Temp placement for search box, will be moved once there's ui stuff done in "top area"-->
|
||||
<AutoSuggestBox x:Name="SearchBox" TextChanged="SearchBox_TextChanged" Margin="12, 10, 0, 10" PlaceholderText="Search" QueryIcon="Find" Grid.Column="1"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Old code of ^, restore to this once we move search box -->
|
||||
<!--
|
||||
<StackPanel ct:DockPanel.Dock="Bottom" Name="controlList">
|
||||
<SplitButton
|
||||
HorizontalAlignment="Center"
|
||||
@@ -28,6 +58,10 @@
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
</StackPanel>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<ScrollViewer ct:DockPanel.Dock="Top" >
|
||||
<ct:WrapPanel x:Name="appList" HorizontalAlignment="Center" />
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Management.Deployment;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.Pickers;
|
||||
@@ -29,6 +30,22 @@ namespace WinDurango.UI.Pages
|
||||
|
||||
foreach (installedPackage installedPackage in installedPackages)
|
||||
{
|
||||
if (this.SearchBox.Text.Length > 0)
|
||||
{
|
||||
// Maybe we should at some point save the package Name/DisplayName to installedPackage model too? to skip this step
|
||||
string searchMatch = "";
|
||||
Package pk = Packages.GetPackageByFamilyName(installedPackage.FamilyName);
|
||||
try
|
||||
{
|
||||
searchMatch = pk.DisplayName ?? pk.Id.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
searchMatch = pk.Id.Name;
|
||||
}
|
||||
if (searchMatch.Contains(this.SearchBox.Text, StringComparison.InvariantCultureIgnoreCase) == false) continue;
|
||||
}
|
||||
|
||||
// TODO: add handling for that annoying invalid logo stuff
|
||||
if (pm.FindPackageForUser(WindowsIdentity.GetCurrent().User?.Value, installedPackage.FullName) != null)
|
||||
{
|
||||
@@ -112,6 +129,12 @@ namespace WinDurango.UI.Pages
|
||||
*/
|
||||
}
|
||||
|
||||
private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
||||
{
|
||||
if (args.Reason != AutoSuggestionBoxTextChangeReason.UserInput) return;
|
||||
_ = InitAppListAsync();
|
||||
}
|
||||
|
||||
// needs to be cleaned
|
||||
private async void InstallButton_Tapped(SplitButton sender, SplitButtonClickEventArgs args)
|
||||
{
|
||||
|
||||
@@ -20,11 +20,11 @@ For building you'll need Visual Studio 2022 with the following:
|
||||
- [X] Allow for any existing installed package to be added to the applist
|
||||
- [ ] Built in updater
|
||||
- [ ] Resize content to fit to screen
|
||||
- [ ] Allow for search
|
||||
- [X] Allow for search
|
||||
|
||||
## Bugs/Improvements
|
||||
- [X] Make the applist not go offscreen (lol)
|
||||
- [ ] Fix UI load speed when loading a lot of packages on startup
|
||||
- [X] Fix UI load speed when loading a lot of packages on startup
|
||||
- [X] Applist scrolling
|
||||
- [X] Fix icon in the titlebar
|
||||
- [ ] Repo contributors on the about screen
|
||||
|
||||
@@ -63,15 +63,15 @@ namespace WinDurango.UI.Utils
|
||||
|
||||
string dlLink = wdRelease.DownloadLink;
|
||||
string relName = wdRelease.Name;
|
||||
string dlPath = $"WinDurangoCore.zip";
|
||||
string dlPath = "WinDurangoCore.zip";
|
||||
|
||||
// see this is quite messy but just needed to get it to work
|
||||
if (App.Settings.Settings.DownloadSource == UiConfigData.PatchSource.Artifact)
|
||||
{
|
||||
dlLink = "https://nightly.link/WinDurango/WinDurango/workflows/msbuild/main/WinDurango-Release.zip";
|
||||
dlPath = $"WinDurangoCore-ARTIFACT.zip";
|
||||
dlPath = "WinDurangoCore-ARTIFACT.zip";
|
||||
patchesPath = Path.Combine(App.DataDir, "WinDurangoCore-ARTIFACT");
|
||||
relName = $"latest GitHub Actions artifact";
|
||||
relName = "latest GitHub Actions artifact";
|
||||
}
|
||||
|
||||
if (!Path.Exists(patchesPath) || forceRedownload)
|
||||
@@ -102,6 +102,17 @@ namespace WinDurango.UI.Utils
|
||||
Directory.CreateDirectory(patchesPath);
|
||||
controller?.Update("Extracting", 40);
|
||||
ZipFile.ExtractToDirectory(archivePath, patchesPath);
|
||||
|
||||
// Delete the archive after extracting it
|
||||
try
|
||||
{
|
||||
File.Delete(archivePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.WriteWarning($"Failed to remove {archivePath}, after extracting it.");
|
||||
Logger.WriteException(e);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user