mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 19:00:04 +08:00
Misc
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
xmlns:local="clr-namespace:System.Application.UI.Views;assembly=System.Application.SteamTools.Client.Desktop.Avalonia"
|
||||
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
|
||||
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls;assembly=System.Application.SteamTools.Client.Desktop.Avalonia"
|
||||
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
|
||||
x:Class="System.Application.UI.Views.MainWindow"
|
||||
x:Name="MainWindow"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
@@ -23,11 +24,12 @@
|
||||
</Style>
|
||||
</Window.Styles>
|
||||
<Panel Margin="{Binding #MainWindow.OffScreenMargin}">
|
||||
<Panel ZIndex="0"
|
||||
<!--<Panel ZIndex="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
<controls:EmptyControl x:Name="DesktopBackground"/>
|
||||
</Panel>
|
||||
<controls:EmptyControl x:Name="DesktopBackground"
|
||||
IsVisible="{ReflectionBinding Source={x:Static ms:UISettings.EnableDesktopBackground},Path=Value,Mode=TwoWay}"/>
|
||||
</Panel>-->
|
||||
<local:MainView DataContext="{Binding}"/>
|
||||
<!--<controls:WebView3 IsVisible="False" InitialUrl="chrome://version"></controls:WebView3>-->
|
||||
</Panel>
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace System.Application.UI.Views
|
||||
//var background = this.FindControl<EmptyControl>("DesktopBackground");
|
||||
//_backHandle = background.Handle;
|
||||
|
||||
if (OperatingSystem2.IsWindows && !OperatingSystem2.IsWindows11AtLeast)
|
||||
{
|
||||
TransparencyLevelHint = WindowTransparencyLevel.Transparent;
|
||||
}
|
||||
//if (OperatingSystem2.IsWindows && !OperatingSystem2.IsWindows11AtLeast)
|
||||
//{
|
||||
// TransparencyLevelHint = WindowTransparencyLevel.Transparent;
|
||||
//}
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
|
||||
@@ -16,27 +16,49 @@ namespace System.Application.UI.Views.Controls
|
||||
public EmptyControl()
|
||||
{
|
||||
//this.InitializeComponent();
|
||||
if (OperatingSystem2.IsWindows && UISettings.EnableDesktopBackground.Value)
|
||||
{
|
||||
this.LayoutUpdated += EmptyControl_LayoutUpdated;
|
||||
this.AttachedToVisualTree += EmptyControl_AttachedToVisualTree;
|
||||
this.DetachedFromVisualTree += EmptyControl_DetachedFromVisualTree;
|
||||
window = new Window
|
||||
|
||||
this.GetObservable(IsVisibleProperty)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
Width = this.Bounds.Width,
|
||||
Height = this.Bounds.Height,
|
||||
Background = Avalonia.Media.Brushes.Transparent,
|
||||
WindowStartupLocation = WindowStartupLocation.Manual,
|
||||
WindowState = WindowState.Normal,
|
||||
ExtendClientAreaToDecorationsHint = true,
|
||||
ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.PreferSystemChrome,
|
||||
SystemDecorations = SystemDecorations.Full,
|
||||
CanResize = false,
|
||||
TransparencyLevelHint = WindowTransparencyLevel.Transparent,
|
||||
ShowInTaskbar = false,
|
||||
Focusable = false
|
||||
};
|
||||
}
|
||||
if (x)
|
||||
{
|
||||
if (window == null)
|
||||
{
|
||||
this.LayoutUpdated += EmptyControl_LayoutUpdated;
|
||||
this.AttachedToVisualTree += EmptyControl_AttachedToVisualTree;
|
||||
this.DetachedFromVisualTree += EmptyControl_DetachedFromVisualTree;
|
||||
window = new Window
|
||||
{
|
||||
Width = this.Bounds.Width,
|
||||
Height = this.Bounds.Height,
|
||||
Background = Avalonia.Media.Brushes.Transparent,
|
||||
WindowStartupLocation = WindowStartupLocation.Manual,
|
||||
WindowState = WindowState.Normal,
|
||||
ExtendClientAreaToDecorationsHint = true,
|
||||
ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.PreferSystemChrome,
|
||||
SystemDecorations = SystemDecorations.Full,
|
||||
CanResize = false,
|
||||
TransparencyLevelHint = WindowTransparencyLevel.Transparent,
|
||||
ShowInTaskbar = false,
|
||||
Focusable = false
|
||||
};
|
||||
if (Parent != null && VisualRoot != null)
|
||||
EmptyControl_AttachedToVisualTree(null, new VisualTreeAttachmentEventArgs(Parent, VisualRoot));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window != null)
|
||||
{
|
||||
if (Parent != null && VisualRoot != null)
|
||||
EmptyControl_DetachedFromVisualTree(null, new VisualTreeAttachmentEventArgs(Parent, VisualRoot));
|
||||
this.LayoutUpdated -= EmptyControl_LayoutUpdated;
|
||||
this.AttachedToVisualTree -= EmptyControl_AttachedToVisualTree;
|
||||
this.DetachedFromVisualTree -= EmptyControl_DetachedFromVisualTree;
|
||||
window = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void EmptyControl_DetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs e)
|
||||
|
||||
+2
-2
@@ -106,12 +106,12 @@
|
||||
|
||||
<Separator Classes="Separator"/>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<!--<StackPanel Orientation="Vertical">
|
||||
<DockPanel>
|
||||
<TextBlock Text="使用动态桌面背景"/>
|
||||
<ToggleSwitch IsChecked="{ReflectionBinding Source={x:Static ms:UISettings.EnableDesktopBackground},Path=Value, Mode=TwoWay}"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>-->
|
||||
|
||||
<StackPanel Orientation="Vertical" IsEnabled="{ReflectionBinding Source={x:Static ms:UISettings.EnableDesktopBackground},Path=!Value, Mode=OneWay}">
|
||||
<DockPanel>
|
||||
|
||||
Reference in New Issue
Block a user