Revert "delete:视频展台"

This reverts commit 0683779e09.
This commit is contained in:
PrefacedCorg
2026-04-23 22:17:55 +08:00
parent b891cb6fe3
commit 532aa03c56
8 changed files with 1342 additions and 5 deletions
+78 -1
View File
@@ -73,7 +73,10 @@ namespace Ink_Canvas
// 全屏处理状态标志
public bool isFullScreenApplied = false;
private int _boothResolutionWidth = 1920;
private int _boothResolutionHeight = 1080;
public int BoothResolutionWidth => _boothResolutionWidth;
public int BoothResolutionHeight => _boothResolutionHeight;
private static Cursor _cachedPenCursor = null;
private static readonly object _cursorLock = new object();
@@ -1763,6 +1766,24 @@ namespace Ink_Canvas
{
SystemEvents.DisplaySettingsChanged -= SystemEventsOnDisplaySettingsChanged;
try
{
// 清理视频展台资源
if (_cameraService != null)
{
_cameraService.FrameReceived -= CameraService_FrameReceived;
_cameraService.ErrorOccurred -= CameraService_ErrorOccurred;
_cameraService.Dispose();
_cameraService = null;
}
lock (_videoPresenterFrameLock)
{
_lastFrame?.Dispose();
_lastFrame = null;
}
}
catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); }
// 释放PPT管理器资源
DisposePPTManagers();
@@ -2997,6 +3018,62 @@ namespace Ink_Canvas
}
#endregion
#region /
private const int BoothResolutionTabCount = 4;
private static readonly (int w, int h)[] BoothResolutionValues = { (1280, 720), (1920, 1080), (2560, 1440), (3840, 2160) };
private void BoothResolutionTab_Click(object sender, RoutedEventArgs e)
{
if (sender is Button btn && btn.Tag is string tag)
{
var parts = tag.Split(',');
if (parts.Length == 2 && int.TryParse(parts[0].Trim(), out int w) && int.TryParse(parts[1].Trim(), out int h) && w > 0 && h > 0)
{
_boothResolutionWidth = w;
_boothResolutionHeight = h;
UpdateBoothResolutionTabState();
SyncBoothResolutionToCameraService();
}
}
}
private void UpdateBoothResolutionTabState()
{
int index = 0;
for (int i = 0; i < BoothResolutionValues.Length; i++)
{
if (BoothResolutionValues[i].w == _boothResolutionWidth && BoothResolutionValues[i].h == _boothResolutionHeight)
{
index = i;
break;
}
}
if (BoothResolutionTabIndicator != null)
{
BoothResolutionTabIndicator.Margin = new Thickness(index * 70, 0, 0, 0);
}
var texts = new[] { BtnBoothResolution720?.Content as TextBlock, BtnBoothResolution1080?.Content as TextBlock, BtnBoothResolution2K?.Content as TextBlock, BtnBoothResolution4K?.Content as TextBlock };
for (int i = 0; i < texts.Length && i < 4; i++)
{
if (texts[i] == null) continue;
if (i == index)
{
texts[i].FontWeight = FontWeights.Bold;
texts[i].Foreground = new SolidColorBrush(Colors.White);
texts[i].Opacity = 1.0;
}
else
{
texts[i].FontWeight = FontWeights.SemiBold;
texts[i].SetResourceReference(TextBlock.ForegroundProperty, "FloatBarForeground");
texts[i].Opacity = 0.7;
}
}
}
#endregion
private void ToggleSwitchEnableInkToShape_Toggled(object sender, RoutedEventArgs e)
{