mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-28 23:19:53 +08:00
库存游戏 界面交互 改进
This commit is contained in:
@@ -107,9 +107,19 @@
|
||||
</ToggleButton>-->
|
||||
<Button x:Name="gridSize" Background="Transparent"
|
||||
Cursor="Hand"
|
||||
Command="{ReflectionBinding AppGridReSize}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_ResizeAppLogo,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Data="{StaticResource GridDrawing}" />
|
||||
<Button.Content>
|
||||
<PathIcon Data="{StaticResource GridDrawing}" />
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<Slider Value="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=TwoWay}"
|
||||
Minimum="50"
|
||||
Maximum="200"
|
||||
Ticks="50,100,150,200"
|
||||
Width="200" />
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
<Button Background="Transparent"
|
||||
Cursor="Hand"
|
||||
@@ -135,7 +145,7 @@
|
||||
</Style>
|
||||
</Button.Styles>
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<Flyout Placement="Bottom" FlyoutPresenterClasses="NoPadding">
|
||||
<Border Width="{Binding $parent.Width}" Height="200">
|
||||
<ScrollViewer Padding="10 5">
|
||||
<ItemsControl Items="{Binding AppTypeFiltres}">
|
||||
@@ -212,16 +222,24 @@
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="0 0 0 10">
|
||||
<ItemsRepeater Items="{Binding SteamApps}">
|
||||
<ItemsRepeater x:Name="Apps" Items="{Binding SteamApps}">
|
||||
<ItemsRepeater.Layout>
|
||||
<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="10" MinColumnSpacing="20" MaximumRowsOrColumns="10" ItemsStretch="Fill" />
|
||||
<UniformGridLayout ItemsJustification="SpaceEvenly"
|
||||
MinRowSpacing="5"
|
||||
MinColumnSpacing="10"
|
||||
MaximumRowsOrColumns="10"
|
||||
ItemsStretch="Fill" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Spacing="8">
|
||||
<Border DockPanel.Dock="Top" Classes="paper" Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Border DockPanel.Dock="Top"
|
||||
Cursor="Hand"
|
||||
x:Name="AppAvater"
|
||||
Classes="paper"
|
||||
Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<MenuFlyout Placement="Auto">
|
||||
<MenuItem
|
||||
Header="{ReflectionBinding Path=Res.GameList_Play,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Command="{ReflectionBinding #u.DataContext.InstallOrStartApp}"
|
||||
@@ -282,9 +300,7 @@
|
||||
<PathIcon Data="{StaticResource FolderOpenDrawing}" Width="14"></PathIcon>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="-"></MenuItem>
|
||||
|
||||
<MenuItem
|
||||
Header="{ReflectionBinding Path=Res.GameList_OpenStoreUrl,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Command="{ReflectionBinding #u.DataContext.OpenAppStoreUrl}"
|
||||
@@ -309,8 +325,8 @@
|
||||
<PathIcon Data="{StaticResource GlobeSearchDrawing}" Width="14"></PathIcon>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
</MenuFlyout>
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
<Panel x:Name="app" Width="{ReflectionBinding $parent.Width}">
|
||||
<!--<i:Interaction.Behaviors>
|
||||
<ia:EventTriggerBehavior EventName="Tapped" SourceObject="{ReflectionBinding #app}">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
using System.Application.UI.ViewModels;
|
||||
@@ -11,6 +12,22 @@ namespace System.Application.UI.Views.Pages
|
||||
public GameListPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var apps = this.FindControl<ItemsRepeater>("Apps");
|
||||
apps.PointerPressed += App_PointerPressed;
|
||||
}
|
||||
|
||||
private void App_PointerPressed(object? sender, Avalonia.Input.PointerPressedEventArgs e)
|
||||
{
|
||||
if (e.Source is Control c)
|
||||
{
|
||||
var border = c.FindParentControl<Border>("AppAvater");
|
||||
if (border is not null)
|
||||
{
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(border);
|
||||
flyout?.ShowAt(border, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
||||
@@ -120,11 +120,22 @@
|
||||
<!--<controls:ScrollingTextBlock HorizontalAlignment="Center" Width="{Binding #panel.Width}" Text="{Binding}" FontSize="14" Foreground="{DynamicResource HighlightForegroundBrushKey}" ></controls:ScrollingTextBlock>-->
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowAuthCode}" CommandParameter="{Binding}"
|
||||
<Button Cursor="Hand"
|
||||
Classes="flatbutton"
|
||||
Command="{ReflectionBinding #u.DataContext.ShowAuthCode}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthCode,Mode=OneWay,Source={x:Static resx:R.Current}}" >
|
||||
<PathIcon Data="{DynamicResource SearchDrawing}" Width="20"></PathIcon>
|
||||
</Button>
|
||||
|
||||
<!--<Button Cursor="Hand"
|
||||
Classes="flatbutton"
|
||||
Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_Copy,Mode=OneWay,Source={x:Static resx:R.Current}}" >
|
||||
<PathIcon Data="{DynamicResource CopyDrawing}" Width="20"></PathIcon>
|
||||
</Button>-->
|
||||
|
||||
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthTrade}" CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthTrade,Mode=OneWay,Source={x:Static resx:R.Current}}" >
|
||||
<PathIcon Data="{DynamicResource TradeDrawing}" Width="20"></PathIcon>
|
||||
@@ -141,7 +152,11 @@
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}" CommandParameter="{Binding}" HorizontalAlignment="Right"
|
||||
<Button Cursor="Hand"
|
||||
Classes="flatbutton"
|
||||
Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}"
|
||||
CommandParameter="{Binding}"
|
||||
HorizontalAlignment="Right"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_Copy,Mode=OneWay,Source={x:Static resx:R.Current}}" >
|
||||
<PathIcon Data="{DynamicResource CopyDrawing}" Width="20"></PathIcon>
|
||||
</Button>
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
<Style Selector="Separator">
|
||||
<Setter Property="Margin" Value="8 0"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.MenuButton">
|
||||
<Setter Property="Command" Value="{Binding MenuClickCommand}"></Setter>
|
||||
<Setter Property="CommandParameter" Value="{ReflectionBinding $self.Content}"></Setter>
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<DockPanel Margin="0 8 0 0">
|
||||
@@ -57,15 +62,39 @@
|
||||
</DockPanel>
|
||||
<Separator Classes="Separator"/>
|
||||
<StackPanel>
|
||||
<Button Content="{ReflectionBinding Path=Res.CommunityFix,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.ScriptConfig,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.UserFastChange,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.GameList,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.LocalAuth,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.CommunityFix,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.ScriptConfig,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.UserFastChange,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.GameList,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.LocalAuth,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"
|
||||
x:Name="LocalMenu">
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<MenuFlyout Placement="RightEdgeAlignedTop" ShowMode="TransientWithDismissOnPointerMoveAway">
|
||||
<MenuItem Header="Item 1">
|
||||
<MenuItem Header="Subitem 1" />
|
||||
<MenuItem Header="Subitem 2" />
|
||||
<MenuItem Header="Subitem 3" />
|
||||
<MenuItem Header="Subitem 4" />
|
||||
<MenuItem Header="Subitem 5" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="Item 2" InputGesture="Ctrl+A" />
|
||||
<MenuItem Header="Item 3" />
|
||||
<MenuItem Header="Item 4" />
|
||||
<MenuItem Header="Item 5" />
|
||||
<MenuItem Header="Item 6" />
|
||||
</MenuFlyout>
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<Separator Classes="Separator"/>
|
||||
<StackPanel>
|
||||
<Button Content="{ReflectionBinding Path=Res.About,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="{ReflectionBinding $self.Content}"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.About,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Classes="MenuButton"></Button>
|
||||
<Button Content="{ReflectionBinding Path=Res.Exit,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding MenuClickCommand}" CommandParameter="Exit"></Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using ReactiveUI;
|
||||
using System.Application.Services;
|
||||
@@ -9,6 +10,8 @@ namespace System.Application.UI.Views.Windows
|
||||
{
|
||||
public partial class TaskBarWindow : Window
|
||||
{
|
||||
private bool IsPointerOverSubMenu = false;
|
||||
|
||||
public TaskBarWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -24,14 +27,47 @@ namespace System.Application.UI.Views.Windows
|
||||
|
||||
this.Opened += Window_Opened;
|
||||
this.LostFocus += Window_LostFocus;
|
||||
|
||||
//var localbtn = this.FindControl<Button>("LocalMenu");
|
||||
|
||||
//if (localbtn != null)
|
||||
//{
|
||||
// localbtn.PointerEnter += MenuButton_PointerEnter;
|
||||
// //localbtn.PointerLeave += MenuButton_PointerLeave;
|
||||
//}
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void MenuButton_PointerLeave(object? sender, Avalonia.Input.PointerEventArgs e)
|
||||
{
|
||||
if (sender is Control c)
|
||||
{
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(c);
|
||||
flyout?.Hide();
|
||||
IsPointerOverSubMenu = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuButton_PointerEnter(object? sender, Avalonia.Input.PointerEventArgs e)
|
||||
{
|
||||
if (sender is Control c && !IsPointerOverSubMenu)
|
||||
{
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(c);
|
||||
if (flyout is not null)
|
||||
{
|
||||
flyout.ShowAt(c);
|
||||
IsPointerOverSubMenu = flyout.IsOpen;
|
||||
flyout.Closed += (sender, e) => IsPointerOverSubMenu = flyout.IsOpen;
|
||||
c.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_LostFocus(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (!this.IsPointerOver)
|
||||
if (!this.IsPointerOver && !IsPointerOverSubMenu)
|
||||
{
|
||||
if (this.DataContext is TaskBarWindowViewModel vm)
|
||||
{
|
||||
@@ -74,7 +110,6 @@ namespace System.Application.UI.Views.Windows
|
||||
DI.Get<ISystemWindowApiService>().SetActiveWindow(new Models.HandleWindow { Handle = this.PlatformImpl.Handle.Handle });
|
||||
}
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace System
|
||||
{
|
||||
public static class ControlExtensions
|
||||
{
|
||||
public static IControl? FindParentControl(this IControl? c, string name)
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
if (c.Name == name)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
if (c.Parent != null)
|
||||
{
|
||||
return c.Parent.FindParentControl(name);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static T? FindParentControl<T>(this IControl? c, string name) where T : class, IControl
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
if (c.Name == name && c is T t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
if (c.Parent != null)
|
||||
{
|
||||
return c.Parent.FindParentControl<T>(name);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using DynamicData;
|
||||
using System.Application.Serialization;
|
||||
using System.Application.Services;
|
||||
using System.Application.UI.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -9,6 +11,12 @@ namespace System.Application.Models.Settings
|
||||
static UISettings()
|
||||
{
|
||||
//Theme.ValueChanged += Theme_ValueChanged;
|
||||
AppGridSize.ValueChanged += AppGridSize_ValueChanged;
|
||||
}
|
||||
|
||||
private static void AppGridSize_ValueChanged(object? sender, ValueChangedEventArgs<int> e)
|
||||
{
|
||||
SteamConnectService.Current.SteamApps.Refresh();
|
||||
}
|
||||
|
||||
//private static void Theme_ValueChanged(object sender, ValueChangedEventArgs<short> e)
|
||||
|
||||
@@ -362,11 +362,7 @@ namespace System.Application.UI.ViewModels
|
||||
|
||||
public void AppGridReSize()
|
||||
{
|
||||
//var back = SteamConnectService.Current.SteamApps.Items;
|
||||
//SteamConnectService.Current.SteamApps.Clear();
|
||||
UISettings.AppGridSize.Value = UISettings.AppGridSize.Value == 200 ? 150 : 200;
|
||||
SteamConnectService.Current.SteamApps.Refresh();
|
||||
//SteamConnectService.Current.RefreshGamesList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user