[update] 更新窗口

This commit is contained in:
Dubi906w 2024-05-04 21:10:42 +08:00
parent 7bfd2d2c4a
commit 596a78d654
3 changed files with 56 additions and 11 deletions

View File

@ -167,7 +167,7 @@ namespace Ink_Canvas {
loadPenCanvas(); loadPenCanvas();
//加载设置 //加载设置
LoadSettings(true); LoadSettings(true);
// HasNewUpdateWindow hasNewUpdateWindow = new HasNewUpdateWindow(); HasNewUpdateWindow hasNewUpdateWindow = new HasNewUpdateWindow();
if (Environment.Is64BitProcess) { if (Environment.Is64BitProcess) {
GroupBoxInkRecognition.Visibility = Visibility.Collapsed; GroupBoxInkRecognition.Visibility = Visibility.Collapsed;
} }

View File

@ -11,19 +11,19 @@
ui:WindowHelper.SystemBackdropType="Mica" ui:WindowHelper.SystemBackdropType="Mica"
ui:TitleBar.Height="36" ui:TitleBar.Height="36"
Title="InkCanvasForClass有新版本可用" Height="475" Width="800" ResizeMode="NoResize"> Title="InkCanvasForClass有新版本可用" Height="475" Width="800" ResizeMode="NoResize">
<Grid> <Grid Background="#fafafa">
<ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0"> <ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0">
<ui:SimpleStackPanel Orientation="Horizontal"> <ui:SimpleStackPanel Orientation="Horizontal" Background="#2563eb" Margin="0,0,0,0">
<ui:SimpleStackPanel Orientation="Vertical" Width="685" Margin="24,18,0,0" Spacing="2"> <ui:SimpleStackPanel Orientation="Vertical" Width="685" Margin="24,18,0,12" Spacing="2">
<TextBlock Text="InkCanvasForClass 新版本来了!" FontSize="24" FontWeight="Bold" TextAlignment="Left"/> <TextBlock Text="InkCanvasForClass 新版本来了!" FontSize="24" FontWeight="Bold" Foreground="White" TextAlignment="Left"/>
<TextBlock Text="希望您能喜欢我们的新版本 :-)" FontSize="20" TextAlignment="Left"/> <TextBlock Text="希望您能喜欢我们的新版本 :-)" FontSize="20" TextAlignment="Left" Foreground="White"/>
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
<Image Source="/Resources/Icons-fluent/party.png" Width="72" Height="72"/> <Image Source="/Resources/Icons-fluent/party.png" Width="72" Height="72"/>
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
<Border BorderBrush="#3f3f46" Background="White" BorderThickness="1" CornerRadius="4" Margin="24,12,24,0"> <Border BorderBrush="#3f3f46" Background="White" BorderThickness="1" CornerRadius="4" Margin="24,12,24,0">
<ui:ScrollViewerEx Margin="0" VerticalScrollBarVisibility="Auto" Height="256" PanningMode="VerticalOnly" ui:ThemeManager.RequestedTheme="Light"> <ui:ScrollViewerEx Margin="0" VerticalScrollBarVisibility="Auto" Height="256" PanningMode="VerticalOnly">
<mdxam:MarkdownScrollViewer xml:space="preserve" MarkdownStyleName="GithubLike"> <mdxam:MarkdownScrollViewer xml:space="preserve" Foreground="Black" MarkdownStyleName="GithubLike">
# InkCanvasForClass v5.0.2更新 # InkCanvasForClass v5.0.2更新
你好旅行者们本次InkCanvasForClass更新带来了如下新功能供您探索 你好旅行者们本次InkCanvasForClass更新带来了如下新功能供您探索
@ -43,7 +43,17 @@
<TextBlock Text="本次更新: 4.9.1 -> 5.9.1" FontWeight="Bold" FontSize="14" TextAlignment="Center"/> <TextBlock Text="本次更新: 4.9.1 -> 5.9.1" FontWeight="Bold" FontSize="14" TextAlignment="Center"/>
<TextBlock Text="2024年8月4日发布更新" FontSize="14" TextAlignment="Center"/> <TextBlock Text="2024年8月4日发布更新" FontSize="14" TextAlignment="Center"/>
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
<Button Content="跳过该版本" HorizontalAlignment="Center" Margin="0,10,0,0"/> <ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="12">
<Button Content="立刻更新" Foreground="White" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button.Resources>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundKey}" Color="#15803d"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPointerOverKey}" Color="#15803d"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPressedKey}" Color="#166534"/>
</Button.Resources>
</Button>
<Button Content="下次更新" Foreground="Black" HorizontalAlignment="Center" Margin="0,10,0,0"/>
<Button Content="跳过该版本" HorizontalAlignment="Center" Foreground="#71717a" Margin="0,10,0,0"/>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
</Grid> </Grid>
</Window> </Window>

View File

@ -2,7 +2,9 @@
using iNKORE.UI.WPF.Modern.Controls.Helpers; using iNKORE.UI.WPF.Modern.Controls.Helpers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -10,6 +12,7 @@ using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
@ -19,13 +22,45 @@ namespace Ink_Canvas
/// <summary> /// <summary>
/// HasNewUpdateWindow.xaml 的交互逻辑 /// HasNewUpdateWindow.xaml 的交互逻辑
/// </summary> /// </summary>
///
public partial class HasNewUpdateWindow : Window public partial class HasNewUpdateWindow : Window
{ {
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
private static bool UseImmersiveDarkMode(IntPtr handle, bool enabled)
{
if (IsWindows10OrGreater(17763))
{
var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
if (IsWindows10OrGreater(18985))
{
attribute = DWMWA_USE_IMMERSIVE_DARK_MODE;
}
int useImmersiveDarkMode = enabled ? 1 : 0;
return DwmSetWindowAttribute(handle, (int)attribute, ref useImmersiveDarkMode, sizeof(int)) == 0;
}
return false;
}
private static bool IsWindows10OrGreater(int build = -1)
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
}
public HasNewUpdateWindow() public HasNewUpdateWindow()
{ {
InitializeComponent(); InitializeComponent();
AnimationsHelper.ShowWithFadeIn(this, 0.25); AnimationsHelper.ShowWithFadeIn(this, 0.25);
Trace.WriteLine(new WindowInteropHelper(this).Handle);
UseImmersiveDarkMode(new WindowInteropHelper(this).Handle, true);
} }
} }
} }