This commit is contained in:
XY Wang 2021-10-07 00:25:12 +08:00
parent aa058221f5
commit cbe4002ad1
5 changed files with 80 additions and 37 deletions

View File

@ -13,7 +13,7 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="60"/> <RowDefinition Height="60"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="世界上最好用的 Ink Canvas 画板已升级到最新版本" FontFamily="Microsoft YaHei UI" FontSize="26" Margin="20,0"/> <Label Content="月考结束,讲评试卷的好帮手 Ink Canvas 画板也更新啦" FontFamily="Microsoft YaHei UI" FontSize="26" Margin="20,0"/>
<StackPanel Grid.Row="1"> <StackPanel Grid.Row="1">
<TextBlock Name="TextBlockChangeLogTitle" Text="更新日志" FontSize="18" FontWeight="Bold" Margin="35,10,35,0"/> <TextBlock Name="TextBlockChangeLogTitle" Text="更新日志" FontSize="18" FontWeight="Bold" Margin="35,10,35,0"/>
<TextBlock Name="TextBlockChangeLog" Text="" FontSize="14" Margin="55,5"/> <TextBlock Name="TextBlockChangeLog" Text="" FontSize="14" Margin="55,5"/>

View File

@ -37,12 +37,19 @@ namespace Ink_Canvas
//TextBlockSuggestion.Text = "打开设置,点击“重置”中的“重置设置为推荐设置”,以提升教学体验!"; //TextBlockSuggestion.Text = "打开设置,点击“重置”中的“重置设置为推荐设置”,以提升教学体验!";
//Version 2.1.1-release //Version 2.1.1-release
//TextBlockChangeLog.Text = "" +
// "1. 修复部分情况下幻灯片放映翻页时墨迹保留的问题\n" +
// "2. 支持选中后的缩放和拖动\n" +
// "3. 修复部分模式下自动橡皮失效的问题\n" +
// "4. 修复幻灯片放映时的部分问题";
//TextBlockSuggestion.Text = "打开设置,点击“重置”中的“重置设置为推荐设置”,以提升教学体验!";
//Version 2.1.2-release
TextBlockChangeLog.Text = "" + TextBlockChangeLog.Text = "" +
"1. 修复部分情况下幻灯片放映翻页时墨迹保留的问题\n" + "1. 修复由缩放导致的崩溃\n" +
"2. 支持选中后的缩放和拖动\n" + "2. 优化选中墨迹后的缩放\n" +
"3. 修复部分模式下自动橡皮失效的问题\n" + "3. 修复部分情况下无法书写的问题(未测试)";
"4. 修复幻灯片放映时的部分问题"; TextBlockSuggestion.Text = "老师讲评试卷可以点击右侧的背景和深色按钮,即可启动黑板功能(同样支持用笔来擦除),\n双指可以缩放和拖动左边也会有工具栏方便画图形。";
TextBlockSuggestion.Text = "打开设置,点击“重置”中的“重置设置为推荐设置”,以提升教学体验!";
Version version = Assembly.GetExecutingAssembly().GetName().Version; Version version = Assembly.GetExecutingAssembly().GetName().Version;
LabelVersion.Content = "Version: " + version.ToString(); LabelVersion.Content = "Version: " + version.ToString();

View File

@ -77,6 +77,7 @@
Text="*部分设置可能需要重新打开后生效。"/> Text="*部分设置可能需要重新打开后生效。"/>
<GroupBox Header="行为"> <GroupBox Header="行为">
<ui:SimpleStackPanel Spacing="12"> <ui:SimpleStackPanel Spacing="12">
<Button Content="立即重新启动画板" Width="160" FontFamily="Microsoft YaHei UI" Click="BtnRestart_Click" Margin="0,0,0,10"/>
<ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" Header="开机时运行" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled"/> <ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" Header="开机时运行" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled"/>
<TextBlock Text="我们并不推荐使用 WPS Office因为其对于触摸设备的较差支持。" Foreground="#666666"/> <TextBlock Text="我们并不推荐使用 WPS Office因为其对于触摸设备的较差支持。" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchSupportPowerPoint" Header="Microsoft PowerPoint 支持" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchSupportPowerPoint_Toggled"/> <ui:ToggleSwitch Name="ToggleSwitchSupportPowerPoint" Header="Microsoft PowerPoint 支持" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchSupportPowerPoint_Toggled"/>

View File

@ -138,6 +138,27 @@ namespace Ink_Canvas
} }
} }
Application.Current.Dispatcher.Invoke(() =>
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;
TextBlockVersion.Text = version.ToString();
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
string lastVersion = "";
try
{
lastVersion = File.ReadAllText(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "versions.ini");
}
catch { }
if (!lastVersion.Contains(version.ToString()))
{
new ChangeLogWindow().ShowDialog();
lastVersion += "\n" + version.ToString();
File.WriteAllText("versions.ini", lastVersion.Trim());
}
});
try try
{ {
if (response.Contains("<update>")) if (response.Contains("<update>"))
@ -180,30 +201,14 @@ namespace Ink_Canvas
//加载设置 //加载设置
LoadSettings(); LoadSettings();
Version version = Assembly.GetExecutingAssembly().GetName().Version; TextBlockVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
TextBlockVersion.Text = version.ToString();
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
string lastVersion = "";
try
{
lastVersion = File.ReadAllText("versions.ini");
}
catch { }
if (!lastVersion.Contains(version.ToString()))
{
new ChangeLogWindow().ShowDialog();
lastVersion += "\n" + version.ToString();
File.WriteAllText("versions.ini", lastVersion.Trim());
}
isLoaded = true; isLoaded = true;
} }
private void LoadSettings(bool isStartup = true) private void LoadSettings(bool isStartup = true)
{ {
if (File.Exists(settingsFileName)) if (File.Exists(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + settingsFileName))
{ {
try try
{ {
@ -414,6 +419,13 @@ namespace Ink_Canvas
Close(); Close();
} }
private void BtnRestart_Click(object sender, RoutedEventArgs e)
{
Process.Start(System.Windows.Forms.Application.ExecutablePath);
Application.Current.Shutdown();
}
private void BtnSettings_Click(object sender, RoutedEventArgs e) private void BtnSettings_Click(object sender, RoutedEventArgs e)
{ {
if (BorderSettings.Visibility == Visibility.Visible) if (BorderSettings.Visibility == Visibility.Visible)
@ -662,9 +674,13 @@ namespace Ink_Canvas
{ {
stroke.Transform(m, false); stroke.Transform(m, false);
try
{
stroke.DrawingAttributes.Width *= md.Scale.X; stroke.DrawingAttributes.Width *= md.Scale.X;
stroke.DrawingAttributes.Height *= md.Scale.Y; stroke.DrawingAttributes.Height *= md.Scale.Y;
} }
catch { }
}
} }
else else
{ {
@ -672,9 +688,13 @@ namespace Ink_Canvas
{ {
stroke.Transform(m, false); stroke.Transform(m, false);
try
{
stroke.DrawingAttributes.Width *= md.Scale.X; stroke.DrawingAttributes.Width *= md.Scale.X;
stroke.DrawingAttributes.Height *= md.Scale.Y; stroke.DrawingAttributes.Height *= md.Scale.Y;
} }
catch { }
}
} }
} }
} }
@ -759,6 +779,7 @@ namespace Ink_Canvas
Main_Grid.Background = new SolidColorBrush(StringToColor("#01FFFFFF")); Main_Grid.Background = new SolidColorBrush(StringToColor("#01FFFFFF"));
inkCanvas.Visibility = Visibility.Visible; inkCanvas.Visibility = Visibility.Visible;
GridBackgroundCoverHolder.Visibility = Visibility.Visible; GridBackgroundCoverHolder.Visibility = Visibility.Visible;
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
BtnHideInkCanvas.Content = "隐藏\n画板"; BtnHideInkCanvas.Content = "隐藏\n画板";
} }
else else
@ -838,6 +859,7 @@ namespace Ink_Canvas
private void TimerCheckPPT_Elapsed(object sender, ElapsedEventArgs e) private void TimerCheckPPT_Elapsed(object sender, ElapsedEventArgs e)
{ {
timerCheckPPT.Stop();
try try
{ {
Process[] processes = Process.GetProcessesByName("wpp"); Process[] processes = Process.GetProcessesByName("wpp");
@ -845,11 +867,12 @@ namespace Ink_Canvas
{ {
return; return;
} }
//processes = Process.GetProcessesByName("wps");
//if (processes.Length > 0) //pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("91493441-5A91-11CF-8700-00AA0060263B")));
//{ //new ComAwareEventInfo(typeof(EApplication_Event), "SlideShowBegin").AddEventHandler(pptApplication, new EApplication_SlideShowBeginEventHandler(this.PptApplication_SlideShowBegin));
// return; //new ComAwareEventInfo(typeof(EApplication_Event), "SlideShowEnd").AddEventHandler(pptApplication, new EApplication_SlideShowEndEventHandler(this.PptApplication_SlideShowEnd));
//} //new ComAwareEventInfo(typeof(EApplication_Event), "SlideShowNextSlide").AddEventHandler(pptApplication, new EApplication_SlideShowNextSlideEventHandler(this.PptApplication_SlideShowNextSlide));
//ConfigHelper.Instance.IsInitApplicationSuccessful = true;
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("PowerPoint.Application"); pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("PowerPoint.Application");
@ -879,6 +902,12 @@ namespace Ink_Canvas
// 在阅读模式下出现异常时,通过下面的方式来获得当前选中的幻灯片对象 // 在阅读模式下出现异常时,通过下面的方式来获得当前选中的幻灯片对象
slide = pptApplication.SlideShowWindows[1].View.Slide; slide = pptApplication.SlideShowWindows[1].View.Slide;
} }
//如果检测到已经开始放映,则立即进入画板模式
if (pptApplication.SlideShowWindows.Count >= 1)
{
PptApplication_SlideShowBegin(pptApplication.SlideShowWindows[1]);
}
} }
if (pptApplication == null) throw new Exception(); if (pptApplication == null) throw new Exception();
@ -1730,6 +1759,8 @@ namespace Ink_Canvas
// Find center of element and then transform to get current location of center // Find center of element and then transform to get current location of center
FrameworkElement fe = e.Source as FrameworkElement; FrameworkElement fe = e.Source as FrameworkElement;
Point center = new Point(fe.ActualWidth / 2, fe.ActualHeight / 2); Point center = new Point(fe.ActualWidth / 2, fe.ActualHeight / 2);
center = new Point(inkCanvas.GetSelectionBounds().Left + inkCanvas.GetSelectionBounds().Width / 2,
inkCanvas.GetSelectionBounds().Top + inkCanvas.GetSelectionBounds().Height / 2);
center = m.Transform(center); // 转换为矩阵缩放和旋转的中心点 center = m.Transform(center); // 转换为矩阵缩放和旋转的中心点
// Update matrix to reflect translation/rotation // Update matrix to reflect translation/rotation
@ -1745,9 +1776,13 @@ namespace Ink_Canvas
{ {
stroke.Transform(m, false); stroke.Transform(m, false);
try
{
stroke.DrawingAttributes.Width *= md.Scale.X; stroke.DrawingAttributes.Width *= md.Scale.X;
stroke.DrawingAttributes.Height *= md.Scale.Y; stroke.DrawingAttributes.Height *= md.Scale.Y;
} }
catch { }
}
} }
} }

View File

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")] [assembly: AssemblyVersion("2.1.2.0")]
[assembly: AssemblyFileVersion("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.2.0")]