Skip to content

Commit 616e22f

Browse files
committed
交互逻辑
1 parent 5dbf3ac commit 616e22f

File tree

8 files changed

+41
-131
lines changed

8 files changed

+41
-131
lines changed

.vs/ShowWrite/v17/.futdcache.v2

0 Bytes
Binary file not shown.

.vs/ShowWrite/v17/.suo

0 Bytes
Binary file not shown.

.vs/ShowWrite/v17/DocumentLayout.backup.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
1818
"DocumentGroups": [
1919
{
2020
"DockedWidth": 200,
21-
"SelectedChildIndex": 2,
21+
"SelectedChildIndex": 1,
2222
"Children": [
2323
{
2424
"$type": "Bookmark",
2525
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
2626
},
27-
{
28-
"$type": "Bookmark",
29-
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
30-
},
3127
{
3228
"$type": "Document",
3329
"DocumentIndex": 0,
@@ -36,7 +32,7 @@
3632
"RelativeDocumentMoniker": "MainWindow.xaml.cs",
3733
"ToolTip": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml.cs",
3834
"RelativeToolTip": "MainWindow.xaml.cs",
39-
"ViewState": "AgIAAGkDAAAAAAAAAADgv4gDAAASAAAAAAAAAA==",
35+
"ViewState": "AgIAAHQNAAAAAAAAAAAiwJ8NAAABAAAAAAAAAA==",
4036
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
4137
"WhenOpened": "2026-01-17T13:58:01.776Z",
4238
"EditorCaption": ""
@@ -50,8 +46,11 @@
5046
"ToolTip": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml",
5147
"RelativeToolTip": "MainWindow.xaml",
5248
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
53-
"WhenOpened": "2026-01-23T12:32:08.08Z",
54-
"EditorCaption": ""
49+
"WhenOpened": "2026-01-23T12:32:08.08Z"
50+
},
51+
{
52+
"$type": "Bookmark",
53+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
5554
}
5655
]
5756
}

.vs/ShowWrite/v17/DocumentLayout.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"Version": 1,
33
"WorkspaceRootPath": "C:\\Users\\vum\\source\\repos\\ShowWrite\\",
44
"Documents": [
5-
{
6-
"AbsoluteMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|c:\\users\\vum\\source\\repos\\showwrite\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
7-
"RelativeMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|solutionrelative:mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
8-
},
95
{
106
"AbsoluteMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|c:\\users\\vum\\source\\repos\\showwrite\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
117
"RelativeMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|solutionrelative:mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
8+
},
9+
{
10+
"AbsoluteMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|c:\\users\\vum\\source\\repos\\showwrite\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
11+
"RelativeMoniker": "D:0:0:{1FEBD063-10B8-47FD-A2A6-B3F3270EB83C}|ShowWrite.csproj|solutionrelative:mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
1212
}
1313
],
1414
"DocumentGroupContainers": [
@@ -18,40 +18,39 @@
1818
"DocumentGroups": [
1919
{
2020
"DockedWidth": 200,
21-
"SelectedChildIndex": 3,
21+
"SelectedChildIndex": 1,
2222
"Children": [
2323
{
2424
"$type": "Bookmark",
2525
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
2626
},
27-
{
28-
"$type": "Bookmark",
29-
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
30-
},
3127
{
3228
"$type": "Document",
33-
"DocumentIndex": 1,
29+
"DocumentIndex": 0,
3430
"Title": "MainWindow.xaml.cs",
3531
"DocumentMoniker": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml.cs",
3632
"RelativeDocumentMoniker": "MainWindow.xaml.cs",
3733
"ToolTip": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml.cs",
3834
"RelativeToolTip": "MainWindow.xaml.cs",
39-
"ViewState": "AgIAAGkDAAAAAAAAAADgv4gDAAASAAAAAAAAAA==",
35+
"ViewState": "AgIAAA0BAAAAAAAAAADgvyEBAAANAAAAAAAAAA==",
4036
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
4137
"WhenOpened": "2026-01-17T13:58:01.776Z",
4238
"EditorCaption": ""
4339
},
4440
{
4541
"$type": "Document",
46-
"DocumentIndex": 0,
42+
"DocumentIndex": 1,
4743
"Title": "MainWindow.xaml",
4844
"DocumentMoniker": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml",
4945
"RelativeDocumentMoniker": "MainWindow.xaml",
5046
"ToolTip": "C:\\Users\\vum\\source\\repos\\ShowWrite\\MainWindow.xaml",
5147
"RelativeToolTip": "MainWindow.xaml",
5248
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
53-
"WhenOpened": "2026-01-23T12:32:08.08Z",
54-
"EditorCaption": ""
49+
"WhenOpened": "2026-01-23T12:32:08.08Z"
50+
},
51+
{
52+
"$type": "Bookmark",
53+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
5554
}
5655
]
5756
}

MainWindow.xaml.cs

Lines changed: 18 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
using WinBrush = System.Windows.Media.Brush;
3131
using Button = System.Windows.Controls.Button;
3232
using MessageBox = System.Windows.MessageBox;
33-
using Image = System.Drawing.Image;
34-
using Brushes = System.Drawing.Brushes;
33+
using SystemDrawingImage = System.Drawing.Image; // 重命名 System.Drawing.Image
34+
using SystemDrawingBrushes = System.Drawing.Brushes; // 重命名 System.Drawing.Brushes
35+
using WpfImage = System.Windows.Controls.Image;
36+
using Binding = System.Windows.Data.Binding; // 为 WPF Image 添加别名
3537

3638
namespace ShowWrite
3739
{
@@ -890,12 +892,12 @@ private DataTemplate CreatePhotoListItemTemplate()
890892
stackPanelFactory.SetValue(StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);
891893
stackPanelFactory.SetValue(StackPanel.MarginProperty, new Thickness(6));
892894

893-
// 创建缩略图
894-
var imageFactory = new FrameworkElementFactory(typeof(Image));
895-
imageFactory.SetValue(Image.WidthProperty, 70.0);
896-
imageFactory.SetValue(Image.HeightProperty, 52.0);
897-
imageFactory.SetBinding(Image.SourceProperty, new System.Windows.Data.Binding("Thumbnail"));
898-
imageFactory.SetValue(Image.StretchProperty, Stretch.UniformToFill);
895+
// 创建缩略图 - 使用 WpfImage 别名
896+
var imageFactory = new FrameworkElementFactory(typeof(WpfImage));
897+
imageFactory.SetValue(WpfImage.WidthProperty, 70.0);
898+
imageFactory.SetValue(WpfImage.HeightProperty, 52.0);
899+
imageFactory.SetBinding(WpfImage.SourceProperty, new System.Windows.Data.Binding("Thumbnail"));
900+
imageFactory.SetValue(WpfImage.StretchProperty, Stretch.UniformToFill);
899901

900902
// 创建右侧信息面板
901903
var infoPanelFactory = new FrameworkElementFactory(typeof(StackPanel));
@@ -904,30 +906,30 @@ private DataTemplate CreatePhotoListItemTemplate()
904906

905907
// 时间戳
906908
var timestampFactory = new FrameworkElementFactory(typeof(TextBlock));
907-
timestampFactory.SetValue(TextBlock.ForegroundProperty, Brushes.White);
909+
timestampFactory.SetValue(TextBlock.ForegroundProperty, System.Windows.Media.Brushes.White); // 使用 WPF Brushes
908910
timestampFactory.SetValue(TextBlock.FontWeightProperty, FontWeights.Bold);
909911
timestampFactory.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Timestamp"));
910912

911913
// 笔迹数
912914
var strokesFactory = new FrameworkElementFactory(typeof(TextBlock));
913-
strokesFactory.SetValue(TextBlock.ForegroundProperty, Brushes.LightGray);
915+
strokesFactory.SetValue(TextBlock.ForegroundProperty, System.Windows.Media.Brushes.LightGray); // 使用 WPF Brushes
914916
strokesFactory.SetValue(TextBlock.FontSizeProperty, 12.0);
915-
strokesFactory.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Strokes.Count")
917+
strokesFactory.SetBinding(TextBlock.TextProperty, new Binding("Strokes.Count")
916918
{
917919
StringFormat = "笔迹数: {0}"
918920
});
919921

920922
// 选中状态提示文字
921923
var selectedTipFactory = new FrameworkElementFactory(typeof(TextBlock));
922-
selectedTipFactory.SetValue(TextBlock.ForegroundProperty, Brushes.Yellow);
924+
selectedTipFactory.SetValue(TextBlock.ForegroundProperty, System.Windows.Media.Brushes.Yellow); // 使用 WPF Brushes
923925
selectedTipFactory.SetValue(TextBlock.FontSizeProperty, 11.0);
924926
selectedTipFactory.SetValue(TextBlock.FontWeightProperty, FontWeights.SemiBold);
925927
selectedTipFactory.SetValue(TextBlock.MarginProperty, new Thickness(0, 5, 0, 0));
926928

927929
// 使用多重绑定和值转换器来确定是否显示提示文字
928930
var multiBinding = new MultiBinding();
929-
multiBinding.Bindings.Add(new System.Windows.Data.Binding(".")); // 当前项
930-
multiBinding.Bindings.Add(new System.Windows.Data.Binding("CurrentPhoto") { Source = this });
931+
multiBinding.Bindings.Add(new Binding(".")); // 当前项
932+
multiBinding.Bindings.Add(new Binding("CurrentPhoto") { Source = this });
931933
multiBinding.Converter = new PhotoSelectedTipConverter();
932934

933935
selectedTipFactory.SetBinding(TextBlock.TextProperty, multiBinding);
@@ -945,32 +947,6 @@ private DataTemplate CreatePhotoListItemTemplate()
945947
return dataTemplate;
946948
}
947949

948-
/// <summary>
949-
/// 照片选择状态提示转换器
950-
/// </summary>
951-
public class PhotoSelectedTipConverter : IMultiValueConverter
952-
{
953-
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
954-
{
955-
if (values.Length >= 2)
956-
{
957-
var currentItem = values[0] as PhotoWithStrokes;
958-
var currentPhoto = values[1] as PhotoWithStrokes;
959-
960-
if (currentItem != null && currentPhoto != null && currentItem == currentPhoto)
961-
{
962-
return "再次点击返回直播";
963-
}
964-
}
965-
return string.Empty;
966-
}
967-
968-
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
969-
{
970-
throw new NotImplementedException();
971-
}
972-
}
973-
974950
/// <summary>
975951
/// 照片列表选择变更事件 - 修改版:支持点击已选中项返回直播
976952
/// </summary>
@@ -1072,7 +1048,7 @@ private void BackToLive_Click(object sender, RoutedEventArgs e)
10721048

10731049
#endregion
10741050

1075-
private void VideoArea_MouseMove(object sender, WinMouseEventArgs e)
1051+
private void VideoArea_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
10761052
{
10771053
if (_isPerspectiveCorrectionMode) return;
10781054
_panZoomManager.HandleMouseMove(e, _drawingManager.CurrentMode);
@@ -1133,70 +1109,6 @@ private void VideoArea_ManipulationDelta(object sender, ManipulationDeltaEventAr
11331109

11341110
#endregion
11351111

1136-
#region 照片悬浮窗定位方法
1137-
1138-
/// <summary>
1139-
/// 照片悬浮窗打开事件
1140-
/// </summary>
1141-
private void PhotoPopup_Opened(object sender, EventArgs e)
1142-
{
1143-
RepositionPhotoPopup();
1144-
}
1145-
1146-
/// <summary>
1147-
/// 重新定位照片悬浮窗到右下角
1148-
/// </summary>
1149-
private void RepositionPhotoPopup()
1150-
{
1151-
try
1152-
{
1153-
if (PhotoPopup == null || !PhotoPopup.IsOpen) return;
1154-
1155-
// 获取屏幕工作区尺寸
1156-
double screenWidth = SystemParameters.WorkArea.Width;
1157-
double screenHeight = SystemParameters.WorkArea.Height;
1158-
1159-
// 获取窗口位置和尺寸
1160-
double windowLeft = this.Left;
1161-
double windowTop = this.Top;
1162-
double windowWidth = this.ActualWidth;
1163-
double windowHeight = this.ActualHeight;
1164-
1165-
// 如果窗口是最大化的,使用窗口的尺寸而不是屏幕尺寸
1166-
if (this.WindowState == WindowState.Maximized)
1167-
{
1168-
windowLeft = 0;
1169-
windowTop = 0;
1170-
windowWidth = SystemParameters.PrimaryScreenWidth;
1171-
windowHeight = SystemParameters.PrimaryScreenHeight;
1172-
}
1173-
1174-
// Popup尺寸
1175-
double popupWidth = 400; // 与XAML中Border的Width一致
1176-
double popupHeight = 500; // 与XAML中Border的Height一致
1177-
1178-
// 计算右下角位置
1179-
double left = windowLeft + windowWidth - popupWidth - 10; // 右侧留10像素边距
1180-
double top = windowTop + windowHeight - popupHeight - 70 - 10; // 底部留10像素边距,减去70像素的工具栏高度
1181-
1182-
// 确保不会超出屏幕边界
1183-
if (top < 0) top = 10;
1184-
if (left < 0) left = 10;
1185-
1186-
// 设置Popup位置
1187-
PhotoPopup.HorizontalOffset = left;
1188-
PhotoPopup.VerticalOffset = top;
1189-
1190-
Logger.Debug("MainWindow", $"照片悬浮窗位置已更新: ({left}, {top})");
1191-
}
1192-
catch (Exception ex)
1193-
{
1194-
Logger.Error("MainWindow", $"重新定位照片悬浮窗失败: {ex.Message}", ex);
1195-
}
1196-
}
1197-
1198-
#endregion
1199-
12001112
#region 梯形校正功能模块
12011113

12021114
// ==================== 梯形校正核心功能 ====================
@@ -1683,7 +1595,7 @@ private void CorrectionCanvas_MouseDown(object sender, MouseButtonEventArgs e)
16831595
/// <summary>
16841596
/// 校正画布鼠标移动事件(修复版)
16851597
/// </summary>
1686-
private void CorrectionCanvas_MouseMove(object sender, WinMouseEventArgs e)
1598+
private void CorrectionCanvas_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
16871599
{
16881600
try
16891601
{

obj/Debug/net8.0-windows/ShowWrite.AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[assembly: System.Reflection.AssemblyCompanyAttribute("wwcrdrvf6u")]
1515
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
1616
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.1.5.0")]
17-
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.1.5+6a0f27c6e530b48a6fad51af847a3251b5ebcbb4")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.1.5+5dbf3acf0fcb8d491c0244a1fab5e50655bc777b")]
1818
[assembly: System.Reflection.AssemblyProductAttribute("ShowWrite")]
1919
[assembly: System.Reflection.AssemblyTitleAttribute("ShowWrite")]
2020
[assembly: System.Reflection.AssemblyVersionAttribute("2.1.5.0")]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
738ee7c41e77e067476c79b9a2a9180bf9e355749f2f449e6f8940b91a89e6eb
1+
97890b37c4518c6843457892e889ea4f841a0c8d2f271a545d033dbdd214b79b

obj/Debug/net8.0-windows/ShowWrite_MarkupCompile.i.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ C:\Users\vum\Source\Repos\ShowWrite\App.xaml
1616
218-1766099576
1717
AdjustVideoWindow.xaml;MainWindow.xaml;MW\SplashWindow.xaml;PenSettingsWindow.xaml;SettingsWindow.xaml;themes\DarkTheme.xaml;themes\LightTheme.xaml;
1818

19-
False
19+
True
2020

0 commit comments

Comments
 (0)