[update] SettingsV2

This commit is contained in:
Dubi906w 2024-09-08 21:42:18 +08:00
parent 14cae3814c
commit fa276183e8
16 changed files with 838 additions and 348 deletions

View File

@ -16,6 +16,8 @@ using System.Runtime.InteropServices;
using System.Security.Principal; using System.Security.Principal;
using Windows.Data.Xml.Dom; using Windows.Data.Xml.Dom;
using Windows.UI.Notifications; using Windows.UI.Notifications;
using Ink_Canvas.Properties;
using Ink_Canvas.Resources.ICCConfiguration;
namespace Ink_Canvas { namespace Ink_Canvas {
@ -34,6 +36,7 @@ namespace Ink_Canvas {
public static string[] StartArgs = null; public static string[] StartArgs = null;
public static string RootPath = Environment.GetEnvironmentVariable("APPDATA") + "\\Ink Canvas\\"; public static string RootPath = Environment.GetEnvironmentVariable("APPDATA") + "\\Ink Canvas\\";
public static ICCConfiguration SettingsV2 = new ICCConfiguration();
public App() { public App() {
this.Startup += new StartupEventHandler(App_Startup); this.Startup += new StartupEventHandler(App_Startup);
@ -62,6 +65,8 @@ namespace Ink_Canvas {
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
SettingsV2 = ConfigurationHelper.ReadConfiguration();
LogHelper.NewLog(string.Format("Ink Canvas Starting (Version: {0})", Assembly.GetExecutingAssembly().GetName().Version.ToString())); LogHelper.NewLog(string.Format("Ink Canvas Starting (Version: {0})", Assembly.GetExecutingAssembly().GetName().Version.ToString()));
bool ret; bool ret;
@ -113,8 +118,6 @@ namespace Ink_Canvas {
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error); LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
} }
mainWin = new MainWindow(); mainWin = new MainWindow();
if (isUsingWindowChrome && DwmCompositionHelper.DwmIsCompositionEnabled()) { if (isUsingWindowChrome && DwmCompositionHelper.DwmIsCompositionEnabled()) {

View File

@ -0,0 +1,133 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Ink_Canvas.Resources.ICCConfiguration;
using Tomlyn;
using Tomlyn.Model;
namespace Ink_Canvas.Helpers {
public static class ConfigurationHelper {
public static ICCConfiguration ReadConfiguration() {
try {
if (File.Exists(App.RootPath + "icc.toml")) {
try {
string text = File.ReadAllText(App.RootPath + "icc.toml");
var tomlTable = Toml.ToModel(text);
var conf = new ICCConfiguration();
// FloatingBar
var fb = tomlTable["FloatingBar"] as TomlTable;
if (fb != null) {
if (fb["SemiTransparent"] is bool) conf.FloatingBar.SemiTransparent = (bool)fb["SemiTransparent"];
if (fb["NearSnap"] is bool) conf.FloatingBar.NearSnap = (bool)fb["NearSnap"];
InitialPositionTypes _InitialPositionType;
ElementCornerRadiusTypes _ElementCornerRadiusType;
if (fb["InitialPosition"] is TomlArray) {
var arr = ((TomlArray)fb["InitialPosition"]);
conf.FloatingBar.InitialPosition = InitialPositionTypes.Custom;
if ((arr[0] is double || arr[0] is long) &&
(arr[1] is double || arr[1] is long))
conf.FloatingBar.InitialPositionPoint = new Point(Math.Min(Math.Max(0,Convert.ToDouble(arr[0])),65535),
Math.Min(Math.Max(0,Convert.ToDouble(arr[1])),65535));
} else if (fb["InitialPosition"] is string &&
Enum.TryParse<InitialPositionTypes>((string)fb["InitialPosition"],
out _InitialPositionType)) {
conf.FloatingBar.InitialPosition = _InitialPositionType;
}
if (fb["ElementCornerRadius"] is double || fb["ElementCornerRadius"] is long) {
conf.FloatingBar.ElementCornerRadiusType = ElementCornerRadiusTypes.Custom;
conf.FloatingBar.ElementCornerRadiusValue = Math.Min(Math.Max(0, Convert.ToDouble(fb["ElementCornerRadius"])),24);
} else if (fb["ElementCornerRadius"] is string &&
Enum.TryParse<ElementCornerRadiusTypes>((string)fb["ElementCornerRadius"],
out _ElementCornerRadiusType)) {
conf.FloatingBar.ElementCornerRadiusType = _ElementCornerRadiusType;
}
if (fb["ParallaxEffect"] is bool) conf.FloatingBar.ParallaxEffect = (bool)fb["ParallaxEffect"];
if (fb["MiniMode"] is bool) conf.FloatingBar.MiniMode = (bool)fb["MiniMode"];
if (fb["ClearButtonColor"] is TomlArray) {
var arr = (TomlArray)fb["ClearButtonColor"];
conf.FloatingBar.ClearButtonColor = Color.FromRgb(Convert.ToByte(arr[0]), Convert.ToByte(arr[1]), Convert.ToByte(arr[2]));
}
if (fb["ClearButtonPressColor"] is TomlArray) {
var arr = (TomlArray)fb["ClearButtonPressColor"];
conf.FloatingBar.ClearButtonPressColor = Color.FromRgb(Convert.ToByte(arr[0]), Convert.ToByte(arr[1]), Convert.ToByte(arr[2]));
}
if (fb["ToolButtonSelectedBgColor"] is TomlArray) {
var arr = (TomlArray)fb["ToolButtonSelectedBgColor"];
conf.FloatingBar.ToolButtonSelectedBgColor = Color.FromRgb(Convert.ToByte(arr[0]), Convert.ToByte(arr[1]), Convert.ToByte(arr[2]));
}
if (fb["MovingLimitationNoSnap"] is long || fb["MovingLimitationNoSnap"] is double)
conf.FloatingBar.MovingLimitationNoSnap = Math.Min(Math.Max(0, Convert.ToDouble(fb["MovingLimitationNoSnap"])),32);
if (fb["MovingLimitationSnapped"] is long || fb["MovingLimitationSnapped"] is double)
conf.FloatingBar.MovingLimitationSnapped = Math.Min(Math.Max(0, Convert.ToDouble(fb["MovingLimitationSnapped"])),32);
if (fb["NearSnapAreaSize"] is TomlTable) {
var _tb = fb["NearSnapAreaSize"] as TomlTable;
if (_tb["TopLeft"] is TomlArray) {
var _arr = _tb["TopLeft"] as TomlArray;
conf.FloatingBar.NearSnapAreaSize.TopLeft = new []{
Math.Min(Math.Max(0,Convert.ToDouble(_arr[0])),64), Math.Min(Math.Max(0,Convert.ToDouble(_arr[1])),64)
};
}
if (_tb["TopRight"] is TomlArray) {
var _arr = _tb["TopRight"] as TomlArray;
conf.FloatingBar.NearSnapAreaSize.TopRight = new []{
Math.Min(Math.Max(0,Convert.ToDouble(_arr[0])),64), Math.Min(Math.Max(0,Convert.ToDouble(_arr[1])),64)
};
}
if (_tb["BottomLeft"] is TomlArray) {
var _arr = _tb["BottomLeft"] as TomlArray;
conf.FloatingBar.NearSnapAreaSize.BottomLeft = new []{
Math.Min(Math.Max(0,Convert.ToDouble(_arr[0])),64), Math.Min(Math.Max(0,Convert.ToDouble(_arr[1])),64)
};
}
if (_tb["BottomRight"] is TomlArray) {
var _arr = _tb["BottomRight"] as TomlArray;
conf.FloatingBar.NearSnapAreaSize.BottomRight = new []{
Math.Min(Math.Max(0,Convert.ToDouble(_arr[0])),64), Math.Min(Math.Max(0,Convert.ToDouble(_arr[1])),64)
};
}
if (_tb["TopCenter"] is long || _tb["TopCenter"] is double)
conf.FloatingBar.NearSnapAreaSize.TopCenter = Math.Min(Math.Max(0, Convert.ToDouble(_tb["TopCenter"])), 64);
if (_tb["BottomCenter"] is long || _tb["BottomCenter"] is double)
conf.FloatingBar.NearSnapAreaSize.BottomCenter = Math.Min(Math.Max(0, Convert.ToDouble(_tb["BottomCenter"])), 64);
}
if (fb["ToolBarItems"] is TomlTable) {
var _tb = fb["ToolBarItems"] as TomlTable;
if (_tb["CursorMode"] is TomlArray) {
conf.FloatingBar.ToolBarItemsInCursorMode =
Array.ConvertAll(((TomlArray)_tb["CursorMode"]).ToArray(),p=>p.ToString());
}
if (_tb["MiniMode"] is TomlArray) {
conf.FloatingBar.ToolBarItemsInMiniMode =
Array.ConvertAll(((TomlArray)_tb["MiniMode"]).ToArray(),p=>p.ToString());
}
if (_tb["AnnotationMode"] is TomlArray) {
conf.FloatingBar.ToolBarItemsInAnnotationMode =
Array.ConvertAll(((TomlArray)_tb["AnnotationMode"]).ToArray(),p=>p.ToString());
}
}
}
return conf;
}
catch {
return new ICCConfiguration();
}
} else {
return new ICCConfiguration();
}
}
catch (Exception ex) {
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
return new ICCConfiguration();
}
}
}
}

View File

@ -184,6 +184,7 @@
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" /> <PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OSVersionExt" Version="3.0.0" /> <PackageReference Include="OSVersionExt" Version="3.0.0" />
<PackageReference Include="PixiEditor.ColorPicker" Version="3.4.1" /> <PackageReference Include="PixiEditor.ColorPicker" Version="3.4.1" />
<PackageReference Include="Tomlyn" Version="0.17.0" />
<PackageReference Include="Vanara.PInvoke.Magnification" Version="4.0.2" /> <PackageReference Include="Vanara.PInvoke.Magnification" Version="4.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -630,6 +631,9 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="icc.toml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings"> <None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -29,6 +29,12 @@
<Compile Update="Popups\ShapeDrawingPopup.xaml.cs"> <Compile Update="Popups\ShapeDrawingPopup.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Windows\SettingsViews\AboutPanel.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\SettingsViews\SettingsBaseView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\SettingsWindow.xaml.cs"> <Compile Update="Windows\SettingsWindow.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@ -64,6 +70,12 @@
<Page Update="Resources\GeometryIcons.xaml"> <Page Update="Resources\GeometryIcons.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Windows\SettingsViews\AboutPanel.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\SettingsViews\SettingsBaseView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\SettingsWindow.xaml"> <Page Update="Windows\SettingsWindow.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@ -23,6 +23,7 @@ using Ink_Canvas.Popups;
using iNKORE.UI.WPF.Modern.Controls; using iNKORE.UI.WPF.Modern.Controls;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using Ink_Canvas.Resources.ICCConfiguration;
using Vanara.PInvoke; using Vanara.PInvoke;
using Application = System.Windows.Application; using Application = System.Windows.Application;
using Button = System.Windows.Controls.Button; using Button = System.Windows.Controls.Button;
@ -178,6 +179,7 @@ namespace Ink_Canvas {
#region Definitions and Loading #region Definitions and Loading
public static Settings Settings = new Settings(); public static Settings Settings = new Settings();
public static ICCConfiguration SettingsV2 = new ICCConfiguration();
public static string settingsFileName = "Settings.json"; public static string settingsFileName = "Settings.json";
public bool isLoaded = false; public bool isLoaded = false;
@ -225,6 +227,8 @@ namespace Ink_Canvas {
//TextBlockVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); //TextBlockVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
LogHelper.WriteLogToFile("Ink Canvas Loaded", LogHelper.LogType.Event); LogHelper.WriteLogToFile("Ink Canvas Loaded", LogHelper.LogType.Event);
var app = Application.Current;
isLoaded = true; isLoaded = true;
FloatingToolBarV2 = new FloatingToolBarV2(); FloatingToolBarV2 = new FloatingToolBarV2();

View File

@ -83,6 +83,7 @@ namespace Ink_Canvas
//var clonedDrawing = (FindResource("CursorIcon") as DrawingImage).Clone(); //var clonedDrawing = (FindResource("CursorIcon") as DrawingImage).Clone();
//((clonedDrawing.Drawing as DrawingGroup).Children[0] as //((clonedDrawing.Drawing as DrawingGroup).Children[0] as
// GeometryDrawing).Brush = new SolidColorBrush(Colors.Black); // GeometryDrawing).Brush = new SolidColorBrush(Colors.Black);
ToolbarItems.Add(new FloatingBarItem() { ToolbarItems.Add(new FloatingBarItem() {
Name = "Cursor", Name = "Cursor",
IconSource = FindResource("CursorIcon") as DrawingImage, IconSource = FindResource("CursorIcon") as DrawingImage,

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace Ink_Canvas.Resources.ICCConfiguration {
public enum InitialPositionTypes {
TopLeft, TopRight, BottomLeft, BottomRight, TopCenter, BottomCenter, Custom
}
public enum ElementCornerRadiusTypes {
SuperEllipse, Circle, Custom, None
}
public class NearSnapAreaSize {
public double[] TopLeft { get; set; } = {24,24};
public double[] TopRight { get; set; } = {24,24};
public double[] BottomLeft { get; set; } = {24,24};
public double[] BottomRight { get; set; } = {24,24};
public double TopCenter { get; set; } = 24;
public double BottomCenter { get; set; } = 24;
}
public class ICCFloatingBarConfiguration {
public bool SemiTransparent { get; set; } = false;
public bool NearSnap { get; set; } = true;
public InitialPositionTypes InitialPosition { get; set; } = InitialPositionTypes.BottomCenter;
public Point InitialPositionPoint { get; set; } = new Point(0, 0);
public double ElementCornerRadiusValue = 0;
public ElementCornerRadiusTypes ElementCornerRadiusType { get; set; } = ElementCornerRadiusTypes.SuperEllipse;
public bool ParallaxEffect { get; set; } = true;
public bool MiniMode { get; set; } = false;
public Color ClearButtonColor { get; set; } = Color.FromRgb(224, 27, 36);
public Color ClearButtonPressColor { get; set; } = Color.FromRgb(254, 226, 226);
public Color ToolButtonSelectedBgColor { get; set; } = Color.FromRgb(37, 99, 235);
public double MovingLimitationNoSnap { get; set; } = 12;
public double MovingLimitationSnapped { get; set; } = 24;
public NearSnapAreaSize NearSnapAreaSize { get; set; } = new NearSnapAreaSize() {
TopLeft = new double[] { 24, 24 },
TopRight = new double[] { 24, 24 },
BottomLeft = new double[] { 24, 24 },
BottomRight = new double[] { 24, 24 },
};
public string[] ToolBarItemsInCursorMode { get; set; } = new string[] {
"Cursor", "Pen", "Clear", "Separator", "Whiteboard", "Gesture", "Menu", "Fold"
};
public string[] ToolBarItemsInMiniMode { get; set; } = new string[] {
"Cursor", "Pen", "Clear"
};
public string[] ToolBarItemsInAnnotationMode { get; set; } = new string[] {
"Cursor", "Pen", "Clear", "Separator", "Eraser", "ShapeDrawing", "Select", "Separator", "Undo", "Redo", "Separator", "Whiteboard", "Gesture", "Menu", "Fold"
};
}
public class ICCConfiguration {
public ICCFloatingBarConfiguration FloatingBar { get; set; } = new ICCFloatingBarConfiguration();
}
}

View File

@ -1,68 +0,0 @@
# icc 的配置文件
# ================================================
# 语法说明:
# 1. 井号后面是注释内容,不会被解释器识别
# 2. 单个项目使用 Key=Value 的格式
# 3. 有子项目的使用 Key:(subKey1=value1,subKey2=value2) 的格式
# 4. 有子项目的且项目本身可以设置值的使用 Key=Value:(subKey1=value1,subKey2=value2) 的格式
# 5. 开为 1 ,关为 0字符串不需要刻意加引号自动识别也可以加上双引号。
# ================================================
{icc.config="Default"}
[config="appearance"]
floatingBar:(label=0,icons=1111111111,eraser=0,onlyEraser=0,logo=0,scale=1.00,alpha=1.00,alphaPpt=1.00)
whiteBoard:(scale=0.80,time=1,cs=0;csSource=0)
quickPanel=0:(icon=0)
trayIcon=0
[config="startup"]
run=0:(fold=0,hide=0,admin=0,winChrome=0)
[config="canvas"]
canvas:(cursor=0,eraser=2,hideWExit=0,clearTm=0)
whiteBoard:(color=0,pattern=0,defClr=0,defPtrn=0,inkClr=0)
select:(mode=0,stylusTip=1,fully=0,clickLock=0)
[config="gesture"]
2fingerMove=0
2fingerRotateInk=0
oldTouchGesture=1:(spScreen=0,multiple=1,boundsW=5;20,threshold=2.5;2.5,eraserS=0.8;0.8,quadIr=0)
mouseGesture=1:(right=1,wheel=0,fWheel=0)
winInk:(eraser=0,barrel=0)
[config="ink-recognition"]
inkRecognition=1:(rectSP=1,triSP=1,asShape=1,triRecog=1,rectRecog=1,ellipseRecog=1)
[config="powerpoint"]
powerpoint=1
wpsOffice=0
slideShowToolBtn=1:(lb=1,rb=1,ls=1,rs=1,bConf=100,sConf=110,clickable=0,autoInk=0,2finger=1,autoSnap=0,autosave=1,memLastIndex=0,hiddenSlide=1,autoplayN=0)
[config="experimental"]
fullScreenHelper=0
edgeGesture=0
preventClose=1
forceTopmost=1
alwaysVisible=1
floatingBarAlwaysV=1
[config="automation"]
autoFold=1011110011000000110
autoKill=0000
autoKillFr=00
ddb=0001101
[config="storage"]
storage=fr
userLocation=
[config="snapshot"]
magnificationApi=0
hideIccWin=0
clipboard=1
ink=0
onlyMaxmizeWin=0
filename="Screenshot-[YYYY]-[MM]-[DD]-[HH]-[mm]-[ss].png"
/{icc.config="Settings"}

View File

@ -1,19 +0,0 @@
# icc 随机点名特殊配置文件
# 这个语法是 icc 自己实现的,所以比较简陋
[config="test.luckyrand.list.txt"]
forceEnabled=true # 是否强制启用特殊配置,强制启用后不会隐藏设置中的开关,但是可以让开关失效(不保存到文件)
whiteList[0]=孙笑川 # 井号后面是注释内容,不会识别
whiteList[1]=蔡徐坤 # 此处设置的是全局白名单,这个白名单内的名字在所有情况下都不会被随机点名匹配到
# 此处设置姓名的匹配模式,是包含还是全等于还是开头
# 包含 contains 全等于 equals 开头 startsWith
nameMatchingMode=contains
# 设置动态白名单的开关和数据来源,目前仅支持配置内定义
dynamicWhiteListEnabled=true
dynamicWhiteListSource=specialConfig
dynamicWhiteList[0][time]=Mon/Tue/Wed/Thur/Fri;(08:00:00-08:40:00|08:50:00-09:30:00|10:00:00-10:40:00|10:50:00-11:30:00|11:40:00-12:25:00|14:30:00-15:10:00|15:30:00-16:10:00|16:20:00-17:40:00|17:50:00-18:30:00|17:50:00-18:20:00|19:00:00-19:50:00|20:00:00-20:50:00)
dynamicWhiteList[0][rule]=

View File

@ -0,0 +1,194 @@
<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.AboutPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
mc:Ignorable="d"
d:DesignHeight="950" d:DesignWidth="640">
<UserControl.Resources>
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<EventSetter Event="PreviewMouseDown" Handler="ScrollbarThumb_MouseDown"/>
<EventSetter Event="PreviewMouseUp" Handler="ScrollbarThumb_MouseUp"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border Name="ScrollbarThumbEx"
SnapsToDevicePixels="True"
Background="#c3c3c3"
Opacity="0.5"
CornerRadius="1.5"
Height="{TemplateBinding Height}"
Width="3" HorizontalAlignment="Center"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ScrollBar}">
<EventSetter Event="Scroll" Handler="ScrollBar_Scroll"/>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Margin" Value="-6 3 0 0" />
<Setter Property="MinWidth" Value="{Binding Height, RelativeSource={RelativeSource Self}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="ScrollbarGrid" SnapsToDevicePixels="true">
<Border Width="3" CornerRadius="1.5" Background="#e0e0e0" Opacity="0" IsHitTestVisible="False" Margin="0 4 -2 4" x:Name="ScrollBarBorderTrackBackground"/>
<Border Padding="0 4" Background="Transparent" MouseEnter="ScrollBarTrack_MouseEnter"
MouseLeave="ScrollBarTrack_MouseLeave">
<Track x:Name="PART_Track"
IsDirectionReversed="true"
IsEnabled="True"
Width="6"
Margin="0,0,0,0"
HorizontalAlignment="Right">
<Track.DecreaseRepeatButton>
<RepeatButton Opacity="0" Command="{x:Static ScrollBar.PageUpCommand}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Opacity="0" Command="{x:Static ScrollBar.PageDownCommand}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb }" />
</Track.Thumb>
</Track>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AboutScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
<StackPanel Margin="0,12,0,24" HorizontalAlignment="Center" Width="524">
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<Image Name="CopyrightBannerImage"/>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="用户版权信息" HorizontalAlignment="Left"/>
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v2024.8.30" VerticalAlignment="Center" />
<Image Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<DrawingGroup.Transform>
<TranslateTransform X="6.1023980379104614E-05" Y="0" />
</DrawingGroup.Transform>
<GeometryDrawing Brush="#FFFF7800" Geometry="F1 M16,16z M0,0z M8.00493,0C7.74518,0,7.49541,0.0999063,7.2956,0.289728L5.5872,1.99813 2.99963,1.99813C2.45014,1.99813,2.00056,2.44771,2.00056,2.99719L2.00056,5.58476 0.292165,7.29316C-0.0974697,7.6828,-0.0974697,8.31221,0.292165,8.70184L2.00056,10.4102 2.00056,12.9978C2.00056,13.5473,2.45014,13.9969,2.99963,13.9969L5.5872,13.9969 7.2956,15.7053C7.68523,16.0949,8.31464,16.0949,8.70428,15.7053L10.4127,13.9969 13.0003,13.9969C13.5497,13.9969,13.9993,13.5473,13.9993,12.9978L13.9993,10.4102 15.7077,8.70184C16.0973,8.31221,16.0973,7.6828,15.7077,7.29316L13.9993,5.58476 13.9993,2.99719C13.9993,2.44771,13.5497,1.99813,13.0003,1.99813L10.4127,1.99813 8.70428,0.289728C8.50447,0.0899157,8.2547,0,7.99494,0L8.00493,0z M8.00493,4.99532C8.26469,4.99532,8.51446,5.09522,8.71427,5.28505L10.7124,7.28317C10.9022,7.47299,11.0021,7.72276,11.0021,7.99251L11.0021,8.99157 9.004,8.99157 9.004,10.9897 7.00587,10.9897 7.00587,8.99157 5.00774,8.99157 5.00774,7.99251C5.00774,7.73275,5.10765,7.47299,5.29747,7.28317L7.2956,5.28505C7.49541,5.08523,7.74518,4.99532,8.00493,4.99532z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="系统版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutSystemVersion" Foreground="#878787" FontSize="14.5" Text="Windows 10 专业版 19045.3758" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="触摸设备" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutTouchTabletText" Foreground="#878787" FontSize="14.5" Text="无触摸支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="包体构建版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutBuildTime" Foreground="#878787" FontSize="14.5" Text="2024.8.22" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版权信息" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Foreground="#878787" FontSize="14.5" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
</StackPanel>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="ICC 官方网站" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Github 仓库" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvas/InkCanvasForClass" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="贡献者名单" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com/contributors" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
<TextBlock Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="© 2022-2024 HARKOTEK Studio 提供技术支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="感谢 HARKOTEK Studio 的成员 “幻想熵K2ro_” 提供技术支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
<TextBlock Foreground="#878787" Width="356" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 的部分元素设计参考来源于:© iNKORE! 名下产品 Inkways已经过授权使用最终解释权归 Yoojun Zhou 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontWeight="Bold" Width="276" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 小量地使用了 iNKORE! 开发的 UI 组件库iNKORE.UI.WPF.Modern" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="osu! 相关素材:© ppy powered 2007-2024" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>

View File

@ -0,0 +1,243 @@
using OSVersionExtension;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Management;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using iNKORE.UI.WPF.Helpers;
using static Ink_Canvas.Windows.SettingsWindow;
namespace Ink_Canvas.Windows.SettingsViews {
/// <summary>
/// AboutPanel.xaml 的交互逻辑
/// </summary>
public partial class AboutPanel : UserControl {
public AboutPanel() {
InitializeComponent();
// 关于页面图片横幅
if (File.Exists(App.RootPath + "icc-about-illustrations.png")) {
try {
CopyrightBannerImage.Visibility = Visibility.Visible;
CopyrightBannerImage.Source =
new BitmapImage(new Uri($"file://{App.RootPath + "icc-about-illustrations.png"}"));
}
catch { }
} else {
CopyrightBannerImage.Visibility = Visibility.Collapsed;
}
// 关于页面构建时间
var buildTime = FileBuildTimeHelper.GetBuildDateTime(System.Reflection.Assembly.GetExecutingAssembly());
if (buildTime != null) {
var bt = ((DateTimeOffset)buildTime).LocalDateTime;
var m = bt.Month.ToString().PadLeft(2, '0');
var d = bt.Day.ToString().PadLeft(2, '0');
var h = bt.Hour.ToString().PadLeft(2, '0');
var min = bt.Minute.ToString().PadLeft(2, '0');
var s = bt.Second.ToString().PadLeft(2, '0');
AboutBuildTime.Text =
$"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}";
}
// 关于页面系统版本
AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
// 关于页面触摸设备
var _t_touch = new Thread(() => {
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
var support = TouchTabletDetectHelper.IsTouchEnabled();
Dispatcher.BeginInvoke(() =>
AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "" : "")}");
});
_t_touch.Start();
}
public static class TouchTabletDetectHelper {
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex);
public static bool IsTouchEnabled()
{
const int MAXTOUCHES_INDEX = 95;
int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX);
return maxTouches > 0;
}
public class USBDeviceInfo
{
public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
{
this.DeviceID = deviceID;
this.PnpDeviceID = pnpDeviceID;
this.Description = description;
}
public string DeviceID { get; private set; }
public string PnpDeviceID { get; private set; }
public string Description { get; private set; }
}
public static List<USBDeviceInfo> GetTouchTabletDevices()
{
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
collection = searcher.Get();
foreach (var device in collection) {
var name = new StringBuilder((string)device.GetPropertyValue("Name")).ToString();
if (!name.Contains("Pentablet")) continue;
devices.Add(new USBDeviceInfo(
(string)device.GetPropertyValue("DeviceID"),
(string)device.GetPropertyValue("PNPDeviceID"),
(string)device.GetPropertyValue("Description")
));
}
collection.Dispose();
return devices;
}
}
public static class FileBuildTimeHelper {
public struct _IMAGE_FILE_HEADER
{
public ushort Machine;
public ushort NumberOfSections;
public uint TimeDateStamp;
public uint PointerToSymbolTable;
public uint NumberOfSymbols;
public ushort SizeOfOptionalHeader;
public ushort Characteristics;
};
public static DateTimeOffset? GetBuildDateTime(Assembly assembly)
{
var path = assembly.Location;
if (File.Exists(path))
{
var buffer = new byte[Math.Max(Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER)), 4)];
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
fileStream.Position = 0x3C;
fileStream.Read(buffer, 0, 4);
fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset
fileStream.Read(buffer, 0, 4); // "PE\0\0"
fileStream.Read(buffer, 0, buffer.Length);
}
var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try
{
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
return DateTimeOffset.FromUnixTimeSeconds(coffHeader.TimeDateStamp);
}
finally
{
pinnedBuffer.Free();
}
}
else
{
return null;
}
}
}
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e) {
var scrollViewer = (ScrollViewer)sender;
if (scrollViewer.VerticalOffset >= 10) {
IsTopBarNeedShadowEffect?.Invoke(this, new RoutedEventArgs());
} else {
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
}
}
private void ScrollBar_Scroll(object sender, RoutedEventArgs e) {
var scrollbar = (ScrollBar)sender;
var scrollviewer = scrollbar.FindAscendant<ScrollViewer>();
if (scrollviewer != null) scrollviewer.ScrollToVerticalOffset(scrollbar.Track.Value);
}
private void ScrollBarTrack_MouseEnter(object sender, MouseEventArgs e) {
var border = (Border)sender;
if (border.Child is Track track) {
track.Width = 16;
track.Margin = new Thickness(0, 0, -2, 0);
var scrollbar = track.FindAscendant<ScrollBar>();
if (scrollbar != null) scrollbar.Width = 16;
var grid = track.FindAscendant<Grid>();
if (grid.FindDescendantByName("ScrollBarBorderTrackBackground") is Border backgroundBorder) {
backgroundBorder.Width = 8;
backgroundBorder.CornerRadius = new CornerRadius(4);
backgroundBorder.Opacity = 1;
}
var thumb = track.Thumb.Template.FindName("ScrollbarThumbEx", track.Thumb) ;
if (thumb != null) {
var _thumb = thumb as Border;
_thumb.CornerRadius = new CornerRadius(4);
_thumb.Width = 8;
_thumb.Margin = new Thickness(-0.75, 0, 1, 0);
_thumb.Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
}
}
}
private void ScrollBarTrack_MouseLeave(object sender, MouseEventArgs e) {
var border = (Border)sender;
border.Background = new SolidColorBrush(Colors.Transparent);
border.CornerRadius = new CornerRadius(0);
if (border.Child is Track track) {
track.Width = 6;
track.Margin = new Thickness(0, 0, 0, 0);
var scrollbar = track.FindAscendant<ScrollBar>();
if (scrollbar != null) scrollbar.Width = 6;
var grid = track.FindAscendant<Grid>();
if (grid.FindDescendantByName("ScrollBarBorderTrackBackground") is Border backgroundBorder) {
backgroundBorder.Width = 3;
backgroundBorder.CornerRadius = new CornerRadius(1.5);
backgroundBorder.Opacity = 0;
}
var thumb = track.Thumb.Template.FindName("ScrollbarThumbEx", track.Thumb) ;
if (thumb != null) {
var _thumb = thumb as Border;
_thumb.CornerRadius = new CornerRadius(1.5);
_thumb.Width = 3;
_thumb.Margin = new Thickness(0);
_thumb.Background = new SolidColorBrush(Color.FromRgb(195, 195, 195));
}
}
}
private void ScrollbarThumb_MouseDown(object sender, MouseButtonEventArgs e) {
var thumb = (Thumb)sender;
var border = thumb.Template.FindName("ScrollbarThumbEx",thumb);
((Border)border).Background = new SolidColorBrush(Color.FromRgb(95, 95, 95));
}
private void ScrollbarThumb_MouseUp(object sender, MouseButtonEventArgs e) {
var thumb = (Thumb)sender;
var border = thumb.Template.FindName("ScrollbarThumbEx",thumb);
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
}
}
}

View File

@ -0,0 +1,24 @@
<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.SettingsBaseView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="SettingsViewScrollViewer" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Margin="0,12,0,24" HorizontalAlignment="Center" Width="524"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</UserControl>

View File

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using iNKORE.UI.WPF.Helpers;
namespace Ink_Canvas.Windows.SettingsViews {
/// <summary>
/// SettingsBaseView.xaml 的交互逻辑
/// </summary>
public partial class SettingsBaseView : UserControl {
public SettingsBaseView() {
InitializeComponent();
}
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e) {
var scrollViewer = (ScrollViewer)sender;
if (scrollViewer.VerticalOffset >= 10) {
IsTopBarNeedShadowEffect?.Invoke(this, new RoutedEventArgs());
} else {
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
}
}
private void ScrollBar_Scroll(object sender, RoutedEventArgs e) {
var scrollbar = (ScrollBar)sender;
var scrollviewer = scrollbar.FindAscendant<ScrollViewer>();
if (scrollviewer != null) scrollviewer.ScrollToVerticalOffset(scrollbar.Track.Value);
}
private void ScrollBarTrack_MouseEnter(object sender, MouseEventArgs e) {
var border = (Border)sender;
if (border.Child is Track track) {
track.Width = 16;
track.Margin = new Thickness(0, 0, -2, 0);
var scrollbar = track.FindAscendant<ScrollBar>();
if (scrollbar != null) scrollbar.Width = 16;
var grid = track.FindAscendant<Grid>();
if (grid.FindDescendantByName("ScrollBarBorderTrackBackground") is Border backgroundBorder) {
backgroundBorder.Width = 8;
backgroundBorder.CornerRadius = new CornerRadius(4);
backgroundBorder.Opacity = 1;
}
var thumb = track.Thumb.Template.FindName("ScrollbarThumbEx", track.Thumb) ;
if (thumb != null) {
var _thumb = thumb as Border;
_thumb.CornerRadius = new CornerRadius(4);
_thumb.Width = 8;
_thumb.Margin = new Thickness(-0.75, 0, 1, 0);
_thumb.Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
}
}
}
private void ScrollBarTrack_MouseLeave(object sender, MouseEventArgs e) {
var border = (Border)sender;
border.Background = new SolidColorBrush(Colors.Transparent);
border.CornerRadius = new CornerRadius(0);
if (border.Child is Track track) {
track.Width = 6;
track.Margin = new Thickness(0, 0, 0, 0);
var scrollbar = track.FindAscendant<ScrollBar>();
if (scrollbar != null) scrollbar.Width = 6;
var grid = track.FindAscendant<Grid>();
if (grid.FindDescendantByName("ScrollBarBorderTrackBackground") is Border backgroundBorder) {
backgroundBorder.Width = 3;
backgroundBorder.CornerRadius = new CornerRadius(1.5);
backgroundBorder.Opacity = 0;
}
var thumb = track.Thumb.Template.FindName("ScrollbarThumbEx", track.Thumb) ;
if (thumb != null) {
var _thumb = thumb as Border;
_thumb.CornerRadius = new CornerRadius(1.5);
_thumb.Width = 3;
_thumb.Margin = new Thickness(0);
_thumb.Background = new SolidColorBrush(Color.FromRgb(195, 195, 195));
}
}
}
private void ScrollbarThumb_MouseDown(object sender, MouseButtonEventArgs e) {
var thumb = (Thumb)sender;
var border = thumb.Template.FindName("ScrollbarThumbEx",thumb);
((Border)border).Background = new SolidColorBrush(Color.FromRgb(95, 95, 95));
}
private void ScrollbarThumb_MouseUp(object sender, MouseButtonEventArgs e) {
var thumb = (Thumb)sender;
var border = thumb.Template.FindName("ScrollbarThumbEx",thumb);
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
}
}
}

View File

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas.Windows" xmlns:local="clr-namespace:Ink_Canvas.Windows"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:settingsViews="clr-namespace:Ink_Canvas.Windows.SettingsViews"
WindowStartupLocation="CenterScreen" d:DesignHeight="19198" WindowStartupLocation="CenterScreen" d:DesignHeight="19198"
mc:Ignorable="d" WindowStyle="None" ResizeMode="CanMinimize" Background="Transparent" mc:Ignorable="d" WindowStyle="None" ResizeMode="CanMinimize" Background="Transparent"
Title="InkCanvasForClass 设置" Height="691" Width="910" UseLayoutRounding="False"> Title="InkCanvasForClass 设置" Height="691" Width="910" UseLayoutRounding="False">
@ -556,132 +557,7 @@
</Border> </Border>
<!--AboutPanel--> <!--AboutPanel-->
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AboutPane"> <Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AboutPane">
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AboutScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2"> <settingsViews:AboutPanel x:Name="SettingsAboutPanel"/>
<StackPanel Margin="60,12,60,24">
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<Image Name="CopyrightBannerImage"/>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="用户版权信息" HorizontalAlignment="Left"/>
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v2024.8.30" VerticalAlignment="Center" />
<Image Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<DrawingGroup.Transform>
<TranslateTransform X="6.1023980379104614E-05" Y="0" />
</DrawingGroup.Transform>
<GeometryDrawing Brush="#FFFF7800" Geometry="F1 M16,16z M0,0z M8.00493,0C7.74518,0,7.49541,0.0999063,7.2956,0.289728L5.5872,1.99813 2.99963,1.99813C2.45014,1.99813,2.00056,2.44771,2.00056,2.99719L2.00056,5.58476 0.292165,7.29316C-0.0974697,7.6828,-0.0974697,8.31221,0.292165,8.70184L2.00056,10.4102 2.00056,12.9978C2.00056,13.5473,2.45014,13.9969,2.99963,13.9969L5.5872,13.9969 7.2956,15.7053C7.68523,16.0949,8.31464,16.0949,8.70428,15.7053L10.4127,13.9969 13.0003,13.9969C13.5497,13.9969,13.9993,13.5473,13.9993,12.9978L13.9993,10.4102 15.7077,8.70184C16.0973,8.31221,16.0973,7.6828,15.7077,7.29316L13.9993,5.58476 13.9993,2.99719C13.9993,2.44771,13.5497,1.99813,13.0003,1.99813L10.4127,1.99813 8.70428,0.289728C8.50447,0.0899157,8.2547,0,7.99494,0L8.00493,0z M8.00493,4.99532C8.26469,4.99532,8.51446,5.09522,8.71427,5.28505L10.7124,7.28317C10.9022,7.47299,11.0021,7.72276,11.0021,7.99251L11.0021,8.99157 9.004,8.99157 9.004,10.9897 7.00587,10.9897 7.00587,8.99157 5.00774,8.99157 5.00774,7.99251C5.00774,7.73275,5.10765,7.47299,5.29747,7.28317L7.2956,5.28505C7.49541,5.08523,7.74518,4.99532,8.00493,4.99532z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="系统版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutSystemVersion" Foreground="#878787" FontSize="14.5" Text="Windows 10 专业版 19045.3758" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="触摸设备" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutTouchTabletText" Foreground="#878787" FontSize="14.5" Text="无触摸支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="包体构建版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Name="AboutBuildTime" Foreground="#878787" FontSize="14.5" Text="2024.8.22" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版权信息" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<TextBlock Foreground="#878787" FontSize="14.5" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
</Grid>
</StackPanel>
</Border>
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical">
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="ICC 官方网站" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Github 仓库" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvas/InkCanvasForClass" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="贡献者名单" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com/contributors" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M3,2C1.338,2,0,3.338,0,5L0,13C0,14.662,1.338,16,3,16L11,16C12.662,16,14,14.662,14,13L14,9C13.9998,8.4477 13.5522,8 13,8 12.4478,8 12.0002,8.4477 12,9L12,13C12,13.554,11.554,14,11,14L3,14C2.446,14,2,13.554,2,13L2,5C2,4.446,2.446,4,3,4L7,4C7.5523,4 8,3.5523 8,3 8,2.4477 7.5523,2 7,2L3,2z M10,0C9.4477,0 9,0.4477 9,1 9,1.5523 9.4477,2 10,2L12.584,2 7.29303,7.29102C6.90133,7.68172 6.90133,8.31627 7.29303,8.70697 7.68353,9.09737 8.31659,9.09737 8.70709,8.70697L14,3.41412 14,6C14,6.5523 14.4477,7 15,7 15.5523,7 16,6.5523 16,6L16,1C15.9996,0.913 15.988,0.826187 15.965,0.742188 15.942,0.657187 15.909,0.576 15.865,0.5 15.822,0.424 15.768,0.35483 15.7068,0.29303 15.6918,0.28103 15.6758,0.268996 15.6598,0.257996 15.6048,0.207996 15.5433,0.164989 15.4782,0.129089 15.4412,0.110089 15.4022,0.0940781 15.363,0.0800781 15.312,0.0590781 15.2601,0.0431279 15.2067,0.0311279 15.1667,0.0211279 15.1267,0.0171226 15.0856,0.0131226 15.0566,0.00312256 15.0286,0.00309863 14.9996,0.00109863L10,0z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
<TextBlock Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="© 2022-2024 HARKOTEK Studio 提供技术支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="感谢 HARKOTEK Studio 的成员 “幻想熵K2ro_” 提供技术支持" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
<TextBlock Foreground="#878787" Width="356" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 的部分元素设计参考来源于:© iNKORE! 名下产品 Inkways已经过授权使用最终解释权归 Yoojun Zhou 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontWeight="Bold" Width="276" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 小量地使用了 iNKORE! 开发的 UI 组件库iNKORE.UI.WPF.Modern" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
<TextBlock Foreground="#878787" FontSize="12" Text="osu! 相关素材:© ppy powered 2007-2024" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid> </Grid>
<!--ExtensionsPanel--> <!--ExtensionsPanel-->
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="ExtensionsPane"> <Grid Margin="250,48,0,0" Visibility="Collapsed" Name="ExtensionsPane">
@ -1314,7 +1190,7 @@
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
<!--StartupPanel--> <!--StartupPanel-->
<Grid Margin="250,48,0,0" Visibility="Visible" Name="StartupPane"> <Grid Margin="250,48,0,0" Visibility="Collapsed" Name="StartupPane">
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="StartupScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2"> <ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="StartupScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Border Height="44" Background="#d7e5f6"> <Border Height="44" Background="#d7e5f6">
@ -1452,9 +1328,9 @@
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
<!--AppearancePanel--> <!--AppearancePanel-->
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AppearancePane"> <Grid Margin="250,48,0,0" Visibility="Visible" Name="AppearancePane">
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AppearanceScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2"> <ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AppearanceScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
<StackPanel Margin="60,12,60,24"> <StackPanel Margin="0,12,0,24" HorizontalAlignment="Center" Width="524">
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8"> <Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Grid Height="54"> <Grid Height="54">
@ -3366,7 +3242,7 @@
<Grid Height="48" VerticalAlignment="Top" Margin="250,0,0,0"> <Grid Height="48" VerticalAlignment="Top" Margin="250,0,0,0">
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa"> <Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
<Border.Clip> <Border.Clip>
<RectangleGeometry Rect="0,0,641.6,56"/> <RectangleGeometry Rect="0,0,640,56"/>
</Border.Clip> </Border.Clip>
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa" > <Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa" >
<Border.Effect> <Border.Effect>

View File

@ -16,6 +16,7 @@ using System.Windows.Controls.Primitives;
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.Animation; using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
@ -156,7 +157,7 @@ namespace Ink_Canvas.Windows {
}; };
SettingsPaneScrollViewers = new ScrollViewer[] { SettingsPaneScrollViewers = new ScrollViewer[] {
AboutScrollViewerEx, SettingsAboutPanel.AboutScrollViewerEx,
CanvasAndInkScrollViewerEx, CanvasAndInkScrollViewerEx,
GesturesScrollViewerEx, GesturesScrollViewerEx,
StartupScrollViewerEx, StartupScrollViewerEx,
@ -166,42 +167,8 @@ namespace Ink_Canvas.Windows {
PowerPointScrollViewerEx PowerPointScrollViewerEx
}; };
// 关于页面图片横幅 SettingsAboutPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
if (File.Exists(App.RootPath + "icc-about-illustrations.png")) { SettingsAboutPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
try {
CopyrightBannerImage.Visibility = Visibility.Visible;
CopyrightBannerImage.Source =
new BitmapImage(new Uri($"file://{App.RootPath + "icc-about-illustrations.png"}"));
}
catch { }
} else {
CopyrightBannerImage.Visibility = Visibility.Collapsed;
}
// 关于页面构建时间
var buildTime = FileBuildTimeHelper.GetBuildDateTime(System.Reflection.Assembly.GetExecutingAssembly());
if (buildTime != null) {
var bt = ((DateTimeOffset)buildTime).LocalDateTime;
var m = bt.Month.ToString().PadLeft(2, '0');
var d = bt.Day.ToString().PadLeft(2, '0');
var h = bt.Hour.ToString().PadLeft(2, '0');
var min = bt.Minute.ToString().PadLeft(2, '0');
var s = bt.Second.ToString().PadLeft(2, '0');
AboutBuildTime.Text =
$"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}";
}
// 关于页面系统版本
AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
// 关于页面触摸设备
var _t_touch = new Thread(() => {
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
var support = TouchTabletDetectHelper.IsTouchEnabled();
Dispatcher.BeginInvoke(() =>
AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "" : "")}");
});
_t_touch.Start();
} }
public Grid[] SettingsPanes = new Grid[] { }; public Grid[] SettingsPanes = new Grid[] { };
@ -256,98 +223,6 @@ namespace Ink_Canvas.Windows {
} }
} }
public static class TouchTabletDetectHelper {
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex);
public static bool IsTouchEnabled()
{
const int MAXTOUCHES_INDEX = 95;
int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX);
return maxTouches > 0;
}
public class USBDeviceInfo
{
public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
{
this.DeviceID = deviceID;
this.PnpDeviceID = pnpDeviceID;
this.Description = description;
}
public string DeviceID { get; private set; }
public string PnpDeviceID { get; private set; }
public string Description { get; private set; }
}
public static List<USBDeviceInfo> GetTouchTabletDevices()
{
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
collection = searcher.Get();
foreach (var device in collection) {
var name = new StringBuilder((string)device.GetPropertyValue("Name")).ToString();
if (!name.Contains("Pentablet")) continue;
devices.Add(new USBDeviceInfo(
(string)device.GetPropertyValue("DeviceID"),
(string)device.GetPropertyValue("PNPDeviceID"),
(string)device.GetPropertyValue("Description")
));
}
collection.Dispose();
return devices;
}
}
public static class FileBuildTimeHelper {
public struct _IMAGE_FILE_HEADER
{
public ushort Machine;
public ushort NumberOfSections;
public uint TimeDateStamp;
public uint PointerToSymbolTable;
public uint NumberOfSymbols;
public ushort SizeOfOptionalHeader;
public ushort Characteristics;
};
public static DateTimeOffset? GetBuildDateTime(Assembly assembly)
{
var path = assembly.Location;
if (File.Exists(path))
{
var buffer = new byte[Math.Max(Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER)), 4)];
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
fileStream.Position = 0x3C;
fileStream.Read(buffer, 0, 4);
fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset
fileStream.Read(buffer, 0, 4); // "PE\0\0"
fileStream.Read(buffer, 0, buffer.Length);
}
var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try
{
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
return DateTimeOffset.FromUnixTimeSeconds(coffHeader.TimeDateStamp);
}
finally
{
pinnedBuffer.Free();
}
}
else
{
return null;
}
}
}
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e) { private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e) {
var scrollViewer = (ScrollViewer)sender; var scrollViewer = (ScrollViewer)sender;
if (scrollViewer.VerticalOffset >= 10) { if (scrollViewer.VerticalOffset >= 10) {

View File

@ -0,0 +1,39 @@
# InkCanvasForClass 配置文件
# 版本v1.0 2024-9-12
Version = 1.0
#
#
[FloatingBar] # 浮动工具栏
SemiTransparent = false # 半透明工具栏
# 开启半透明工具栏后,所有按钮都会呈现为半透明状态
NearSnap = false # 靠近屏幕角落自动吸附
InitialPosition = "Center" # 初始位置
# 初始位置可以是 "TopLeft" "TopRight" "BottomLeft" "BottomRight" "BottomCenter" "TopCenter"
# 或者以数组形式传入浮动工具栏左上角定位的坐标
ElementCornerRadius = "SuperEllipse" # 圆角类型
# 圆角类型可以是 "SuperEllipse" "Circle" "None"
# 也可以是具体的数字大小,如 1.14 5.14 2 16
# 最大圆角值为 24相当于 "Circle""SuperEllipse" 是超椭圆
ParallaxEffect = true # 视差效果
MiniMode = true # 迷你模式
MiniModeTrigger = false # 浮动工具栏迷你模式触发器,暂未实现
# 可选 "HeadIconMouseButtonRight" "HeadIconMouseButtonCenter" "HeadIconMouseButtonLeftWithCtrlKey"
# 可使用 KeyStroke 来填入触发器
ClearButtonColor = [224, 27, 36] # 清空按钮颜色
ClearButtonPressColor = [254, 226, 226] # 清空按钮按下时颜色
ToolButtonSelectedBgColor = [37, 99, 235] # 工具按钮选中颜色
MovingLimitationNoSnap = 12 # 移动限制 无Snap0 关闭
MovingLimitationSnapped = 24 # 移动限制 Snaped0 关闭
#
[FloatingBar.NearSnapAreaSize] # 浮动工具栏角落吸附区域大小
TopLeft = 24 # 左上角
TopRight = 24 # 右上角
BottomLeft = [24,24] # 左下角
BottomRight = [24,24] # 右下角
TopCenter = 24 # 顶部
BottomCenter = 24 # 底部
#
[FloatingBar.ToolBarItems] # 浮动工具栏工具按钮排序和显示
CursorMode = [ "Cursor", "Pen", "Clear" , "Separator", "Whiteboard", "Gesture", "Menu", "Fold" ]
MiniMode = [ "Cursor", "Pen", "Clear" ]
AnnotationMode = [ "Cursor", "Pen", "Clear", "Separator", "Eraser", "ShapeDrawing", "Select", "Separator", "Undo", "Redo", "Separator", "Whiteboard", "Gesture", "Menu", "Fold" ]