[merge] 合併了RenderTransform的一些更改到master分支來並淺淺優化了設置UI
This commit is contained in:
parent
3ae400d111
commit
a5670a99bd
@ -50,6 +50,8 @@ namespace Ink_Canvas.Helpers
|
||||
To = 1,
|
||||
Duration = TimeSpan.FromSeconds(duration)
|
||||
};
|
||||
fadeInAnimation.EasingFunction = new CubicEase();
|
||||
|
||||
Storyboard.SetTargetProperty(fadeInAnimation, new PropertyPath(UIElement.OpacityProperty));
|
||||
|
||||
// 滑动动画
|
||||
@ -61,6 +63,8 @@ namespace Ink_Canvas.Helpers
|
||||
};
|
||||
Storyboard.SetTargetProperty(slideAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
|
||||
|
||||
slideAnimation.EasingFunction = new CubicEase();
|
||||
|
||||
sb.Children.Add(fadeInAnimation);
|
||||
sb.Children.Add(slideAnimation);
|
||||
|
||||
@ -212,6 +216,7 @@ namespace Ink_Canvas.Helpers
|
||||
To = 0,
|
||||
Duration = TimeSpan.FromSeconds(duration)
|
||||
};
|
||||
fadeOutAnimation.EasingFunction = new CubicEase();
|
||||
Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(UIElement.OpacityProperty));
|
||||
|
||||
// 滑动动画
|
||||
@ -221,6 +226,8 @@ namespace Ink_Canvas.Helpers
|
||||
To = element.RenderTransform.Value.OffsetY + 10, // 滑动距离
|
||||
Duration = TimeSpan.FromSeconds(duration)
|
||||
};
|
||||
slideAnimation.EasingFunction = new CubicEase();
|
||||
|
||||
Storyboard.SetTargetProperty(slideAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
|
||||
|
||||
sb.Children.Add(fadeOutAnimation);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,12 +13,15 @@ using MessageBox = System.Windows.MessageBox;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
||||
#region Window Initialization
|
||||
|
||||
public MainWindow() {
|
||||
public MainWindow()
|
||||
{
|
||||
/*
|
||||
处于画板模式内:Topmost == false / currentMode != 0
|
||||
处于 PPT 放映内:BtnPPTSlideShowEnd.Visibility
|
||||
@ -32,7 +35,7 @@ namespace Ink_Canvas {
|
||||
BorderSettings.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
BorderSettings.Margin = new Thickness(0, 150, 0, 150);
|
||||
BorderSettings.Margin = new Thickness(0, 0, 0, 0);
|
||||
TwoFingerGestureBorder.Visibility = Visibility.Collapsed;
|
||||
BoardTwoFingerGestureBorder.Visibility = Visibility.Collapsed;
|
||||
BorderDrawShape.Visibility = Visibility.Collapsed;
|
||||
@ -44,27 +47,38 @@ namespace Ink_Canvas {
|
||||
ViewBoxStackPanelMain.Visibility = Visibility.Collapsed;
|
||||
ViewBoxStackPanelShapes.Visibility = Visibility.Collapsed;
|
||||
ViewboxFloatingBar.Margin = new Thickness((SystemParameters.WorkArea.Width - 284) / 2, SystemParameters.WorkArea.Height - 60, -2000, -200);
|
||||
ViewboxFloatingBarMarginAnimation(100,true);
|
||||
ViewboxFloatingBarMarginAnimation(100, true);
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
if (File.Exists("debug.ini")) Label.Visibility = Visibility.Visible;
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
try {
|
||||
if (File.Exists("Log.txt")) {
|
||||
try
|
||||
{
|
||||
if (File.Exists("Log.txt"))
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo("Log.txt");
|
||||
long fileSizeInKB = fileInfo.Length / 1024;
|
||||
if (fileSizeInKB > 512) {
|
||||
try {
|
||||
if (fileSizeInKB > 512)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete("Log.txt");
|
||||
LogHelper.WriteLogToFile("The Log.txt file has been successfully deleted. Original file size: " + fileSizeInKB + " KB", LogHelper.LogType.Info);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex + " | Can not delete the Log.txt file. File size: " + fileSizeInKB + " KB", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
|
||||
@ -74,9 +88,12 @@ namespace Ink_Canvas {
|
||||
inkCanvas.Strokes.StrokesChanged += StrokesOnStrokesChanged;
|
||||
|
||||
Microsoft.Win32.SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
try {
|
||||
try
|
||||
{
|
||||
if (File.Exists("SpecialVersion.ini")) SpecialVersionResetToSuggestion_Click();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
|
||||
@ -87,11 +104,12 @@ namespace Ink_Canvas {
|
||||
#endregion
|
||||
|
||||
#region Ink Canvas Functions
|
||||
|
||||
|
||||
Color Ink_DefaultColor = Colors.Red;
|
||||
|
||||
DrawingAttributes drawingAttributes;
|
||||
private void loadPenCanvas() {
|
||||
private void loadPenCanvas()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@ -108,37 +126,52 @@ namespace Ink_Canvas {
|
||||
|
||||
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
|
||||
inkCanvas.Gesture += InkCanvas_Gesture;
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
//ApplicationGesture lastApplicationGesture = ApplicationGesture.AllGestures;
|
||||
DateTime lastGestureTime = DateTime.Now;
|
||||
private void InkCanvas_Gesture(object sender, InkCanvasGestureEventArgs e) {
|
||||
private void InkCanvas_Gesture(object sender, InkCanvasGestureEventArgs e)
|
||||
{
|
||||
ReadOnlyCollection<GestureRecognitionResult> gestures = e.GetGestureRecognitionResults();
|
||||
try {
|
||||
foreach (GestureRecognitionResult gest in gestures) {
|
||||
try
|
||||
{
|
||||
foreach (GestureRecognitionResult gest in gestures)
|
||||
{
|
||||
//Trace.WriteLine(string.Format("Gesture: {0}, Confidence: {1}", gest.ApplicationGesture, gest.RecognitionConfidence));
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
if (gest.ApplicationGesture == ApplicationGesture.Left) {
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible)
|
||||
{
|
||||
if (gest.ApplicationGesture == ApplicationGesture.Left)
|
||||
{
|
||||
BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
|
||||
}
|
||||
if (gest.ApplicationGesture == ApplicationGesture.Right) {
|
||||
if (gest.ApplicationGesture == ApplicationGesture.Right)
|
||||
{
|
||||
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e) {
|
||||
private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var inkCanvas1 = sender as InkCanvas;
|
||||
if (inkCanvas1 == null) return;
|
||||
if (Settings.Canvas.IsShowCursor) {
|
||||
if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0) {
|
||||
if (Settings.Canvas.IsShowCursor)
|
||||
{
|
||||
if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0)
|
||||
{
|
||||
inkCanvas1.ForceCursor = true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
inkCanvas1.ForceCursor = false;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
inkCanvas1.ForceCursor = false;
|
||||
}
|
||||
if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink) forcePointEraser = !forcePointEraser;
|
||||
@ -152,12 +185,14 @@ namespace Ink_Canvas {
|
||||
public static string settingsFileName = "Settings.json";
|
||||
bool isLoaded = false;
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
loadPenCanvas();
|
||||
//加载设置
|
||||
LoadSettings(true);
|
||||
// HasNewUpdateWindow hasNewUpdateWindow = new HasNewUpdateWindow();
|
||||
if (Environment.Is64BitProcess) {
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
GroupBoxInkRecognition.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
@ -169,44 +204,60 @@ namespace Ink_Canvas {
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
LogHelper.WriteLogToFile("Ink Canvas closing", LogHelper.LogType.Event);
|
||||
if (!CloseIsFromButton && Settings.Advanced.IsSecondConfimeWhenShutdownApp) {
|
||||
if (!CloseIsFromButton && Settings.Advanced.IsSecondConfimeWhenShutdownApp)
|
||||
{
|
||||
e.Cancel = true;
|
||||
if (MessageBox.Show("是否继续关闭 InkCanvasForClass,这将丢失当前未保存的墨迹。", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) {
|
||||
if (MessageBox.Show("真的狠心关闭 InkCanvasForClass吗?", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.OK) {
|
||||
if (MessageBox.Show("是否取消关闭 InkCanvasForClass?", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Error) != MessageBoxResult.OK) {
|
||||
if (MessageBox.Show("是否继续关闭 InkCanvasForClass,这将丢失当前未保存的墨迹。", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
|
||||
{
|
||||
if (MessageBox.Show("真的狠心关闭 InkCanvasForClass吗?", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.OK)
|
||||
{
|
||||
if (MessageBox.Show("是否取消关闭 InkCanvasForClass?", "InkCanvasForClass", MessageBoxButton.OKCancel, MessageBoxImage.Error) != MessageBoxResult.OK)
|
||||
{
|
||||
e.Cancel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.Cancel) {
|
||||
if (e.Cancel)
|
||||
{
|
||||
LogHelper.WriteLogToFile("Ink Canvas closing cancelled", LogHelper.LogType.Event);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e) {
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
LogHelper.WriteLogToFile("Ink Canvas closed", LogHelper.LogType.Event);
|
||||
}
|
||||
|
||||
private async void AutoUpdate() {
|
||||
private async void AutoUpdate()
|
||||
{
|
||||
AvailableLatestVersion = await AutoUpdateHelper.CheckForUpdates();
|
||||
|
||||
if (AvailableLatestVersion != null) {
|
||||
if (AvailableLatestVersion != null)
|
||||
{
|
||||
bool IsDownloadSuccessful = false;
|
||||
IsDownloadSuccessful = await AutoUpdateHelper.DownloadSetupFileAndSaveStatus(AvailableLatestVersion);
|
||||
|
||||
if (IsDownloadSuccessful) {
|
||||
if (!Settings.Startup.IsAutoUpdateWithSilence) {
|
||||
if (MessageBox.Show("InkCanvasForClass 新版本安装包已下载完成,是否立即更新?", "InkCanvasForClass New Version Available", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) {
|
||||
if (IsDownloadSuccessful)
|
||||
{
|
||||
if (!Settings.Startup.IsAutoUpdateWithSilence)
|
||||
{
|
||||
if (MessageBox.Show("InkCanvasForClass 新版本安装包已下载完成,是否立即更新?", "InkCanvasForClass New Version Available", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
AutoUpdateHelper.InstallNewVersionApp(AvailableLatestVersion, false);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
timerCheckAutoUpdateWithSilence.Start();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoUpdateHelper.DeleteUpdatesFolder();
|
||||
}
|
||||
}
|
||||
|
@ -7,15 +7,21 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
bool isFloatingBarFolded = false, isFloatingBarChangingHideMode = false;
|
||||
|
||||
private async void FoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
FloatingBarIcons_MouseUp_New(sender);
|
||||
if (sender == null) {
|
||||
private async void FoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// FloatingBarIcons_MouseUp_New(sender);
|
||||
if (sender == null)
|
||||
{
|
||||
foldFloatingBarByUser = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
foldFloatingBarByUser = true;
|
||||
}
|
||||
unfoldFloatingBarByUser = false;
|
||||
@ -26,8 +32,10 @@ namespace Ink_Canvas {
|
||||
isFloatingBarChangingHideMode = true;
|
||||
isFloatingBarFolded = true;
|
||||
if (currentMode != 0) ImageBlackboard_MouseUp(null, null);
|
||||
if (StackPanelCanvasControls.Visibility == Visibility.Visible) {
|
||||
if (foldFloatingBarByUser && inkCanvas.Strokes.Count > 2) {
|
||||
if (StackPanelCanvasControls.Visibility == Visibility.Visible)
|
||||
{
|
||||
if (foldFloatingBarByUser && inkCanvas.Strokes.Count > 2)
|
||||
{
|
||||
ShowNotification("正在清空墨迹并收纳至侧边栏,可进入批注模式后通过【撤销】功能来恢复原先墨迹。");
|
||||
}
|
||||
}
|
||||
@ -51,7 +59,7 @@ namespace Ink_Canvas {
|
||||
|
||||
private async void LeftUnFoldButtonDisplayQuickPanel_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (Settings.Appearance.IsShowQuickPanel==true)
|
||||
if (Settings.Appearance.IsShowQuickPanel == true)
|
||||
{
|
||||
HideRightQuickPanel();
|
||||
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Visible;
|
||||
@ -70,7 +78,8 @@ namespace Ink_Canvas {
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
LeftUnFoldButtonQuickPanel.Margin = new Thickness(-1, 0, 0, -150);
|
||||
});
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(sender, e);
|
||||
}
|
||||
@ -96,7 +105,8 @@ namespace Ink_Canvas {
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
RightUnFoldButtonQuickPanel.Margin = new Thickness(0, 0, -1, -150);
|
||||
});
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(sender, e);
|
||||
}
|
||||
@ -154,12 +164,19 @@ namespace Ink_Canvas {
|
||||
HideRightQuickPanel();
|
||||
}
|
||||
|
||||
private async void UnFoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
if (sender == null || StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
private async void UnFoldFloatingBar_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
if (sender == null || StackPanelPPTControls.Visibility == Visibility.Visible)
|
||||
{
|
||||
unfoldFloatingBarByUser = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
unfoldFloatingBarByUser = true;
|
||||
}
|
||||
foldFloatingBarByUser = false;
|
||||
@ -174,18 +191,24 @@ namespace Ink_Canvas {
|
||||
await Task.Delay(0);
|
||||
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
|
||||
if (Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel) {
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible)
|
||||
{
|
||||
if (Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel)
|
||||
{
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(BottomViewboxPPTSidesControl);
|
||||
}
|
||||
if (Settings.PowerPointSettings.IsShowSidePPTNavigationPanel) {
|
||||
if (Settings.PowerPointSettings.IsShowSidePPTNavigationPanel)
|
||||
{
|
||||
AnimationsHelper.ShowWithScaleFromLeft(LeftSidePanelForPPTNavigation);
|
||||
AnimationsHelper.ShowWithScaleFromRight(RightSidePanelForPPTNavigation);
|
||||
}
|
||||
}
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
|
||||
{
|
||||
ViewboxFloatingBarMarginAnimation(60);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewboxFloatingBarMarginAnimation(100, true);
|
||||
}
|
||||
SidePannelMarginAnimation(-50, !unfoldFloatingBarByUser);
|
||||
@ -199,17 +222,20 @@ namespace Ink_Canvas {
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
if (MarginFromEdge == -10) LeftSidePanel.Visibility = Visibility.Visible;
|
||||
|
||||
ThicknessAnimation LeftSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
Duration = isNoAnimation==true? TimeSpan.FromSeconds(0) : TimeSpan.FromSeconds(0.175),
|
||||
ThicknessAnimation LeftSidePanelmarginAnimation = new ThicknessAnimation
|
||||
{
|
||||
Duration = isNoAnimation == true ? TimeSpan.FromSeconds(0) : TimeSpan.FromSeconds(0.175),
|
||||
From = LeftSidePanel.Margin,
|
||||
To = new Thickness(MarginFromEdge, 0, 0, -150)
|
||||
};
|
||||
ThicknessAnimation RightSidePanelmarginAnimation = new ThicknessAnimation {
|
||||
LeftSidePanelmarginAnimation.EasingFunction = new CubicEase();
|
||||
ThicknessAnimation RightSidePanelmarginAnimation = new ThicknessAnimation
|
||||
{
|
||||
Duration = isNoAnimation == true ? TimeSpan.FromSeconds(0) : TimeSpan.FromSeconds(0.175),
|
||||
From = RightSidePanel.Margin,
|
||||
To = new Thickness(0, 0, MarginFromEdge, -150)
|
||||
};
|
||||
|
||||
RightSidePanelmarginAnimation.EasingFunction = new CubicEase();
|
||||
LeftSidePanel.BeginAnimation(FrameworkElement.MarginProperty, LeftSidePanelmarginAnimation);
|
||||
RightSidePanel.BeginAnimation(FrameworkElement.MarginProperty, RightSidePanelmarginAnimation);
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ namespace Ink_Canvas
|
||||
|
||||
double alpha = inkCanvas.DefaultDrawingAttributes.Color.A;
|
||||
|
||||
if (penType==0)
|
||||
if (penType == 0)
|
||||
{
|
||||
if (inkColor == 0)
|
||||
{ // Black
|
||||
@ -110,7 +110,8 @@ namespace Ink_Canvas
|
||||
else if (inkColor == 5)
|
||||
{ // White
|
||||
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 255, 255, 255);
|
||||
} else if (isUselightThemeColor)
|
||||
}
|
||||
else if (isUselightThemeColor)
|
||||
{
|
||||
if (inkColor == 1)
|
||||
{ // Red
|
||||
@ -172,11 +173,12 @@ namespace Ink_Canvas
|
||||
inkCanvas.DefaultDrawingAttributes.Color = Color.FromArgb((byte)alpha, 234, 88, 12);
|
||||
}
|
||||
}
|
||||
} else if (penType==1)
|
||||
}
|
||||
else if (penType == 1)
|
||||
{
|
||||
if (highlighterColor == 100)
|
||||
{ // Black
|
||||
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(0,0,0);
|
||||
inkCanvas.DefaultDrawingAttributes.Color = Color.FromRgb(0, 0, 0);
|
||||
}
|
||||
else if (highlighterColor == 101)
|
||||
{ // White
|
||||
@ -299,15 +301,15 @@ namespace Ink_Canvas
|
||||
BoardViewboxBtnColorPinkContent.Visibility = Visibility.Collapsed;
|
||||
|
||||
HighlighterPenViewboxBtnColorBlackContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorBlueContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorGreenContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorOrangeContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorPurpleContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorRedContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorTealContent.Visibility=Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorWhiteContent.Visibility= Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorYellowContent.Visibility=Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorZincContent.Visibility=Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorBlueContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorGreenContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorOrangeContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorPurpleContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorRedContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorTealContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorWhiteContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorYellowContent.Visibility = Visibility.Collapsed;
|
||||
HighlighterPenViewboxBtnColorZincContent.Visibility = Visibility.Collapsed;
|
||||
|
||||
switch (inkColor)
|
||||
{
|
||||
@ -380,25 +382,26 @@ namespace Ink_Canvas
|
||||
HighlighterPenViewboxBtnColorOrangeContent.Visibility = Visibility.Visible;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void CheckLastColor(int inkColor, bool isHighlighter = false)
|
||||
{
|
||||
if (isHighlighter==true)
|
||||
if (isHighlighter == true)
|
||||
{
|
||||
highlighterColor = inkColor;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentMode == 0) lastDesktopInkColor = inkColor;
|
||||
else lastBoardInkColor = inkColor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async void CheckPenTypeUIState()
|
||||
{
|
||||
if (penType==0)
|
||||
if (penType == 0)
|
||||
{
|
||||
DefaultPenPropsPanel.Visibility = Visibility.Visible;
|
||||
DefaultPenColorsPanel.Visibility = Visibility.Visible;
|
||||
@ -426,6 +429,7 @@ namespace Ink_Canvas
|
||||
From = PenPalette.Margin,
|
||||
To = new Thickness(-160, -200, -33, 32)
|
||||
};
|
||||
marginAnimation.EasingFunction = new CubicEase();
|
||||
PenPalette.BeginAnimation(FrameworkElement.MarginProperty, marginAnimation);
|
||||
});
|
||||
await Task.Delay(100);
|
||||
@ -433,7 +437,8 @@ namespace Ink_Canvas
|
||||
await Dispatcher.InvokeAsync(() => {
|
||||
PenPalette.Margin = new Thickness(-160, -200, -33, 32);
|
||||
});
|
||||
} else if (penType==1)
|
||||
}
|
||||
else if (penType == 1)
|
||||
{
|
||||
DefaultPenPropsPanel.Visibility = Visibility.Collapsed;
|
||||
DefaultPenColorsPanel.Visibility = Visibility.Collapsed;
|
||||
@ -461,6 +466,7 @@ namespace Ink_Canvas
|
||||
From = PenPalette.Margin,
|
||||
To = new Thickness(-160, -157, -33, 32)
|
||||
};
|
||||
marginAnimation.EasingFunction = new CubicEase();
|
||||
PenPalette.BeginAnimation(FrameworkElement.MarginProperty, marginAnimation);
|
||||
});
|
||||
await Task.Delay(100);
|
||||
@ -487,7 +493,7 @@ namespace Ink_Canvas
|
||||
penType = 1;
|
||||
CheckPenTypeUIState();
|
||||
CheckColorTheme();
|
||||
drawingAttributes.Width = Settings.Canvas.HighlighterWidth/2;
|
||||
drawingAttributes.Width = Settings.Canvas.HighlighterWidth / 2;
|
||||
drawingAttributes.Height = Settings.Canvas.HighlighterWidth;
|
||||
drawingAttributes.StylusTip = StylusTip.Rectangle;
|
||||
drawingAttributes.IsHighlighter = true;
|
||||
@ -558,7 +564,7 @@ namespace Ink_Canvas
|
||||
|
||||
private void BtnHighlighterColorBlack_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckLastColor(100,true);
|
||||
CheckLastColor(100, true);
|
||||
penType = 1;
|
||||
forceEraser = false;
|
||||
CheckPenTypeUIState();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,28 +18,6 @@ namespace Ink_Canvas {
|
||||
lastBorderMouseDownObject = sender;
|
||||
}
|
||||
|
||||
private void FloatingBarIcons_MouseDown_New(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
lastBorderMouseDownObject = sender;
|
||||
SimpleStackPanel ssp = sender as SimpleStackPanel;
|
||||
if (ssp!=null)
|
||||
{
|
||||
if ((ssp.Name == "Pen_Icon" && inkCanvas.EditingMode == InkCanvasEditingMode.Ink) || (ssp.Name == "Eraser_Icon" && inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint) || (ssp.Name == "EraserByStrokes_Icon" && inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke) || (ssp.Name == "SymbolIconSelect" && inkCanvas.EditingMode == InkCanvasEditingMode.Select))
|
||||
{
|
||||
ssp.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/check-box-background.png"))) { Opacity = 1 };
|
||||
}
|
||||
else if (ssp.Name == "SymbolIconDelete")
|
||||
{
|
||||
ssp.Background = new SolidColorBrush(Color.FromArgb(26, 153, 27, 27));
|
||||
}
|
||||
else
|
||||
{
|
||||
// ssp.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/pressdown-background.png"))) { Opacity = 1 };
|
||||
ssp.Background = new SolidColorBrush(Color.FromArgb(20, 0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isStrokeSelectionCloneOn = false;
|
||||
private void BorderStrokeSelectionClone_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (lastBorderMouseDownObject != sender) return;
|
||||
|
@ -16,7 +16,7 @@ namespace Ink_Canvas {
|
||||
#region Floating Bar Control
|
||||
|
||||
private void ImageDrawShape_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
FloatingBarIcons_MouseUp_New(sender);
|
||||
// FloatingBarIcons_MouseUp_New(sender);
|
||||
if (BorderDrawShape.Visibility == Visibility.Visible) {
|
||||
AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
|
||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);
|
||||
|
@ -9,67 +9,95 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
StrokeCollection newStrokes = new StrokeCollection();
|
||||
List<Circle> circles = new List<Circle>();
|
||||
|
||||
//此函数中的所有代码版权所有 WXRIW,在其他项目中使用前必须提前联系(wxriw@outlook.com),谢谢!
|
||||
private void inkCanvas_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e) {
|
||||
if (Settings.Canvas.FitToCurve==true)
|
||||
private void inkCanvas_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e)
|
||||
{
|
||||
if (Settings.Canvas.FitToCurve == true)
|
||||
{
|
||||
drawingAttributes.FitToCurve = false;
|
||||
}
|
||||
try {
|
||||
|
||||
try
|
||||
{
|
||||
inkCanvas.Opacity = 1;
|
||||
if (Settings.InkToShape.IsInkToShapeEnabled && !Environment.Is64BitProcess) {
|
||||
void InkToShapeProcess() {
|
||||
try {
|
||||
if (Settings.InkToShape.IsInkToShapeEnabled && !Environment.Is64BitProcess)
|
||||
{
|
||||
void InkToShapeProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
newStrokes.Add(e.Stroke);
|
||||
if (newStrokes.Count > 4) newStrokes.RemoveAt(0);
|
||||
for (int i = 0; i < newStrokes.Count; i++) {
|
||||
for (int i = 0; i < newStrokes.Count; i++)
|
||||
{
|
||||
if (!inkCanvas.Strokes.Contains(newStrokes[i])) newStrokes.RemoveAt(i--);
|
||||
}
|
||||
for (int i = 0; i < circles.Count; i++) {
|
||||
|
||||
for (int i = 0; i < circles.Count; i++)
|
||||
{
|
||||
if (!inkCanvas.Strokes.Contains(circles[i].Stroke)) circles.RemoveAt(i);
|
||||
}
|
||||
|
||||
var strokeReco = new StrokeCollection();
|
||||
var result = InkRecognizeHelper.RecognizeShape(newStrokes);
|
||||
for (int i = newStrokes.Count - 1; i >= 0; i--) {
|
||||
for (int i = newStrokes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
strokeReco.Add(newStrokes[i]);
|
||||
var newResult = InkRecognizeHelper.RecognizeShape(strokeReco);
|
||||
if (newResult.InkDrawingNode.GetShapeName() == "Circle" || newResult.InkDrawingNode.GetShapeName() == "Ellipse") {
|
||||
if (newResult.InkDrawingNode.GetShapeName() == "Circle" ||
|
||||
newResult.InkDrawingNode.GetShapeName() == "Ellipse")
|
||||
{
|
||||
result = newResult;
|
||||
break;
|
||||
}
|
||||
//Label.Visibility = Visibility.Visible;
|
||||
//Label.Content = circles.Count.ToString() + "\n" + newResult.InkDrawingNode.GetShapeName();
|
||||
}
|
||||
if (result.InkDrawingNode.GetShapeName() == "Circle" && Settings.InkToShape.IsInkToShapeRounded == true) {
|
||||
|
||||
if (result.InkDrawingNode.GetShapeName() == "Circle" &&
|
||||
Settings.InkToShape.IsInkToShapeRounded == true)
|
||||
{
|
||||
var shape = result.InkDrawingNode.GetShape();
|
||||
if (shape.Width > 75) {
|
||||
foreach (Circle circle in circles) {
|
||||
if (shape.Width > 75)
|
||||
{
|
||||
foreach (Circle circle in circles)
|
||||
{
|
||||
//判断是否画同心圆
|
||||
if (Math.Abs(result.Centroid.X - circle.Centroid.X) / shape.Width < 0.12 &&
|
||||
Math.Abs(result.Centroid.Y - circle.Centroid.Y) / shape.Width < 0.12) {
|
||||
Math.Abs(result.Centroid.Y - circle.Centroid.Y) / shape.Width < 0.12)
|
||||
{
|
||||
result.Centroid = circle.Centroid;
|
||||
break;
|
||||
} else {
|
||||
double d = (result.Centroid.X - circle.Centroid.X) * (result.Centroid.X - circle.Centroid.X) +
|
||||
(result.Centroid.Y - circle.Centroid.Y) * (result.Centroid.Y - circle.Centroid.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
double d = (result.Centroid.X - circle.Centroid.X) *
|
||||
(result.Centroid.X - circle.Centroid.X) +
|
||||
(result.Centroid.Y - circle.Centroid.Y) *
|
||||
(result.Centroid.Y - circle.Centroid.Y);
|
||||
d = Math.Sqrt(d);
|
||||
//判断是否画外切圆
|
||||
double x = shape.Width / 2.0 + circle.R - d;
|
||||
if (Math.Abs(x) / shape.Width < 0.1) {
|
||||
if (Math.Abs(x) / shape.Width < 0.1)
|
||||
{
|
||||
double sinTheta = (result.Centroid.Y - circle.Centroid.Y) / d;
|
||||
double cosTheta = (result.Centroid.X - circle.Centroid.X) / d;
|
||||
double newX = result.Centroid.X + x * cosTheta;
|
||||
double newY = result.Centroid.Y + x * sinTheta;
|
||||
result.Centroid = new Point(newX, newY);
|
||||
}
|
||||
|
||||
//判断是否画外切圆
|
||||
x = Math.Abs(circle.R - shape.Width / 2.0) - d;
|
||||
if (Math.Abs(x) / shape.Width < 0.1) {
|
||||
if (Math.Abs(x) / shape.Width < 0.1)
|
||||
{
|
||||
double sinTheta = (result.Centroid.Y - circle.Centroid.Y) / d;
|
||||
double cosTheta = (result.Centroid.X - circle.Centroid.X) / d;
|
||||
double newX = result.Centroid.X + x * cosTheta;
|
||||
@ -79,11 +107,14 @@ namespace Ink_Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
Point iniP = new Point(result.Centroid.X - shape.Width / 2, result.Centroid.Y - shape.Height / 2);
|
||||
Point endP = new Point(result.Centroid.X + shape.Width / 2, result.Centroid.Y + shape.Height / 2);
|
||||
Point iniP = new Point(result.Centroid.X - shape.Width / 2,
|
||||
result.Centroid.Y - shape.Height / 2);
|
||||
Point endP = new Point(result.Centroid.X + shape.Width / 2,
|
||||
result.Centroid.Y + shape.Height / 2);
|
||||
var pointList = GenerateEllipseGeometry(iniP, endP);
|
||||
var point = new StylusPointCollection(pointList);
|
||||
var stroke = new Stroke(point) {
|
||||
var stroke = new Stroke(point)
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
circles.Add(new Circle(result.Centroid, shape.Width / 2.0, stroke));
|
||||
@ -94,7 +125,10 @@ namespace Ink_Canvas {
|
||||
_currentCommitType = CommitReason.UserInput;
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
} else if (result.InkDrawingNode.GetShapeName().Contains("Ellipse") && Settings.InkToShape.IsInkToShapeRounded == true) {
|
||||
}
|
||||
else if (result.InkDrawingNode.GetShapeName().Contains("Ellipse") &&
|
||||
Settings.InkToShape.IsInkToShapeRounded == true)
|
||||
{
|
||||
var shape = result.InkDrawingNode.GetShape();
|
||||
//var shape1 = result.InkDrawingNode.GetShape();
|
||||
//shape1.Fill = Brushes.Gray;
|
||||
@ -102,7 +136,8 @@ namespace Ink_Canvas {
|
||||
var p = result.InkDrawingNode.HotPoints;
|
||||
double a = GetDistance(p[0], p[2]) / 2; //长半轴
|
||||
double b = GetDistance(p[1], p[3]) / 2; //短半轴
|
||||
if (a < b) {
|
||||
if (a < b)
|
||||
{
|
||||
double t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
@ -111,38 +146,55 @@ namespace Ink_Canvas {
|
||||
result.Centroid = new Point((p[0].X + p[2].X) / 2, (p[0].Y + p[2].Y) / 2);
|
||||
bool needRotation = true;
|
||||
|
||||
if (shape.Width > 75 || shape.Height > 75 && p.Count == 4) {
|
||||
Point iniP = new Point(result.Centroid.X - shape.Width / 2, result.Centroid.Y - shape.Height / 2);
|
||||
Point endP = new Point(result.Centroid.X + shape.Width / 2, result.Centroid.Y + shape.Height / 2);
|
||||
if (shape.Width > 75 || shape.Height > 75 && p.Count == 4)
|
||||
{
|
||||
Point iniP = new Point(result.Centroid.X - shape.Width / 2,
|
||||
result.Centroid.Y - shape.Height / 2);
|
||||
Point endP = new Point(result.Centroid.X + shape.Width / 2,
|
||||
result.Centroid.Y + shape.Height / 2);
|
||||
|
||||
foreach (Circle circle in circles) {
|
||||
foreach (Circle circle in circles)
|
||||
{
|
||||
//判断是否画同心椭圆
|
||||
if (Math.Abs(result.Centroid.X - circle.Centroid.X) / a < 0.2 &&
|
||||
Math.Abs(result.Centroid.Y - circle.Centroid.Y) / a < 0.2) {
|
||||
Math.Abs(result.Centroid.Y - circle.Centroid.Y) / a < 0.2)
|
||||
{
|
||||
result.Centroid = circle.Centroid;
|
||||
iniP = new Point(result.Centroid.X - shape.Width / 2, result.Centroid.Y - shape.Height / 2);
|
||||
endP = new Point(result.Centroid.X + shape.Width / 2, result.Centroid.Y + shape.Height / 2);
|
||||
iniP = new Point(result.Centroid.X - shape.Width / 2,
|
||||
result.Centroid.Y - shape.Height / 2);
|
||||
endP = new Point(result.Centroid.X + shape.Width / 2,
|
||||
result.Centroid.Y + shape.Height / 2);
|
||||
|
||||
//再判断是否与圆相切
|
||||
if (Math.Abs(a - circle.R) / a < 0.2) {
|
||||
if (shape.Width >= shape.Height) {
|
||||
if (Math.Abs(a - circle.R) / a < 0.2)
|
||||
{
|
||||
if (shape.Width >= shape.Height)
|
||||
{
|
||||
iniP.X = result.Centroid.X - circle.R;
|
||||
endP.X = result.Centroid.X + circle.R;
|
||||
iniP.Y = result.Centroid.Y - b;
|
||||
endP.Y = result.Centroid.Y + b;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
iniP.Y = result.Centroid.Y - circle.R;
|
||||
endP.Y = result.Centroid.Y + circle.R;
|
||||
iniP.X = result.Centroid.X - a;
|
||||
endP.X = result.Centroid.X + a;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
} else if (Math.Abs(result.Centroid.X - circle.Centroid.X) / a < 0.2) {
|
||||
double sinTheta = Math.Abs(circle.Centroid.Y - result.Centroid.Y) / circle.R;
|
||||
}
|
||||
else if (Math.Abs(result.Centroid.X - circle.Centroid.X) / a < 0.2)
|
||||
{
|
||||
double sinTheta = Math.Abs(circle.Centroid.Y - result.Centroid.Y) /
|
||||
circle.R;
|
||||
double cosTheta = Math.Sqrt(1 - sinTheta * sinTheta);
|
||||
double newA = circle.R * cosTheta;
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 && Math.Abs(newA - a) / newA < 0.3) {
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 &&
|
||||
Math.Abs(newA - a) / newA < 0.3)
|
||||
{
|
||||
iniP.X = circle.Centroid.X - newA;
|
||||
endP.X = circle.Centroid.X + newA;
|
||||
iniP.Y = result.Centroid.Y - newA / 5;
|
||||
@ -157,10 +209,12 @@ namespace Ink_Canvas {
|
||||
|
||||
var _pointList = GenerateEllipseGeometry(iniP, endP, false, true);
|
||||
var _point = new StylusPointCollection(_pointList);
|
||||
var _stroke = new Stroke(_point) {
|
||||
var _stroke = new Stroke(_point)
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
var _dashedLineStroke = GenerateDashedLineEllipseStrokeCollection(iniP, endP, true, false);
|
||||
var _dashedLineStroke =
|
||||
GenerateDashedLineEllipseStrokeCollection(iniP, endP, true, false);
|
||||
StrokeCollection strokes = new StrokeCollection()
|
||||
{
|
||||
_stroke,
|
||||
@ -170,11 +224,16 @@ namespace Ink_Canvas {
|
||||
_currentCommitType = CommitReason.UserInput;
|
||||
return;
|
||||
}
|
||||
} else if (Math.Abs(result.Centroid.Y - circle.Centroid.Y) / a < 0.2) {
|
||||
double cosTheta = Math.Abs(circle.Centroid.X - result.Centroid.X) / circle.R;
|
||||
}
|
||||
else if (Math.Abs(result.Centroid.Y - circle.Centroid.Y) / a < 0.2)
|
||||
{
|
||||
double cosTheta = Math.Abs(circle.Centroid.X - result.Centroid.X) /
|
||||
circle.R;
|
||||
double sinTheta = Math.Sqrt(1 - cosTheta * cosTheta);
|
||||
double newA = circle.R * sinTheta;
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 && Math.Abs(newA - a) / newA < 0.3) {
|
||||
if (circle.R * sinTheta / circle.R < 0.9 && a / b > 2 &&
|
||||
Math.Abs(newA - a) / newA < 0.3)
|
||||
{
|
||||
iniP.X = result.Centroid.X - newA / 5;
|
||||
endP.X = result.Centroid.X + newA / 5;
|
||||
iniP.Y = circle.Centroid.Y - newA;
|
||||
@ -194,11 +253,13 @@ namespace Ink_Canvas {
|
||||
|
||||
var pointList = GenerateEllipseGeometry(iniP, endP);
|
||||
var point = new StylusPointCollection(pointList);
|
||||
var stroke = new Stroke(point) {
|
||||
var stroke = new Stroke(point)
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
|
||||
if (needRotation) {
|
||||
if (needRotation)
|
||||
{
|
||||
Matrix m = new Matrix();
|
||||
FrameworkElement fe = e.Source as FrameworkElement;
|
||||
double tanTheta = (p[2].Y - p[0].Y) / (p[2].X - p[0].X);
|
||||
@ -215,11 +276,17 @@ namespace Ink_Canvas {
|
||||
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
} else if (result.InkDrawingNode.GetShapeName().Contains("Triangle") && Settings.InkToShape.IsInkToShapeTriangle==true) {
|
||||
}
|
||||
else if (result.InkDrawingNode.GetShapeName().Contains("Triangle") &&
|
||||
Settings.InkToShape.IsInkToShapeTriangle == true)
|
||||
{
|
||||
var shape = result.InkDrawingNode.GetShape();
|
||||
var p = result.InkDrawingNode.HotPoints;
|
||||
if ((Math.Max(Math.Max(p[0].X, p[1].X), p[2].X) - Math.Min(Math.Min(p[0].X, p[1].X), p[2].X) >= 100 ||
|
||||
Math.Max(Math.Max(p[0].Y, p[1].Y), p[2].Y) - Math.Min(Math.Min(p[0].Y, p[1].Y), p[2].Y) >= 100) && result.InkDrawingNode.HotPoints.Count == 3)
|
||||
if ((Math.Max(Math.Max(p[0].X, p[1].X), p[2].X) -
|
||||
Math.Min(Math.Min(p[0].X, p[1].X), p[2].X) >= 100 ||
|
||||
Math.Max(Math.Max(p[0].Y, p[1].Y), p[2].Y) -
|
||||
Math.Min(Math.Min(p[0].Y, p[1].Y), p[2].Y) >= 100) &&
|
||||
result.InkDrawingNode.HotPoints.Count == 3)
|
||||
{
|
||||
//纠正垂直与水平关系
|
||||
var newPoints = FixPointsDirection(p[0], p[1]);
|
||||
@ -247,14 +314,21 @@ namespace Ink_Canvas {
|
||||
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
} else if ((result.InkDrawingNode.GetShapeName().Contains("Rectangle") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Diamond") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Parallelogram") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Square")) && Settings.InkToShape.IsInkToShapeRectangle == true) {
|
||||
}
|
||||
else if ((result.InkDrawingNode.GetShapeName().Contains("Rectangle") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Diamond") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Parallelogram") ||
|
||||
result.InkDrawingNode.GetShapeName().Contains("Square")) &&
|
||||
Settings.InkToShape.IsInkToShapeRectangle == true)
|
||||
{
|
||||
var shape = result.InkDrawingNode.GetShape();
|
||||
var p = result.InkDrawingNode.HotPoints;
|
||||
if ((Math.Max(Math.Max(Math.Max(p[0].X, p[1].X), p[2].X), p[3].X) - Math.Min(Math.Min(Math.Min(p[0].X, p[1].X), p[2].X), p[3].X) >= 100 ||
|
||||
Math.Max(Math.Max(Math.Max(p[0].Y, p[1].Y), p[2].Y), p[3].Y) - Math.Min(Math.Min(Math.Min(p[0].Y, p[1].Y), p[2].Y), p[3].Y) >= 100) && result.InkDrawingNode.HotPoints.Count == 4) {
|
||||
if ((Math.Max(Math.Max(Math.Max(p[0].X, p[1].X), p[2].X), p[3].X) -
|
||||
Math.Min(Math.Min(Math.Min(p[0].X, p[1].X), p[2].X), p[3].X) >= 100 ||
|
||||
Math.Max(Math.Max(Math.Max(p[0].Y, p[1].Y), p[2].Y), p[3].Y) -
|
||||
Math.Min(Math.Min(Math.Min(p[0].Y, p[1].Y), p[2].Y), p[3].Y) >= 100) &&
|
||||
result.InkDrawingNode.HotPoints.Count == 4)
|
||||
{
|
||||
//纠正垂直与水平关系
|
||||
var newPoints = FixPointsDirection(p[0], p[1]);
|
||||
p[0] = newPoints[0];
|
||||
@ -272,7 +346,8 @@ namespace Ink_Canvas {
|
||||
var pointList = p.ToList();
|
||||
pointList.Add(p[0]);
|
||||
var point = new StylusPointCollection(pointList);
|
||||
var stroke = new Stroke(GenerateFakePressureRectangle(point)) {
|
||||
var stroke = new Stroke(GenerateFakePressureRectangle(point))
|
||||
{
|
||||
DrawingAttributes = inkCanvas.DefaultDrawingAttributes.Clone()
|
||||
};
|
||||
SetNewBackupOfStroke();
|
||||
@ -284,73 +359,102 @@ namespace Ink_Canvas {
|
||||
newStrokes = new StrokeCollection();
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
InkToShapeProcess();
|
||||
}
|
||||
|
||||
|
||||
foreach (StylusPoint stylusPoint in e.Stroke.StylusPoints) {
|
||||
foreach (StylusPoint stylusPoint in e.Stroke.StylusPoints)
|
||||
{
|
||||
//LogHelper.WriteLogToFile(stylusPoint.PressureFactor.ToString(), LogHelper.LogType.Info);
|
||||
// 检查是否是压感笔书写
|
||||
//if (stylusPoint.PressureFactor != 0.5 && stylusPoint.PressureFactor != 0)
|
||||
if ((stylusPoint.PressureFactor > 0.501 || stylusPoint.PressureFactor < 0.5) && stylusPoint.PressureFactor != 0) {
|
||||
if ((stylusPoint.PressureFactor > 0.501 || stylusPoint.PressureFactor < 0.5) &&
|
||||
stylusPoint.PressureFactor != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (e.Stroke.StylusPoints.Count > 3) {
|
||||
try
|
||||
{
|
||||
if (e.Stroke.StylusPoints.Count > 3)
|
||||
{
|
||||
Random random = new Random();
|
||||
double _speed = GetPointSpeed(e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint(), e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint(), e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint());
|
||||
double _speed = GetPointSpeed(
|
||||
e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint(),
|
||||
e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint(),
|
||||
e.Stroke.StylusPoints[random.Next(0, e.Stroke.StylusPoints.Count - 1)].ToPoint());
|
||||
|
||||
RandWindow.randSeed = (int)(_speed * 100000 * 1000);
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
switch (Settings.Canvas.InkStyle) {
|
||||
switch (Settings.Canvas.InkStyle)
|
||||
{
|
||||
case 1:
|
||||
if (penType == 0)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
StylusPointCollection stylusPoints = new StylusPointCollection();
|
||||
int n = e.Stroke.StylusPoints.Count - 1;
|
||||
string s = "";
|
||||
|
||||
for (int i = 0; i <= n; i++) {
|
||||
double speed = GetPointSpeed(e.Stroke.StylusPoints[Math.Max(i - 1, 0)].ToPoint(), e.Stroke.StylusPoints[i].ToPoint(), e.Stroke.StylusPoints[Math.Min(i + 1, n)].ToPoint());
|
||||
for (int i = 0; i <= n; i++)
|
||||
{
|
||||
double speed = GetPointSpeed(e.Stroke.StylusPoints[Math.Max(i - 1, 0)].ToPoint(),
|
||||
e.Stroke.StylusPoints[i].ToPoint(),
|
||||
e.Stroke.StylusPoints[Math.Min(i + 1, n)].ToPoint());
|
||||
s += speed.ToString() + "\t";
|
||||
StylusPoint point = new StylusPoint();
|
||||
if (speed >= 0.25) {
|
||||
if (speed >= 0.25)
|
||||
{
|
||||
point.PressureFactor = (float)(0.5 - 0.3 * (Math.Min(speed, 1.5) - 0.3) / 1.2);
|
||||
} else if (speed >= 0.05) {
|
||||
}
|
||||
else if (speed >= 0.05)
|
||||
{
|
||||
point.PressureFactor = (float)0.5;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
point.PressureFactor = (float)(0.5 + 0.4 * (0.05 - speed) / 0.05);
|
||||
}
|
||||
|
||||
point.X = e.Stroke.StylusPoints[i].X;
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
e.Stroke.StylusPoints = stylusPoints;
|
||||
} catch {
|
||||
|
||||
e.Stroke.StylusPoints = stylusPoints;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 0:
|
||||
if (penType==0)
|
||||
if (penType == 0)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
StylusPointCollection stylusPoints = new StylusPointCollection();
|
||||
int n = e.Stroke.StylusPoints.Count - 1;
|
||||
double pressure = 0.1;
|
||||
int x = 10;
|
||||
if (n == 1) return;
|
||||
if (n >= x) {
|
||||
for (int i = 0; i < n - x; i++) {
|
||||
if (n >= x)
|
||||
{
|
||||
for (int i = 0; i < n - x; i++)
|
||||
{
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)0.5;
|
||||
@ -358,7 +462,9 @@ namespace Ink_Canvas {
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
for (int i = n - x; i <= n; i++) {
|
||||
|
||||
for (int i = n - x; i <= n; i++)
|
||||
{
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)((0.5 - pressure) * (n - i) / x + pressure);
|
||||
@ -366,8 +472,11 @@ namespace Ink_Canvas {
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i <= n; i++) {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= n; i++)
|
||||
{
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)(0.4 * (n - i) / n + pressure);
|
||||
@ -376,100 +485,82 @@ namespace Ink_Canvas {
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
e.Stroke.StylusPoints = stylusPoints;
|
||||
} catch {
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3: //根据 mode == 0 改写,目前暂未完成
|
||||
try {
|
||||
StylusPointCollection stylusPoints = new StylusPointCollection();
|
||||
int n = e.Stroke.StylusPoints.Count - 1;
|
||||
double pressure = 0.1;
|
||||
int x = 8;
|
||||
if (lastTouchDownTime < lastTouchUpTime) {
|
||||
double k = (lastTouchUpTime - lastTouchDownTime) / (n + 1); // 每个点之间间隔 k 毫秒
|
||||
x = (int)(1000 / k); // 取 1000 ms 内的点
|
||||
}
|
||||
|
||||
if (n >= x) {
|
||||
for (int i = 0; i < n - x; i++) {
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)0.5;
|
||||
point.X = e.Stroke.StylusPoints[i].X;
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
for (int i = n - x; i <= n; i++) {
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)((0.5 - pressure) * (n - i) / x + pressure);
|
||||
point.X = e.Stroke.StylusPoints[i].X;
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i <= n; i++) {
|
||||
StylusPoint point = new StylusPoint();
|
||||
|
||||
point.PressureFactor = (float)(0.4 * (n - i) / n + pressure);
|
||||
point.X = e.Stroke.StylusPoints[i].X;
|
||||
point.Y = e.Stroke.StylusPoints[i].Y;
|
||||
stylusPoints.Add(point);
|
||||
}
|
||||
}
|
||||
e.Stroke.StylusPoints = stylusPoints;
|
||||
} catch {
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch { }
|
||||
if (Settings.Canvas.FitToCurve==true)
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (Settings.Canvas.FitToCurve == true)
|
||||
{
|
||||
drawingAttributes.FitToCurve = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNewBackupOfStroke() {
|
||||
private void SetNewBackupOfStroke()
|
||||
{
|
||||
lastTouchDownStrokeCollection = inkCanvas.Strokes.Clone();
|
||||
int whiteboardIndex = CurrentWhiteboardIndex;
|
||||
if (currentMode == 0) {
|
||||
if (currentMode == 0)
|
||||
{
|
||||
whiteboardIndex = 0;
|
||||
}
|
||||
|
||||
strokeCollections[whiteboardIndex] = lastTouchDownStrokeCollection;
|
||||
}
|
||||
|
||||
public double GetDistance(Point point1, Point point2) {
|
||||
return Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) + (point1.Y - point2.Y) * (point1.Y - point2.Y));
|
||||
public double GetDistance(Point point1, Point point2)
|
||||
{
|
||||
return Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) +
|
||||
(point1.Y - point2.Y) * (point1.Y - point2.Y));
|
||||
}
|
||||
|
||||
public double GetPointSpeed(Point point1, Point point2, Point point3) {
|
||||
return (Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) + (point1.Y - point2.Y) * (point1.Y - point2.Y))
|
||||
+ Math.Sqrt((point3.X - point2.X) * (point3.X - point2.X) + (point3.Y - point2.Y) * (point3.Y - point2.Y)))
|
||||
/ 20;
|
||||
public double GetPointSpeed(Point point1, Point point2, Point point3)
|
||||
{
|
||||
return (Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) +
|
||||
(point1.Y - point2.Y) * (point1.Y - point2.Y))
|
||||
+ Math.Sqrt((point3.X - point2.X) * (point3.X - point2.X) +
|
||||
(point3.Y - point2.Y) * (point3.Y - point2.Y)))
|
||||
/ 20;
|
||||
}
|
||||
|
||||
public Point[] FixPointsDirection(Point p1, Point p2) {
|
||||
if (Math.Abs(p1.X - p2.X) / Math.Abs(p1.Y - p2.Y) > 8) {
|
||||
public Point[] FixPointsDirection(Point p1, Point p2)
|
||||
{
|
||||
if (Math.Abs(p1.X - p2.X) / Math.Abs(p1.Y - p2.Y) > 8)
|
||||
{
|
||||
//水平
|
||||
double x = Math.Abs(p1.Y - p2.Y) / 2;
|
||||
if (p1.Y > p2.Y) {
|
||||
if (p1.Y > p2.Y)
|
||||
{
|
||||
p1.Y -= x;
|
||||
p2.Y += x;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
p1.Y += x;
|
||||
p2.Y -= x;
|
||||
}
|
||||
} else if (Math.Abs(p1.Y - p2.Y) / Math.Abs(p1.X - p2.X) > 8) {
|
||||
}
|
||||
else if (Math.Abs(p1.Y - p2.Y) / Math.Abs(p1.X - p2.X) > 8)
|
||||
{
|
||||
//垂直
|
||||
double x = Math.Abs(p1.X - p2.X) / 2;
|
||||
if (p1.X > p2.X) {
|
||||
if (p1.X > p2.X)
|
||||
{
|
||||
p1.X -= x;
|
||||
p2.X += x;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
p1.X += x;
|
||||
p2.X -= x;
|
||||
}
|
||||
@ -478,8 +569,9 @@ namespace Ink_Canvas {
|
||||
return new Point[2] { p1, p2 };
|
||||
}
|
||||
|
||||
public StylusPointCollection GenerateFakePressureTriangle(StylusPointCollection points) {
|
||||
if (Settings.InkToShape.IsInkToShapeNoFakePressureTriangle == true || penType==1)
|
||||
public StylusPointCollection GenerateFakePressureTriangle(StylusPointCollection points)
|
||||
{
|
||||
if (Settings.InkToShape.IsInkToShapeNoFakePressureTriangle == true || penType == 1)
|
||||
{
|
||||
var newPoint = new StylusPointCollection();
|
||||
newPoint.Add(new StylusPoint(points[0].X, points[0].Y));
|
||||
@ -495,7 +587,8 @@ namespace Ink_Canvas {
|
||||
newPoint.Add(new StylusPoint(cPoint.X, cPoint.Y));
|
||||
newPoint.Add(new StylusPoint(points[0].X, points[0].Y));
|
||||
return newPoint;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var newPoint = new StylusPointCollection();
|
||||
newPoint.Add(new StylusPoint(points[0].X, points[0].Y, (float)0.4));
|
||||
@ -514,10 +607,13 @@ namespace Ink_Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
public StylusPointCollection GenerateFakePressureRectangle(StylusPointCollection points) {
|
||||
if (Settings.InkToShape.IsInkToShapeNoFakePressureRectangle == true || penType == 1) {
|
||||
public StylusPointCollection GenerateFakePressureRectangle(StylusPointCollection points)
|
||||
{
|
||||
if (Settings.InkToShape.IsInkToShapeNoFakePressureRectangle == true || penType == 1)
|
||||
{
|
||||
return points;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var newPoint = new StylusPointCollection();
|
||||
newPoint.Add(new StylusPoint(points[0].X, points[0].Y, (float)0.4));
|
||||
@ -537,16 +633,17 @@ namespace Ink_Canvas {
|
||||
newPoint.Add(new StylusPoint(cPoint.X, cPoint.Y, (float)0.8));
|
||||
newPoint.Add(new StylusPoint(points[0].X, points[0].Y, (float)0.4));
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Point GetCenterPoint(Point point1, Point point2) {
|
||||
public Point GetCenterPoint(Point point1, Point point2)
|
||||
{
|
||||
return new Point((point1.X + point2.X) / 2, (point1.Y + point2.Y) / 2);
|
||||
}
|
||||
|
||||
public StylusPoint GetCenterPoint(StylusPoint point1, StylusPoint point2) {
|
||||
public StylusPoint GetCenterPoint(StylusPoint point1, StylusPoint point2)
|
||||
{
|
||||
return new StylusPoint((point1.X + point2.X) / 2, (point1.Y + point2.Y) / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,8 @@ using System.Timers;
|
||||
using System.Windows;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
|
||||
public class TimeViewModel : INotifyPropertyChanged
|
||||
{
|
||||
@ -48,7 +49,8 @@ namespace Ink_Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
Timer timerCheckPPT = new Timer();
|
||||
Timer timerKillProcess = new Timer();
|
||||
Timer timerCheckAutoFold = new Timer();
|
||||
@ -61,9 +63,10 @@ namespace Ink_Canvas {
|
||||
|
||||
private TimeViewModel nowTimeVM = new TimeViewModel();
|
||||
|
||||
private void InitTimers() {
|
||||
private void InitTimers()
|
||||
{
|
||||
timerCheckPPT.Elapsed += TimerCheckPPT_Elapsed;
|
||||
timerCheckPPT.Interval = 1000;
|
||||
timerCheckPPT.Interval = 500;
|
||||
timerKillProcess.Elapsed += TimerKillProcess_Elapsed;
|
||||
timerKillProcess.Interval = 5000;
|
||||
timerCheckAutoFold.Elapsed += timerCheckAutoFold_Elapsed;
|
||||
@ -82,7 +85,8 @@ namespace Ink_Canvas {
|
||||
nowTimeVM.nowTime = DateTime.Now.ToShortTimeString().ToString();
|
||||
}
|
||||
|
||||
private void TimerDisplayTime_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
|
||||
private void TimerDisplayTime_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
nowTimeVM.nowTime = DateTime.Now.ToShortTimeString().ToString();
|
||||
}
|
||||
|
||||
@ -91,47 +95,59 @@ namespace Ink_Canvas {
|
||||
nowTimeVM.nowDate = DateTime.Now.ToShortDateString().ToString();
|
||||
}
|
||||
|
||||
private void TimerKillProcess_Elapsed(object sender, ElapsedEventArgs e) {
|
||||
try {
|
||||
private void TimerKillProcess_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 希沃相关: easinote swenserver RemoteProcess EasiNote.MediaHttpService smartnote.cloud EasiUpdate smartnote EasiUpdate3 EasiUpdate3Protect SeewoP2P CefSharp.BrowserSubprocess SeewoUploadService
|
||||
string arg = "/F";
|
||||
if (Settings.Automation.IsAutoKillPptService) {
|
||||
if (Settings.Automation.IsAutoKillPptService)
|
||||
{
|
||||
Process[] processes = Process.GetProcessesByName("PPTService");
|
||||
if (processes.Length > 0) {
|
||||
if (processes.Length > 0)
|
||||
{
|
||||
arg += " /IM PPTService.exe";
|
||||
}
|
||||
processes = Process.GetProcessesByName("SeewoIwbAssistant");
|
||||
if (processes.Length > 0) {
|
||||
if (processes.Length > 0)
|
||||
{
|
||||
arg += " /IM SeewoIwbAssistant.exe" + " /IM Sia.Guard.exe";
|
||||
}
|
||||
}
|
||||
if (Settings.Automation.IsAutoKillEasiNote) {
|
||||
if (Settings.Automation.IsAutoKillEasiNote)
|
||||
{
|
||||
Process[] processes = Process.GetProcessesByName("EasiNote");
|
||||
if (processes.Length > 0) {
|
||||
if (processes.Length > 0)
|
||||
{
|
||||
arg += " /IM EasiNote.exe";
|
||||
}
|
||||
}
|
||||
if (arg != "/F") {
|
||||
if (arg != "/F")
|
||||
{
|
||||
Process p = new Process();
|
||||
p.StartInfo = new ProcessStartInfo("taskkill", arg);
|
||||
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
p.Start();
|
||||
|
||||
if (arg.Contains("EasiNote")) {
|
||||
if (arg.Contains("EasiNote"))
|
||||
{
|
||||
BtnSwitch_Click(BtnSwitch, null);
|
||||
MessageBox.Show("“希沃白板 5”已自动关闭");
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
bool foldFloatingBarByUser = false, // 保持收纳操作不受自动收纳的控制
|
||||
unfoldFloatingBarByUser = false; // 允许用户在希沃软件内进行展开操作
|
||||
|
||||
private void timerCheckAutoFold_Elapsed(object sender, ElapsedEventArgs e) {
|
||||
private void timerCheckAutoFold_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
try {
|
||||
try
|
||||
{
|
||||
string windowProcessName = ForegroundWindowInfo.ProcessName();
|
||||
string windowTitle = ForegroundWindowInfo.WindowTitle();
|
||||
//LogHelper.WriteLogToFile("windowTitle | " + windowTitle + " | windowProcessName | " + windowProcessName);
|
||||
@ -148,37 +164,54 @@ namespace Ink_Canvas {
|
||||
|| Settings.Automation.IsAutoFoldInMSWhiteboard && (windowProcessName == "MicrosoftWhiteboard" || windowProcessName == "msedgewebview2") // 微软白板
|
||||
|| Settings.Automation.IsAutoFoldInOldZyBoard && // 中原旧白板
|
||||
(WinTabWindowsChecker.IsWindowExisted("WhiteBoard - DrawingWindow")
|
||||
|| WinTabWindowsChecker.IsWindowExisted("InstantAnnotationWindow"))) {
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) {
|
||||
|| WinTabWindowsChecker.IsWindowExisted("InstantAnnotationWindow")))
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded)
|
||||
{
|
||||
FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
} else if (WinTabWindowsChecker.IsWindowExisted("幻灯片放映", false)) { // 处于幻灯片放映状态
|
||||
if (!Settings.Automation.IsAutoFoldInPPTSlideShow && isFloatingBarFolded && !foldFloatingBarByUser) {
|
||||
UnFoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
else if (WinTabWindowsChecker.IsWindowExisted("幻灯片放映", false))
|
||||
{ // 处于幻灯片放映状态
|
||||
if (!Settings.Automation.IsAutoFoldInPPTSlideShow && isFloatingBarFolded && !foldFloatingBarByUser)
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(new Object(), null);
|
||||
}
|
||||
} else {
|
||||
if (isFloatingBarFolded && !foldFloatingBarByUser) {
|
||||
UnFoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFloatingBarFolded && !foldFloatingBarByUser)
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(new Object(), null);
|
||||
}
|
||||
unfoldFloatingBarByUser = false;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void timerCheckAutoUpdateWithSilence_Elapsed(object sender, ElapsedEventArgs e) {
|
||||
private void timerCheckAutoUpdateWithSilence_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() => {
|
||||
try {
|
||||
try
|
||||
{
|
||||
if ((!Topmost) || (inkCanvas.Strokes.Count > 0)) return;
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
try {
|
||||
if (AutoUpdateWithSilenceTimeComboBox.CheckIsInSilencePeriod(Settings.Startup.AutoUpdateWithSilenceStartTime, Settings.Startup.AutoUpdateWithSilenceEndTime)) {
|
||||
try
|
||||
{
|
||||
if (AutoUpdateWithSilenceTimeComboBox.CheckIsInSilencePeriod(Settings.Startup.AutoUpdateWithSilenceStartTime, Settings.Startup.AutoUpdateWithSilenceEndTime))
|
||||
{
|
||||
AutoUpdateHelper.InstallNewVersionApp(AvailableLatestVersion, true);
|
||||
timerCheckAutoUpdateWithSilence.Stop();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
@ -49,5 +49,5 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("5.0.4.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.4.0")]
|
||||
[assembly: AssemblyVersion("5.0.5.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.5.0")]
|
Loading…
Reference in New Issue
Block a user