💄 TitleBar

This commit is contained in:
RMBGAME
2023-08-01 14:57:34 +08:00
parent 71fb354f51
commit 0e3b480ea1
18 changed files with 313 additions and 430 deletions
+14 -5
View File
@@ -135,8 +135,8 @@
{
"TypeName": "double",
"PropertyName": "WindowBackgroundOpacity",
"DefaultValue": ".0",
"DefaultValueIsConst": true,
"DefaultValue": "OperatingSystem2.IsWindows11AtLeast() ? .0 : .8",
"DefaultValueIsConst": false,
"Summary": "窗口背景不透明度",
"IsRegionOrEndregion": null,
"IsValueType": null
@@ -460,9 +460,6 @@
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"Sharp": "endif"
},
{
"TypeName": "bool",
"PropertyName": "IsAutoRunSteam",
@@ -499,6 +496,15 @@
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "bool",
"PropertyName": "IsRunSteamVGUI",
"DefaultValue": "false",
"DefaultValueIsConst": true,
"Summary": "Steam 以旧版VGUI启动",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "bool",
"PropertyName": "IsEnableSteamLaunchNotification",
@@ -525,6 +531,9 @@
"Summary": "Steam 以管理员权限运行",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"Sharp": "endif"
}
],
"Usings": ""
@@ -9,7 +9,10 @@ public sealed class StringFormatConverter : IValueConverter, IMultiValueConverte
static object? Format(object? value, object? parameter, CultureInfo culture)
{
if (value is bool b) return b ? Strings.On : Strings.Off;
if (value is bool b)
return b ? Strings.On : Strings.Off;
if (value is TimeSpan t)
return t.ToDisplayString();
if (value is not string str) str = value?.ToString() ?? string.Empty;
if (parameter is not string para) para = parameter?.ToString() ?? string.Empty;
if (!string.IsNullOrEmpty(para))
@@ -4,79 +4,62 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
d:DesignHeight="65"
xmlns:wnd="using:FluentAvalonia.UI.Windowing"
d:DesignHeight="{StaticResource TitleBarHeight}"
d:DesignWidth="1080"
mc:Ignorable="d"
Background="Transparent">
<UserControl.Styles>
<!-- AutoCompleteBox -->
<Style Selector="AutoCompleteBox.Search /template/ TextBox#PART_TextBox">
<Setter Property="InnerRightContent">
<Template>
<StackPanel Orientation="Horizontal">
<Button
Command="{Binding $parent[TextBox].Clear}"
Content="&#xE8BB;"
FontFamily="{StaticResource SymbolThemeFontFamily}"
IsVisible="{Binding Text, RelativeSource={RelativeSource FindAncestor, AncestorType=TextBox}, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Theme="{StaticResource TransparentButton}" />
<Button
Command="{Binding $parent[TextBox].Clear}"
Content="&#xE721;"
FontFamily="{StaticResource SymbolThemeFontFamily}"
IsHitTestVisible="False"
Theme="{StaticResource TransparentButton}" />
</StackPanel>
</Template>
</Setter>
</Style>
</UserControl.Styles>
<Grid ColumnDefinitions="65,Auto,*,100">
<Button
Width="40"
Height="40"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0">
<ui:SymbolIcon Symbol="Back" />
</Button>
<StackPanel
Grid.Column="1"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="8">
<Image Width="16"
Height="16"
HorizontalAlignment="Left"
VerticalAlignment="Center"
IsVisible="{Binding Icon,Converter={StaticResource IsNullConverter},ConverterParameter=invert}"/>
<TextBlock Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
</StackPanel>
<Border Grid.Column="2" Padding="6">
<AutoCompleteBox
VerticalAlignment="Center"
Name="SearchBox"
MaxWidth="500"
Classes="Search"
Watermark="Search" />
</Border>
<!--<StackPanel Grid.Column="4" Orientation="Horizontal">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Margin" Value="2 1" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="PathIcon">
<Setter Property="Width" Value="12" />
</Style>
</StackPanel.Styles>
-->
<!--<spp:MinMaxCloseControl />-->
<!--
</StackPanel>-->
</Grid>
Background="Transparent"
mc:Ignorable="d">
<Grid Height="{StaticResource TitleBarHeight}" Background="Transparent">
<Grid.ColumnDefinitions>
<OnPlatform Default="Auto,Auto,*,Auto">
<On Content="Auto,Auto,*,Auto,140" Options="Windows" />
</OnPlatform>
</Grid.ColumnDefinitions>
<Image
Name="BarIcon"
Grid.Column="0"
Width="26"
Height="26"
Margin="22,4,12,4"
VerticalAlignment="Center"
DockPanel.Dock="Left"
IsHitTestVisible="False"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="avares://BD.WTTS.Client.Avalonia/UI/Assets/ApplicationIcon.ico" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
IsHitTestVisible="False"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<Border
Grid.Column="2"
Padding="6"
VerticalAlignment="Center"
IsVisible="{Binding IsShowSearchBox, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}">
<AutoCompleteBox
Name="SearchBox"
MaxWidth="500"
VerticalAlignment="Center"
wnd:AppWindow.AllowInteractionInTitleBar="True"
Classes="Search"
Text="{Binding SearchText, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" />
</Border>
<DockPanel Grid.Column="3" IsVisible="{Binding ActionContent, Mode=OneWay, Converter={StaticResource IsNullConverter}, ConverterParameter=invert, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}">
<ContentControl Content="{Binding ActionContent, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" DockPanel.Dock="Left" />
<Separator
Height="18"
Margin="10,0"
VerticalAlignment="Center"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
</DockPanel>
</Grid>
</UserControl>
@@ -5,11 +5,31 @@ namespace BD.WTTS.UI.Views.Controls;
public partial class TitleBar : UserControl
{
public Image WindowIcon => BarIcon;
/// <summary>
/// Defines the <see cref="Source"/> property.
/// Defines the <see cref="Icon"/> property.
/// </summary>
public static readonly StyledProperty<IImage?> IconProperty =
AvaloniaProperty.Register<TitleBar, IImage?>(nameof(Icon));
Image.SourceProperty.AddOwner<TitleBar>();
/// <summary>
/// Defines the <see cref="ActionContent"/> property.
/// </summary>
public static readonly StyledProperty<object?> ActionContentProperty =
AvaloniaProperty.Register<TitleBar, object?>(nameof(ActionContent));
/// <summary>
/// Defines the <see cref="IsShowSearchBox"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsShowSearchBoxProperty =
AvaloniaProperty.Register<TitleBar, bool>(nameof(IsShowSearchBox));
/// <summary>
/// Defines the <see cref="SearchText"/> property.
/// </summary>
public static readonly StyledProperty<string> SearchTextProperty =
AvaloniaProperty.Register<TitleBar, string>(nameof(SearchText));
public IImage? Icon
{
@@ -17,6 +37,24 @@ public partial class TitleBar : UserControl
set { SetValue(IconProperty, value); }
}
public object? ActionContent
{
get { return GetValue(ActionContentProperty); }
set { SetValue(ActionContentProperty, value); }
}
public bool IsShowSearchBox
{
get { return GetValue(IsShowSearchBoxProperty); }
set { SetValue(IsShowSearchBoxProperty, value); }
}
public string SearchText
{
get { return GetValue(SearchTextProperty); }
set { SetValue(SearchTextProperty, value); }
}
public TitleBar()
{
InitializeComponent();
@@ -119,65 +119,9 @@
</UserControl.Styles>
<Grid RowDefinitions="Auto, *">
<Grid
Name="TitleBarHost"
Height="{StaticResource TitleBarHeight}"
VerticalAlignment="Center"
Background="Transparent"
ColumnDefinitions="Auto,Auto,Auto,*,Auto,150">
<!--<Panel Width="90"
Height="75">
<Button
Name="BackViewButton"
Width="36"
Height="36"
HorizontalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Hand">
<Viewbox Height="18" Width="18">
<ui:SymbolIcon Symbol="Back"/>
</Viewbox>
</Button>
</Panel>-->
<Image
Name="WindowIcon"
Grid.Column="1"
Width="26"
Height="26"
Margin="22,4,10,4"
DockPanel.Dock="Left"
IsHitTestVisible="False"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="avares://BD.WTTS.Client.Avalonia/UI/Assets/ApplicationIcon.ico" />
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
FontSize="12"
IsHitTestVisible="False"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<!--<Border
Grid.Column="3"
Padding="6"
VerticalAlignment="Center">
<AutoCompleteBox
Name="SearchBox"
MaxWidth="500"
VerticalAlignment="Center"
wnd:AppWindow.AllowInteractionInTitleBar="True"
Classes="Search" />
</Border>-->
<DockPanel Grid.Column="4">
<StackPanel
DockPanel.Dock="Left"
Orientation="Horizontal"
Spacing="8">
<spp:TitleBar Name="TitleBarHost">
<spp:TitleBar.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button
Width="40"
Height="40"
@@ -335,16 +279,8 @@
</DropDownButton.Flyout>
</DropDownButton>
</StackPanel>
<Separator
Height="18"
Margin="10,0"
VerticalAlignment="Center"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
</DockPanel>
</Grid>
</spp:TitleBar.ActionContent>
</spp:TitleBar>
<ui:NavigationView
Name="NavView"
@@ -104,7 +104,7 @@ public sealed partial class MainView : ReactiveUserControl<MainWindowViewModel>
private async void AnimateContentForBackButton(bool show)
{
if (!WindowIcon.IsVisible)
if (!TitleBarHost.WindowIcon.IsVisible)
return;
if (show)
@@ -135,7 +135,7 @@ public sealed partial class MainView : ReactiveUserControl<MainWindowViewModel>
}
};
await ani.RunAsync(WindowIcon);
await ani.RunAsync(TitleBarHost.WindowIcon);
NavView.IsBackButtonVisible = true;
}
@@ -169,7 +169,7 @@ public sealed partial class MainView : ReactiveUserControl<MainWindowViewModel>
}
};
await ani.RunAsync(WindowIcon);
await ani.RunAsync(TitleBarHost.WindowIcon);
}
}
}
@@ -20,55 +20,11 @@
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid RowDefinitions="Auto, *">
<Grid
Name="TitleBarHost"
Height="{StaticResource TitleBarHeight}"
Background="Transparent"
ColumnDefinitions="Auto,Auto,*,Auto,150">
<Image
Name="WindowIcon"
Grid.Column="0"
Width="26"
Height="26"
Margin="22,4,12,4"
VerticalAlignment="Center"
DockPanel.Dock="Left"
IsHitTestVisible="False"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="avares://BD.WTTS.Client.Avalonia/UI/Assets/ApplicationIcon.ico" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
IsHitTestVisible="False"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<Border
Grid.Column="2"
Padding="6"
VerticalAlignment="Center"
IsVisible="{Binding IsShowSearchBox}">
<AutoCompleteBox
Name="SearchBox"
MaxWidth="500"
VerticalAlignment="Center"
wnd:AppWindow.AllowInteractionInTitleBar="True"
Classes="Search" />
</Border>
<DockPanel Grid.Column="3" IsVisible="{Binding ActionContent, Mode=OneWay, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<ContentControl Content="{Binding ActionContent}" DockPanel.Dock="Left" />
<Separator
Height="18"
Margin="10,0"
VerticalAlignment="Center"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
</DockPanel>
</Grid>
<spp:TitleBar Name="TitleBarHost">
<spp:TitleBar.ActionContent>
111
</spp:TitleBar.ActionContent>
</spp:TitleBar>
<ContentControl
Name="ViewContent"
Grid.Row="1"
@@ -20,7 +20,8 @@ public partial class ProxyChartView : UserControl
EnableNullSplitting = false,
DataLabelsSize = 12,
//Stroke = LiveChartsSkiaSharp.DefaultPaint,
YToolTipLabelFormatter = (e) => $"Upload {IOPath.GetDisplayFileSizeString(e.Coordinate.PrimaryValue)}/s",
Name = Strings.Upload,
YToolTipLabelFormatter = (e) => $"{IOPath.GetDisplayFileSizeString(e.Coordinate.PrimaryValue)}/s",
Mapping = (rate, point) =>
{
point.Coordinate = new(rate.Timestamp, rate.Rate);
@@ -37,8 +38,9 @@ public partial class ProxyChartView : UserControl
LineSmoothness = 1,
EnableNullSplitting = false,
DataLabelsSize = 12,
Name = Strings.Download,
//Stroke = LiveChartsSkiaSharp.DefaultPaint,
YToolTipLabelFormatter = (e) => $"Download {IOPath.GetDisplayFileSizeString(e.Coordinate.PrimaryValue)}/s",
YToolTipLabelFormatter = (e) => $"{IOPath.GetDisplayFileSizeString(e.Coordinate.PrimaryValue)}/s",
Mapping = (rate, point) =>
{
point.Coordinate = new(rate.Timestamp, rate.Rate);
@@ -90,6 +90,9 @@
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<!--<Run Text="{ReflectionBinding Path=Res.CommunityFix_StopProxy,Source={x:Static s:ResourceService.Current}},Mode=OneWay}" />
<Run Text=" " />
<Run Text="{ReflectionBinding Path=AccelerateTime,Source={x:Static s:ProxyService.Current}},Mode=OneWay,Converter={StaticResource StringFormatConverter}}" />-->
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding
@@ -97,10 +100,10 @@
Path="Res.CommunityFix_StopProxy"
Source="{x:Static s:ResourceService.Current}}" />
<Binding
Converter="{StaticResource StringFormatConverter}"
Mode="OneWay"
Path="AccelerateTime"
Source="{x:Static s:ProxyService.Current}"
StringFormat="{}{0:hh\:mm\:ss}" />
Source="{x:Static s:ProxyService.Current}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
@@ -19,105 +19,67 @@
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid RowDefinitions="Auto, *">
<Grid
<spp:TitleBar
Name="TitleBarHost"
Height="{StaticResource TitleBarHeight}"
Background="Transparent"
ColumnDefinitions="Auto,Auto,*,Auto,150">
<Image
Name="WindowIcon"
Grid.Column="0"
Width="26"
Height="26"
Margin="22,4,12,4"
VerticalAlignment="Center"
DockPanel.Dock="Left"
IsHitTestVisible="False"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="avares://BD.WTTS.Client.Avalonia/UI/Assets/ApplicationIcon.ico" />
IsShowSearchBox="True"
SearchText="{Binding SearchText, Mode=TwoWay}">
<spp:TitleBar.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding RefreshStats_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_RefreshTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding ResetAllStats_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_ResetTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Redo" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding SaveChange_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_StoreTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="SaveFilled" />
</Viewbox>
</Button>
</StackPanel>
</spp:TitleBar.ActionContent>
</spp:TitleBar>
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
IsHitTestVisible="False"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<Border
Grid.Column="2"
Padding="6"
VerticalAlignment="Center">
<AutoCompleteBox
Name="SearchBox"
MaxWidth="500"
VerticalAlignment="Center"
wnd:AppWindow.AllowInteractionInTitleBar="True"
Classes="Search"
Text="{Binding SearchText, Mode=TwoWay}" />
</Border>
<DockPanel Grid.Column="3">
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding RefreshStats_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_RefreshTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding ResetAllStats_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_ResetTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Redo" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding SaveChange_Click}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.Achievement_StoreTip,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="SaveFilled" />
</Viewbox>
</Button>
<Separator
Height="18"
Margin="10,0"
VerticalAlignment="Center"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
</DockPanel>
</Grid>
<spp:ContentLoader Grid.Row="1" IsLoading="{Binding !!!Achievements.Count, Mode=OneWay}">
<TabControl Padding="0">
<TabItem Header="{ReflectionBinding Path=Res.Achievement_Unlock, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
@@ -20,106 +20,65 @@
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid RowDefinitions="Auto, *">
<Grid
Name="TitleBarHost"
Height="{StaticResource TitleBarHeight}"
Background="Transparent"
ColumnDefinitions="Auto,Auto,*,Auto,150">
<Image
Name="WindowIcon"
Grid.Column="0"
Width="26"
Height="26"
Margin="22,4,12,4"
VerticalAlignment="Center"
DockPanel.Dock="Left"
IsHitTestVisible="False"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="avares://BD.WTTS.Client.Avalonia/UI/Assets/ApplicationIcon.ico" />
<spp:TitleBar Name="TitleBarHost">
<spp:TitleBar.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding RefreshList}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.RefreshList,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding UploadFile}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_UploadCloudArchiveFile,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="OpenFile" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding ClearAllFiles}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RemoveBtn,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="DeleteFilled" />
</Viewbox>
</Button>
</StackPanel>
</spp:TitleBar.ActionContent>
</spp:TitleBar>
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
IsHitTestVisible="False"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<!--<Border
Grid.Column="2"
Padding="6"
VerticalAlignment="Center">
<AutoCompleteBox
Name="SearchBox"
MaxWidth="500"
VerticalAlignment="Center"
wnd:AppWindow.AllowInteractionInTitleBar="True"
Classes="Search"
Text="{Binding SearchText, Mode=TwoWay}" />
</Border>-->
<DockPanel Grid.Column="3">
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding RefreshList}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.RefreshList,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding UploadFile}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_UploadCloudArchiveFile,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="OpenFile" />
</Viewbox>
</Button>
<Button
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding ClearAllFiles}"
Theme="{DynamicResource TransparentButton}"
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RemoveBtn,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="DeleteFilled" />
</Viewbox>
</Button>
<Separator
Height="18"
Margin="10,0"
VerticalAlignment="Center"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
</DockPanel>
</Grid>
<spp:ContentLoader Grid.Row="1" IsLoading="{Binding !!!CloudArchivews.Count, Mode=OneWay}">
<spp:ContentLoader Grid.Row="1" IsLoading="{Binding IsLoading}">
<Panel>
<StackPanel
HorizontalAlignment="Right"
@@ -253,9 +253,8 @@ public sealed class SteamConnectService
if (!stmService.IsRunningSteamProcess && SteamSettings.IsAutoRunSteam.Value)
stmService.StartSteamWithParameter();
Task.Factory.StartNew(async () =>
Task2.InBackground(async () =>
{
Thread.CurrentThread.IsBackground = true;
while (true)
{
try
@@ -343,7 +342,7 @@ public sealed class SteamConnectService
await Task.Delay(3000);
}
}
}, TaskCreationOptions.LongRunning).ConfigureAwait(false);
});
}
public bool Initialize(int appid)
@@ -52,8 +52,6 @@ public partial interface ISteamSettings
/// </summary>
static readonly string DefaultSteamProgramPath = Ioc.Get<ISteamService>().SteamProgramPath;
#endif
/// <summary>
/// 自动运行 Steam
/// </summary>
@@ -94,6 +92,16 @@ public partial interface ISteamSettings
/// </summary>
const bool DefaultIsRunSteamChina = false;
/// <summary>
/// Steam 以旧版VGUI启动
/// </summary>
bool? IsRunSteamVGUI { get; set; }
/// <summary>
/// Steam 以旧版VGUI启动的默认值
/// </summary>
const bool DefaultIsRunSteamVGUI = false;
/// <summary>
/// Steam 登录时弹出消息通知
/// </summary>
@@ -124,4 +132,6 @@ public partial interface ISteamSettings
/// </summary>
const bool DefaultIsRunSteamAdministrator = false;
#endif
}
@@ -134,7 +134,7 @@ public partial interface IUISettings
/// <summary>
/// 窗口背景不透明度的默认值
/// </summary>
const double DefaultWindowBackgroundOpacity = .0;
static readonly double DefaultWindowBackgroundOpacity = OperatingSystem2.IsWindows11AtLeast() ? .0 : .8;
/// <summary>
/// 窗口背景材质
@@ -8,41 +8,52 @@ namespace BD.WTTS.Settings;
public static partial class SteamSettings
{
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
static SteamSettings()
{
if (!IApplication.IsDesktop()) return;
IsRunSteamMinimized.ValueChanged += IsRunSteamMinimized_ValueChanged;
IsRunSteamNoCheckUpdate.ValueChanged += IsRunSteamNoCheckUpdate_ValueChanged;
IsRunSteamChina.ValueChanged += IsRunSteamChina_ValueChanged;
IsRunSteamVGUI.ValueChanged += IsRunSteamVGUI_ValueChanged;
}
private static void SetRunSteamParameter(string parameter, bool isSet)
{
if (isSet)
SteamStratParameter.Value += $" {parameter}";
else if (SteamStratParameter.Value != null)
SteamStratParameter.Value = SteamStratParameter.Value.Replace(parameter, "").Trim();
}
private static void IsRunSteamVGUI_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
{
if (!e.NewValue.HasValue)
return;
SetRunSteamParameter("-vgui", e.NewValue.Value);
}
static void IsRunSteamNoCheckUpdate_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
{
if (!e.NewValue.HasValue)
return;
if (e.NewValue.Value)
SteamStratParameter.Value += " -noverifyfiles";
else if (SteamStratParameter.Value != null)
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-noverifyfiles", "").Trim();
SetRunSteamParameter("-noverifyfiles", e.NewValue.Value);
}
static void IsRunSteamMinimized_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
{
if (!e.NewValue.HasValue)
return;
if (e.NewValue.Value)
SteamStratParameter.Value += " -silent";
else if (SteamStratParameter.Value != null)
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-silent", "").Trim();
SetRunSteamParameter("-silent", e.NewValue.Value);
}
static void IsRunSteamChina_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
{
if (!e.NewValue.HasValue)
return;
if (e.NewValue.Value)
SteamStratParameter.Value += " -steamchina";
else if (SteamStratParameter.Value != null)
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-steamchina", "").Trim();
SetRunSteamParameter("-steamchina", e.NewValue.Value);
}
#endif
}
@@ -86,21 +86,27 @@ public sealed partial class SteamSettings_ : ISteamSettings, ISettings, ISetting
public bool? IsRunSteamChina { get; set; }
/// <summary>
/// Steam 登录时弹出消息通知
/// Steam 以旧版VGUI启动
/// </summary>
[MPKey(7), MP2Key(7), JsonPropertyOrder(7)]
public bool? IsRunSteamVGUI { get; set; }
/// <summary>
/// Steam 登录时弹出消息通知
/// </summary>
[MPKey(8), MP2Key(8), JsonPropertyOrder(8)]
public bool? IsEnableSteamLaunchNotification { get; set; }
/// <summary>
/// Steam 下载完成执行任务
/// </summary>
[MPKey(8), MP2Key(8), JsonPropertyOrder(8)]
[MPKey(9), MP2Key(9), JsonPropertyOrder(9)]
public OSExitMode? DownloadCompleteSystemEndMode { get; set; }
/// <summary>
/// Steam 以管理员权限运行
/// </summary>
[MPKey(9), MP2Key(9), JsonPropertyOrder(9)]
[MPKey(10), MP2Key(10), JsonPropertyOrder(10)]
public bool? IsRunSteamAdministrator { get; set; }
}
@@ -127,8 +133,6 @@ public static partial class SteamSettings
public static SettingsProperty<string, SteamSettings_> SteamProgramPath { get; }
= new(DefaultSteamProgramPath);
#endif
/// <summary>
/// 自动运行 Steam
/// </summary>
@@ -153,6 +157,12 @@ public static partial class SteamSettings
public static SettingsStructProperty<bool, SteamSettings_> IsRunSteamChina { get; }
= new(DefaultIsRunSteamChina);
/// <summary>
/// Steam 以旧版VGUI启动
/// </summary>
public static SettingsStructProperty<bool, SteamSettings_> IsRunSteamVGUI { get; }
= new(DefaultIsRunSteamVGUI);
/// <summary>
/// Steam 登录时弹出消息通知
/// </summary>
@@ -171,4 +181,6 @@ public static partial class SteamSettings
public static SettingsStructProperty<bool, SteamSettings_> IsRunSteamAdministrator { get; }
= new(DefaultIsRunSteamAdministrator);
#endif
}
@@ -11,8 +11,8 @@ public class ContentWindowViewModel : WindowViewModel
public double MaxHeight { get; init; }
[Reactive]
public bool IsShowSearchBox { get; set; }
//[Reactive]
//public bool IsShowSearchBox { get; set; }
/// <summary>
/// 可以是 Page 也可以是 ViewModel
@@ -20,8 +20,8 @@ public class ContentWindowViewModel : WindowViewModel
[Reactive]
public object? PageViewModel { get; set; }
[Reactive]
public object? ActionContent { get; set; }
//[Reactive]
//public object? ActionContent { get; set; }
public ContentWindowViewModel()
{
@@ -113,7 +113,7 @@ public sealed partial class MainWindowViewModel : WindowViewModel
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
{
//SteamConnectService.Current.Initialize();
SteamConnectService.Current.Initialize();
//SteamConnectService.Current.RefreshSteamUsers();
}
#endif