Merge branch 'beta' of https://github.com/InkCanvasForClass/community into beta
This commit is contained in:
@@ -73,8 +73,8 @@
|
|||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
<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="#9a9996" FontSize="12" Margin="0,0,0,3" Text="设备ID" HorizontalAlignment="Left"/>
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
|
<TextBlock Name="AboutDeviceID" Foreground="#2e3436" FontSize="14.5" Text="正在获取..." HorizontalAlignment="Left"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||||
<TextBlock Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v2024.8.30" VerticalAlignment="Center" />
|
<TextBlock Name="AboutAppVersion" Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v1.7.18.4" VerticalAlignment="Center" />
|
||||||
<Image Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center">
|
<Image Name="UpdateAvailableIcon" Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center" Visibility="Collapsed">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<DrawingImage>
|
||||||
<DrawingImage.Drawing>
|
<DrawingImage.Drawing>
|
||||||
@@ -113,13 +113,13 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Border Height="1" Background="#ebebeb"/>
|
<Border Height="1" Background="#ebebeb"/>
|
||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="包体构建版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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"/>
|
<TextBlock Name="AboutBuildTime" Foreground="#878787" FontSize="14.5" Text="2024.8.22" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Border Height="1" Background="#ebebeb"/>
|
<Border Height="1" Background="#ebebeb"/>
|
||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版权信息" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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"/>
|
<TextBlock Name="AboutCopyright" Foreground="#878787" FontSize="14.5" Text="正在获取..." VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="ICC 官方网站" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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">
|
<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"/>
|
<TextBlock Name="LinkOfficialWebsite" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="inkcanvasforclass.github.io" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkOfficialWebsite_MouseLeftButtonDown"/>
|
||||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<DrawingImage>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Github 仓库" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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">
|
<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"/>
|
<TextBlock Name="LinkGithubRepo" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkGithubRepo_MouseLeftButtonDown"/>
|
||||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<DrawingImage>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
<Grid Height="54">
|
<Grid Height="54">
|
||||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="贡献者名单" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
<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">
|
<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"/>
|
<TextBlock Name="LinkContributors" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community#贡献者" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkContributors_MouseLeftButtonDown"/>
|
||||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<DrawingImage>
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
|
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
|
||||||
<TextBlock Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
|
<TextBlock Name="AboutBottomCopyright" Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="正在获取..." 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" 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" 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"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using iNKORE.UI.WPF.Helpers;
|
using iNKORE.UI.WPF.Helpers;
|
||||||
|
using Ink_Canvas.Helpers;
|
||||||
using OSVersionExtension;
|
using OSVersionExtension;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -14,6 +16,7 @@ using System.Windows.Controls.Primitives;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Ink_Canvas.Windows.SettingsViews
|
namespace Ink_Canvas.Windows.SettingsViews
|
||||||
{
|
{
|
||||||
@@ -42,32 +45,135 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
CopyrightBannerImage.Visibility = Visibility.Collapsed;
|
CopyrightBannerImage.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关于页面构建时间
|
try
|
||||||
var buildTime = FileBuildTimeHelper.GetBuildDateTime(Assembly.GetExecutingAssembly());
|
|
||||||
if (buildTime != null)
|
|
||||||
{
|
{
|
||||||
var bt = ((DateTimeOffset)buildTime).LocalDateTime;
|
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
var m = bt.Month.ToString().PadLeft(2, '0');
|
AboutAppVersion.Text = $"InkCanvasForClass v{version}";
|
||||||
var d = bt.Day.ToString().PadLeft(2, '0');
|
}
|
||||||
var h = bt.Hour.ToString().PadLeft(2, '0');
|
catch (Exception ex)
|
||||||
var min = bt.Minute.ToString().PadLeft(2, '0');
|
{
|
||||||
var s = bt.Second.ToString().PadLeft(2, '0');
|
AboutAppVersion.Text = "InkCanvasForClass v未知";
|
||||||
AboutBuildTime.Text =
|
System.Diagnostics.Debug.WriteLine($"获取软件版本失败: {ex.Message}");
|
||||||
$"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}";
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string deviceId = DeviceIdentifier.GetDeviceId();
|
||||||
|
AboutDeviceID.Text = deviceId;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AboutDeviceID.Text = "获取失败";
|
||||||
|
System.Diagnostics.Debug.WriteLine($"获取设备ID失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var copyright = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyCopyrightAttribute>();
|
||||||
|
if (copyright != null && !string.IsNullOrEmpty(copyright.Copyright))
|
||||||
|
{
|
||||||
|
var copyrightText = copyright.Copyright;
|
||||||
|
AboutCopyright.Text = copyrightText;
|
||||||
|
AboutBottomCopyright.Text = copyrightText.Replace("Copyright ©", "© Copyright") + " 所有";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
|
||||||
|
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
|
||||||
|
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
|
||||||
|
System.Diagnostics.Debug.WriteLine($"获取版权信息失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
var filePath = assembly.Location;
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
var bt = File.GetCreationTime(filePath);
|
||||||
|
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 = $"{bt.Year}-{m}-{d} {h}:{min}:{s}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AboutBuildTime.Text = "获取失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AboutBuildTime.Text = "获取失败";
|
||||||
|
System.Diagnostics.Debug.WriteLine($"获取构建时间失败: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关于页面系统版本
|
|
||||||
AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
|
AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
|
||||||
|
|
||||||
// 关于页面触摸设备
|
|
||||||
var _t_touch = new Thread(() =>
|
var _t_touch = new Thread(() =>
|
||||||
{
|
{
|
||||||
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
|
try
|
||||||
var support = TouchTabletDetectHelper.IsTouchEnabled();
|
{
|
||||||
Dispatcher.BeginInvoke(() =>
|
var support = TouchTabletDetectHelper.IsTouchEnabled();
|
||||||
AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "支持触摸设备" : "无触摸支持")}");
|
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
|
||||||
|
|
||||||
|
Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
if (support)
|
||||||
|
{
|
||||||
|
if (touchcount > 0)
|
||||||
|
{
|
||||||
|
AboutTouchTabletText.Text = $"{touchcount}个设备,支持触摸设备";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AboutTouchTabletText.Text = "支持触摸设备";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AboutTouchTabletText.Text = "无触摸支持";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(() =>
|
||||||
|
AboutTouchTabletText.Text = "检测失败");
|
||||||
|
System.Diagnostics.Debug.WriteLine($"检测触摸设备失败: {ex.Message}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
_t_touch.Start();
|
_t_touch.Start();
|
||||||
|
|
||||||
|
CheckUpdateStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckUpdateStatus()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||||
|
if (mainWindow != null)
|
||||||
|
{
|
||||||
|
var field = typeof(MainWindow).GetField("AvailableLatestVersion", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
if (field != null)
|
||||||
|
{
|
||||||
|
var availableVersion = field.GetValue(mainWindow) as string;
|
||||||
|
if (!string.IsNullOrEmpty(availableVersion))
|
||||||
|
{
|
||||||
|
UpdateAvailableIcon.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TouchTabletDetectHelper
|
public static class TouchTabletDetectHelper
|
||||||
@@ -100,22 +206,51 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
{
|
{
|
||||||
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
|
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
|
||||||
|
|
||||||
ManagementObjectCollection collection;
|
try
|
||||||
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();
|
ManagementObjectCollection collection;
|
||||||
if (!name.Contains("Pentablet")) continue;
|
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
|
||||||
devices.Add(new USBDeviceInfo(
|
collection = searcher.Get();
|
||||||
(string)device.GetPropertyValue("DeviceID"),
|
|
||||||
(string)device.GetPropertyValue("PNPDeviceID"),
|
foreach (var device in collection)
|
||||||
(string)device.GetPropertyValue("Description")
|
{
|
||||||
));
|
try
|
||||||
|
{
|
||||||
|
var name = device.GetPropertyValue("Name")?.ToString() ?? "";
|
||||||
|
var description = device.GetPropertyValue("Description")?.ToString() ?? "";
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name)) continue;
|
||||||
|
|
||||||
|
var nameLower = name.ToLower();
|
||||||
|
var descLower = description.ToLower();
|
||||||
|
|
||||||
|
if (nameLower.Contains("pentablet") ||
|
||||||
|
nameLower.Contains("tablet") ||
|
||||||
|
nameLower.Contains("touch") ||
|
||||||
|
nameLower.Contains("digitizer") ||
|
||||||
|
descLower.Contains("touch") ||
|
||||||
|
descLower.Contains("digitizer"))
|
||||||
|
{
|
||||||
|
devices.Add(new USBDeviceInfo(
|
||||||
|
device.GetPropertyValue("DeviceID")?.ToString() ?? "",
|
||||||
|
device.GetPropertyValue("PNPDeviceID")?.ToString() ?? "",
|
||||||
|
description
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"获取触摸设备列表失败: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
collection.Dispose();
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,30 +270,48 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
|
|
||||||
public static DateTimeOffset? GetBuildDateTime(Assembly assembly)
|
public static DateTimeOffset? GetBuildDateTime(Assembly assembly)
|
||||||
{
|
{
|
||||||
var path = assembly.Location;
|
try
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
{
|
||||||
var buffer = new byte[Math.Max(Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER)), 4)];
|
var path = assembly.Location;
|
||||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
|
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
|
{
|
||||||
|
var peHeader = new byte[4];
|
||||||
fileStream.Position = 0x3C;
|
fileStream.Position = 0x3C;
|
||||||
fileStream.Read(buffer, 0, 4);
|
fileStream.Read(peHeader, 0, 4);
|
||||||
fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset
|
var peHeaderOffset = BitConverter.ToUInt32(peHeader, 0);
|
||||||
fileStream.Read(buffer, 0, 4); // "PE\0\0"
|
|
||||||
fileStream.Read(buffer, 0, buffer.Length);
|
fileStream.Position = peHeaderOffset;
|
||||||
}
|
var signature = new byte[4];
|
||||||
var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
fileStream.Read(signature, 0, 4);
|
||||||
try
|
|
||||||
{
|
if (signature[0] != 0x50 || signature[1] != 0x45 || signature[2] != 0x00 || signature[3] != 0x00)
|
||||||
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
|
{
|
||||||
return DateTimeOffset.FromUnixTimeSeconds(coffHeader.TimeDateStamp);
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
var fileHeader = new byte[Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER))];
|
||||||
pinnedBuffer.Free();
|
fileStream.Read(fileHeader, 0, fileHeader.Length);
|
||||||
|
|
||||||
|
var pinnedBuffer = GCHandle.Alloc(fileHeader, GCHandleType.Pinned);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
|
||||||
|
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
var buildTime = epoch.AddSeconds(coffHeader.TimeDateStamp);
|
||||||
|
return new DateTimeOffset(buildTime.ToLocalTime());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
pinnedBuffer.Free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -260,6 +413,55 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
|
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void LinkOfficialWebsite_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://inkcanvasforclass.github.io",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"打开官方网站失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LinkGithubRepo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://github.com/InkCanvasForClass/community",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"打开GitHub仓库失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LinkContributors_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://github.com/InkCanvasForClass/community#贡献者",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"打开贡献者名单失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用主题
|
/// 应用主题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -71,15 +71,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
// 随机点名
|
// 随机点名
|
||||||
new SettingItem { Title = "随机点名", Category = "随机点名", ItemName = "LuckyRandomItem", Type = SettingItemType.Category },
|
new SettingItem { Title = "随机点名", Category = "随机点名", ItemName = "LuckyRandomItem", Type = SettingItemType.Category },
|
||||||
|
|
||||||
// 存储空间
|
// 高级选项
|
||||||
new SettingItem { Title = "存储空间", Category = "存储空间", ItemName = "StorageItem", Type = SettingItemType.Category },
|
new SettingItem { Title = "高级选项", Category = "高级选项", ItemName = "AdvancedItem", Type = SettingItemType.Category },
|
||||||
|
|
||||||
// 截图和屏幕捕捉
|
// 截图和屏幕捕捉
|
||||||
new SettingItem { Title = "截图和屏幕捕捉", Category = "截图和屏幕捕捉", ItemName = "SnapshotItem", Type = SettingItemType.Category },
|
new SettingItem { Title = "截图和屏幕捕捉", Category = "截图和屏幕捕捉", ItemName = "SnapshotItem", Type = SettingItemType.Category },
|
||||||
|
|
||||||
// 高级选项
|
|
||||||
new SettingItem { Title = "高级选项", Category = "高级选项", ItemName = "AdvancedItem", Type = SettingItemType.Category },
|
|
||||||
|
|
||||||
// 关于
|
// 关于
|
||||||
new SettingItem { Title = "关于 InkCanvasForClass", Category = "关于", ItemName = "AboutItem", Type = SettingItemType.Category },
|
new SettingItem { Title = "关于 InkCanvasForClass", Category = "关于", ItemName = "AboutItem", Type = SettingItemType.Category },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -796,9 +796,9 @@
|
|||||||
<settingsViews:LuckyRandomPanel x:Name="LuckyRandomPanel"/>
|
<settingsViews:LuckyRandomPanel x:Name="LuckyRandomPanel"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--存储面板-->
|
<!--高级面板-->
|
||||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="StoragePane">
|
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AdvancedPane">
|
||||||
<settingsViews:StoragePanel x:Name="StoragePanel"/>
|
<settingsViews:AdvancedPanel x:Name="AdvancedPanel"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--截图面板-->
|
<!--截图面板-->
|
||||||
@@ -806,11 +806,6 @@
|
|||||||
<settingsViews:SnapshotPanel x:Name="SnapshotPanel"/>
|
<settingsViews:SnapshotPanel x:Name="SnapshotPanel"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--高级面板-->
|
|
||||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AdvancedPane">
|
|
||||||
<settingsViews:AdvancedPanel x:Name="AdvancedPanel"/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!--SearchPanel-->
|
<!--SearchPanel-->
|
||||||
<Grid Margin="0,0,0,0" Visibility="Collapsed" Name="SearchPane" ZIndex="1000">
|
<Grid Margin="0,0,0,0" Visibility="Collapsed" Name="SearchPane" ZIndex="1000">
|
||||||
<settingsViews:SearchPanel x:Name="SearchPanelControl"/>
|
<settingsViews:SearchPanel x:Name="SearchPanelControl"/>
|
||||||
|
|||||||
@@ -135,9 +135,9 @@ namespace Ink_Canvas.Windows
|
|||||||
SidebarItems.Add(new SidebarItem()
|
SidebarItems.Add(new SidebarItem()
|
||||||
{
|
{
|
||||||
Type = SidebarItemType.Item,
|
Type = SidebarItemType.Item,
|
||||||
Title = "存储空间",
|
Title = "高级选项",
|
||||||
Name = "StorageItem",
|
Name = "AdvancedItem",
|
||||||
IconSource = FindResource("StorageIcon") as DrawingImage,
|
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
||||||
Selected = false,
|
Selected = false,
|
||||||
});
|
});
|
||||||
SidebarItems.Add(new SidebarItem()
|
SidebarItems.Add(new SidebarItem()
|
||||||
@@ -153,14 +153,6 @@ namespace Ink_Canvas.Windows
|
|||||||
Type = SidebarItemType.Separator
|
Type = SidebarItemType.Separator
|
||||||
});
|
});
|
||||||
SidebarItems.Add(new SidebarItem()
|
SidebarItems.Add(new SidebarItem()
|
||||||
{
|
|
||||||
Type = SidebarItemType.Item,
|
|
||||||
Title = "高级选项",
|
|
||||||
Name = "AdvancedItem",
|
|
||||||
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
|
||||||
Selected = false,
|
|
||||||
});
|
|
||||||
SidebarItems.Add(new SidebarItem()
|
|
||||||
{
|
{
|
||||||
Type = SidebarItemType.Item,
|
Type = SidebarItemType.Item,
|
||||||
Title = "关于 InkCanvasForClass",
|
Title = "关于 InkCanvasForClass",
|
||||||
@@ -180,9 +172,8 @@ namespace Ink_Canvas.Windows
|
|||||||
AutomationPane,
|
AutomationPane,
|
||||||
PowerPointPane,
|
PowerPointPane,
|
||||||
LuckyRandomPane,
|
LuckyRandomPane,
|
||||||
StoragePane,
|
AdvancedPane,
|
||||||
SnapshotPane,
|
SnapshotPane
|
||||||
AdvancedPane
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPaneScrollViewers = new ScrollViewer[] {
|
SettingsPaneScrollViewers = new ScrollViewer[] {
|
||||||
@@ -197,9 +188,8 @@ namespace Ink_Canvas.Windows
|
|||||||
AutomationPanel.ScrollViewerEx,
|
AutomationPanel.ScrollViewerEx,
|
||||||
PowerPointPanel.ScrollViewerEx,
|
PowerPointPanel.ScrollViewerEx,
|
||||||
LuckyRandomPanel.ScrollViewerEx,
|
LuckyRandomPanel.ScrollViewerEx,
|
||||||
StoragePanel.ScrollViewerEx,
|
AdvancedPanel.ScrollViewerEx,
|
||||||
SnapshotPanel.ScrollViewerEx,
|
SnapshotPanel.ScrollViewerEx
|
||||||
AdvancedPanel.ScrollViewerEx
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPaneTitles = new string[] {
|
SettingsPaneTitles = new string[] {
|
||||||
@@ -214,9 +204,8 @@ namespace Ink_Canvas.Windows
|
|||||||
"自动化",
|
"自动化",
|
||||||
"PowerPoint",
|
"PowerPoint",
|
||||||
"幸运随机",
|
"幸运随机",
|
||||||
"存储",
|
"高级",
|
||||||
"截图",
|
"截图"
|
||||||
"高级"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPaneNames = new string[] {
|
SettingsPaneNames = new string[] {
|
||||||
@@ -231,9 +220,8 @@ namespace Ink_Canvas.Windows
|
|||||||
"AutomationItem",
|
"AutomationItem",
|
||||||
"PowerPointItem",
|
"PowerPointItem",
|
||||||
"LuckyRandomItem",
|
"LuckyRandomItem",
|
||||||
"StorageItem",
|
"AdvancedItem",
|
||||||
"SnapshotItem",
|
"SnapshotItem"
|
||||||
"AdvancedItem"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsAboutPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
SettingsAboutPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||||
@@ -267,12 +255,10 @@ namespace Ink_Canvas.Windows
|
|||||||
CrashActionPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
CrashActionPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||||
LuckyRandomPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
LuckyRandomPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||||
LuckyRandomPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
LuckyRandomPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||||
StoragePanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
|
||||||
StoragePanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
|
||||||
SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
|
||||||
SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
|
||||||
AdvancedPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
AdvancedPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||||
AdvancedPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
AdvancedPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||||
|
SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||||
|
SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||||
|
|
||||||
_selectedSidebarItemName = "StartupItem";
|
_selectedSidebarItemName = "StartupItem";
|
||||||
|
|
||||||
@@ -323,8 +309,8 @@ namespace Ink_Canvas.Windows
|
|||||||
{
|
{
|
||||||
StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel,
|
StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel,
|
||||||
ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel,
|
ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel,
|
||||||
AutomationPanel, LuckyRandomPanel, StoragePanel, SnapshotPanel,
|
AutomationPanel, LuckyRandomPanel, AdvancedPanel, SnapshotPanel,
|
||||||
AdvancedPanel, SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var panel in panels)
|
foreach (var panel in panels)
|
||||||
@@ -766,9 +752,8 @@ namespace Ink_Canvas.Windows
|
|||||||
PowerPointPanel,
|
PowerPointPanel,
|
||||||
AutomationPanel,
|
AutomationPanel,
|
||||||
LuckyRandomPanel,
|
LuckyRandomPanel,
|
||||||
StoragePanel,
|
|
||||||
SnapshotPanel,
|
|
||||||
AdvancedPanel,
|
AdvancedPanel,
|
||||||
|
SnapshotPanel,
|
||||||
SettingsAboutPanel,
|
SettingsAboutPanel,
|
||||||
AppearancePanel
|
AppearancePanel
|
||||||
};
|
};
|
||||||
@@ -960,9 +945,8 @@ namespace Ink_Canvas.Windows
|
|||||||
{ "AutomationItem", AutomationPanel },
|
{ "AutomationItem", AutomationPanel },
|
||||||
{ "PowerPointItem", PowerPointPanel },
|
{ "PowerPointItem", PowerPointPanel },
|
||||||
{ "LuckyRandomItem", LuckyRandomPanel },
|
{ "LuckyRandomItem", LuckyRandomPanel },
|
||||||
{ "StorageItem", StoragePanel },
|
|
||||||
{ "SnapshotItem", SnapshotPanel },
|
|
||||||
{ "AdvancedItem", AdvancedPanel },
|
{ "AdvancedItem", AdvancedPanel },
|
||||||
|
{ "SnapshotItem", SnapshotPanel },
|
||||||
{ "AppearanceItem", AppearancePanel }
|
{ "AppearanceItem", AppearancePanel }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -978,9 +962,8 @@ namespace Ink_Canvas.Windows
|
|||||||
if (AutomationPane != null) AutomationPane.Visibility = _selectedSidebarItemName == "AutomationItem" ? Visibility.Visible : Visibility.Collapsed;
|
if (AutomationPane != null) AutomationPane.Visibility = _selectedSidebarItemName == "AutomationItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||||
if (PowerPointPane != null) PowerPointPane.Visibility = _selectedSidebarItemName == "PowerPointItem" ? Visibility.Visible : Visibility.Collapsed;
|
if (PowerPointPane != null) PowerPointPane.Visibility = _selectedSidebarItemName == "PowerPointItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||||
if (LuckyRandomPane != null) LuckyRandomPane.Visibility = _selectedSidebarItemName == "LuckyRandomItem" ? Visibility.Visible : Visibility.Collapsed;
|
if (LuckyRandomPane != null) LuckyRandomPane.Visibility = _selectedSidebarItemName == "LuckyRandomItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||||
if (StoragePane != null) StoragePane.Visibility = _selectedSidebarItemName == "StorageItem" ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
if (AdvancedPane != null) AdvancedPane.Visibility = _selectedSidebarItemName == "AdvancedItem" ? Visibility.Visible : Visibility.Collapsed;
|
if (AdvancedPane != null) AdvancedPane.Visibility = _selectedSidebarItemName == "AdvancedItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
// 为新显示的面板应用主题(延迟执行,确保面板已完全显示)
|
// 为新显示的面板应用主题(延迟执行,确保面板已完全显示)
|
||||||
if (panelMappings.ContainsKey(_selectedSidebarItemName))
|
if (panelMappings.ContainsKey(_selectedSidebarItemName))
|
||||||
|
|||||||
Reference in New Issue
Block a user