add:展台

This commit is contained in:
2026-02-19 18:18:47 +08:00
parent 9ef764ffa1
commit 432cc3825e
3 changed files with 61 additions and 21 deletions
+15 -16
View File
@@ -4964,24 +4964,23 @@
</Border>
<Border Width="60" Height="50"
BorderThickness="1" BorderBrush="{DynamicResource BoardFloatBarBorderBrush}"
MouseUp="BtnWhiteBoardAdd_Click" CornerRadius="5" Background="{DynamicResource BoardFloatBarBackground}"
MouseUp="BtnToggleVideoPresenter_Click"
CornerRadius="5"
Background="{DynamicResource BoardFloatBarBackground}"
Opacity="1">
<Grid Margin="6,6,6,4">
<Image VerticalAlignment="Top"
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{DynamicResource IconForeground}"
Geometry="F0 M24,24z M0,0z M7.39778,13.723L10.7693,13.723 10.7693,10.3514 13.2307,10.3514 13.2307,13.723 16.6022,13.723 16.6022,16.1843 13.2307,16.1843 13.2307,19.5559 10.7693,19.5559 10.7693,16.1843 7.39778,16.1843 7.39778,13.723z M3.1391,1.17001L3.1391,22.83 20.8609,22.83 20.8609,6.66948 15.3614,1.17002 3.1391,1.17001z M12.9846,3.13911L5.10819,3.1391 5.10819,20.8609 18.8918,20.8609 18.8918,9.04638 12.9846,9.04638 12.9846,3.13911z M18.484,7.07729L14.9536,3.54692 14.9536,7.07729 18.484,7.07729z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="新页面" Foreground="{DynamicResource FloatBarForeground}" VerticalAlignment="Bottom"
HorizontalAlignment="Center" FontSize="12" />
<Image
VerticalAlignment="Top"
RenderOptions.BitmapScalingMode="HighQuality"
Height="20"
Width="20"
Source="/Resources/Icons-png/EasiCamera.png" />
<TextBlock
Text="展台"
Foreground="{DynamicResource FloatBarForeground}"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
FontSize="12" />
</Grid>
</Border>
</ui:SimpleStackPanel>
+18
View File
@@ -1481,6 +1481,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 { }
// 释放PPT管理器资源
DisposePPTManagers();
+28 -5
View File
@@ -46,6 +46,7 @@ namespace Ink_Canvas
VideoPresenterSidebar.Visibility = Visibility.Visible;
EnsureCameraService();
if (BtnCapturePhoto != null) BtnCapturePhoto.IsEnabled = false;
RefreshVideoPresenterDeviceList();
if (CheckBoxEnablePhotoCorrection != null)
@@ -86,16 +87,25 @@ namespace Ink_Canvas
try
{
Bitmap copy;
Bitmap serviceCopy;
try
{
serviceCopy = (Bitmap)frame.Clone();
}
catch
{
// 可能在下一帧到来时被 CameraService 释放,直接忽略这一帧
return;
}
lock (_videoPresenterFrameLock)
{
_lastFrame?.Dispose();
_lastFrame = (Bitmap)frame.Clone();
copy = (Bitmap)_lastFrame.Clone();
_lastFrame = (Bitmap)serviceCopy.Clone();
}
var preview = ConvertBitmapToBitmapImage(copy);
copy.Dispose();
var preview = ConvertBitmapToBitmapImage(serviceCopy);
serviceCopy.Dispose();
if (preview == null) return;
Dispatcher.BeginInvoke(new Action(() =>
@@ -154,6 +164,19 @@ namespace Ink_Canvas
rb.Checked += (s, e) => StartVideoPresenterPreview(idx);
CameraDevicesStackPanel.Children.Add(rb);
}
// 自动启动第一个摄像头
if (_cameraService.AvailableCameras.Count > 0)
{
if (CameraDevicesStackPanel.Children.Count > 0 && CameraDevicesStackPanel.Children[0] is RadioButton first)
{
first.IsChecked = true;
}
else
{
StartVideoPresenterPreview(0);
}
}
}
private void StartVideoPresenterPreview(int cameraIndex)