mirror of
https://github.com/WinDurango/WinDurango.UI.git
synced 2026-01-31 00:55:24 +01:00
AppsListPage horizontal scrolling
This commit is contained in:
@@ -60,10 +60,8 @@
|
||||
</StackPanel>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<ScrollViewer ct:DockPanel.Dock="Top" >
|
||||
<ct:WrapPanel x:Name="appList" HorizontalAlignment="Center" />
|
||||
<ScrollViewer ct:DockPanel.Dock="Top" x:Name="scrollView" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
|
||||
<ct:WrapPanel x:Name="appList" Orientation="Vertical" VerticalAlignment="Center" />
|
||||
</ScrollViewer>
|
||||
</ct:DockPanel>
|
||||
</Page>
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace WinDurango.UI.Pages
|
||||
public async Task InitAppListAsync()
|
||||
{
|
||||
appList.Children.Clear();
|
||||
SwitchScrollDirection(App.Settings.Settings.AppViewIsHorizontalScrolling);
|
||||
|
||||
List<installedPackage> installedPackages = await Task.Run(() => App.InstalledPackages.GetPackages());
|
||||
PackageManager pm = new();
|
||||
@@ -33,17 +34,20 @@ namespace WinDurango.UI.Pages
|
||||
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
|
||||
if (pk != null)
|
||||
{
|
||||
searchMatch = pk.DisplayName ?? pk.Id.Name;
|
||||
string searchMatch = "";
|
||||
try
|
||||
{
|
||||
searchMatch = pk.DisplayName ?? pk.Id.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
searchMatch = pk.Id.Name;
|
||||
}
|
||||
if (searchMatch.Contains(this.SearchBox.Text, StringComparison.InvariantCultureIgnoreCase) == false) continue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
searchMatch = pk.Id.Name;
|
||||
}
|
||||
if (searchMatch.Contains(this.SearchBox.Text, StringComparison.InvariantCultureIgnoreCase) == false) continue;
|
||||
}
|
||||
|
||||
// TODO: add handling for that annoying invalid logo stuff
|
||||
@@ -51,13 +55,11 @@ namespace WinDurango.UI.Pages
|
||||
{
|
||||
try
|
||||
{
|
||||
Grid outerGrid = new();
|
||||
AppTile gameContainer = new(installedPackage.FamilyName);
|
||||
|
||||
this.DispatcherQueue.TryEnqueue(() =>
|
||||
{
|
||||
outerGrid.Children.Add(gameContainer);
|
||||
appList.Children.Add(outerGrid);
|
||||
appList.Children.Add(gameContainer);
|
||||
});
|
||||
|
||||
Logger.WriteDebug($"Added {installedPackage.FamilyName} to the app list");
|
||||
@@ -106,6 +108,23 @@ namespace WinDurango.UI.Pages
|
||||
await dl.ShowAsync();
|
||||
}
|
||||
|
||||
public void SwitchScrollDirection(bool horizontal)
|
||||
{
|
||||
if (horizontal)
|
||||
{
|
||||
scrollView.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||
scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
|
||||
appList.Orientation = Orientation.Vertical;
|
||||
appList.VerticalAlignment = VerticalAlignment.Center;
|
||||
} else
|
||||
{
|
||||
scrollView.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
|
||||
scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||
appList.Orientation = Orientation.Horizontal;
|
||||
appList.VerticalAlignment = VerticalAlignment.Top;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCheckboxes(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (autoSymlinkCheckBox == null || addToAppListCheckBox == null)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<ct:DockPanel ct:DockPanel.Dock="Bottom" Name="bottomBar" Margin="0, 10, 0, 0">
|
||||
<ct:DockPanel ct:DockPanel.Dock="Bottom" x:Name="bottomBar" Margin="0, 10, 0, 0">
|
||||
<!-- For some reason this pushes the folderList to the side a little -->
|
||||
<StackPanel Name="infoBar" HorizontalAlignment="Right" ct:DockPanel.Dock="Left" Orientation="Horizontal" Margin="0, 0, 10, 0"/>
|
||||
<Button Name="viewFolder" ct:DockPanel.Dock="Right" HorizontalAlignment="Right" Click="ViewFolder">
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollView>
|
||||
<!-- TODO: Use SettingsCard -->
|
||||
<!-- TODO: Also make easy way for settings to be set... I believe there is a Tag thing where you can put custom value. Not sure if SettingsCard already has a way.-->
|
||||
<StackPanel Padding="16">
|
||||
<TextBlock Margin="0 5 0 5" Text="Theme"/>
|
||||
<ComboBox
|
||||
@@ -34,6 +36,7 @@
|
||||
<ComboBoxItem Content="Releases" Tag="Release"/>
|
||||
<ComboBoxItem Content="Nightly (GitHub Actions)" Tag="Artifact"/>
|
||||
</ComboBox>
|
||||
<ToggleSwitch OnContent="Make apps list scroll horizontally" OffContent="Make apps list scroll horizontally" Toggled="HorizontalScrollingToggle_Toggled" Name="HorizontalScrollingToggle"/>
|
||||
<TextBlock Margin="0 5 0 5" Text="Other"/>
|
||||
<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>
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace WinDurango.UI.Pages.Settings
|
||||
{
|
||||
themeButton.SelectedItem = themeSelected;
|
||||
}
|
||||
|
||||
HorizontalScrollingToggle.IsOn = App.Settings.Settings.AppViewIsHorizontalScrolling;
|
||||
}
|
||||
|
||||
private void OnThemeSelected(object sender, RoutedEventArgs e)
|
||||
@@ -101,5 +103,14 @@ namespace WinDurango.UI.Pages.Settings
|
||||
((ToggleSwitch)sender).IsOn = true;
|
||||
((ToggleSwitch)sender).OnContent = "Enable debug logging (currently debugging)";
|
||||
}
|
||||
|
||||
private void HorizontalScrollingToggle_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ToggleSwitch toggleSwitch)
|
||||
{
|
||||
App.Settings.Set("AppViewIsHorizontalScrolling", toggleSwitch.IsOn);
|
||||
App.MainWindow.AppsListPage.SwitchScrollDirection(toggleSwitch.IsOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class UiConfigData
|
||||
public uint SaveVersion { get; set; } = App.VerPacked;
|
||||
public ThemeSetting Theme { get; set; } = ThemeSetting.Fluent;
|
||||
public bool DebugLoggingEnabled { get; set; } = false;
|
||||
public bool AppViewIsHorizontalScrolling { get; set; } = false;
|
||||
|
||||
public string Language { get; set; } = "en-US";
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<DisableXbfLineInfo>False</DisableXbfLineInfo>
|
||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<Version>0.1.1</Version>
|
||||
<AssemblyVersion>0.1.1</AssemblyVersion>
|
||||
<Version>0.1.2</Version>
|
||||
<AssemblyVersion>0.1.2</AssemblyVersion>
|
||||
<Product>WinDurango UI</Product>
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user