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>
<Border Width="60" Height="50" <Border Width="60" Height="50"
BorderThickness="1" BorderBrush="{DynamicResource BoardFloatBarBorderBrush}" BorderThickness="1" BorderBrush="{DynamicResource BoardFloatBarBorderBrush}"
MouseUp="BtnWhiteBoardAdd_Click" CornerRadius="5" Background="{DynamicResource BoardFloatBarBackground}" MouseUp="BtnToggleVideoPresenter_Click"
CornerRadius="5"
Background="{DynamicResource BoardFloatBarBackground}"
Opacity="1"> Opacity="1">
<Grid Margin="6,6,6,4"> <Grid Margin="6,6,6,4">
<Image VerticalAlignment="Top" <Image
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"> VerticalAlignment="Top"
<Image.Source> RenderOptions.BitmapScalingMode="HighQuality"
<DrawingImage> Height="20"
<DrawingImage.Drawing> Width="20"
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z"> Source="/Resources/Icons-png/EasiCamera.png" />
<GeometryDrawing Brush="{DynamicResource IconForeground}" <TextBlock
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" /> Text="展台"
</DrawingGroup> Foreground="{DynamicResource FloatBarForeground}"
</DrawingImage.Drawing> VerticalAlignment="Bottom"
</DrawingImage> HorizontalAlignment="Center"
</Image.Source> FontSize="12" />
</Image>
<TextBlock Text="新页面" Foreground="{DynamicResource FloatBarForeground}" VerticalAlignment="Bottom"
HorizontalAlignment="Center" FontSize="12" />
</Grid> </Grid>
</Border> </Border>
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
+18
View File
@@ -1481,6 +1481,24 @@ namespace Ink_Canvas
{ {
SystemEvents.DisplaySettingsChanged -= SystemEventsOnDisplaySettingsChanged; 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管理器资源 // 释放PPT管理器资源
DisposePPTManagers(); DisposePPTManagers();
+28 -5
View File
@@ -46,6 +46,7 @@ namespace Ink_Canvas
VideoPresenterSidebar.Visibility = Visibility.Visible; VideoPresenterSidebar.Visibility = Visibility.Visible;
EnsureCameraService(); EnsureCameraService();
if (BtnCapturePhoto != null) BtnCapturePhoto.IsEnabled = false;
RefreshVideoPresenterDeviceList(); RefreshVideoPresenterDeviceList();
if (CheckBoxEnablePhotoCorrection != null) if (CheckBoxEnablePhotoCorrection != null)
@@ -86,16 +87,25 @@ namespace Ink_Canvas
try try
{ {
Bitmap copy; Bitmap serviceCopy;
try
{
serviceCopy = (Bitmap)frame.Clone();
}
catch
{
// 可能在下一帧到来时被 CameraService 释放,直接忽略这一帧
return;
}
lock (_videoPresenterFrameLock) lock (_videoPresenterFrameLock)
{ {
_lastFrame?.Dispose(); _lastFrame?.Dispose();
_lastFrame = (Bitmap)frame.Clone(); _lastFrame = (Bitmap)serviceCopy.Clone();
copy = (Bitmap)_lastFrame.Clone();
} }
var preview = ConvertBitmapToBitmapImage(copy); var preview = ConvertBitmapToBitmapImage(serviceCopy);
copy.Dispose(); serviceCopy.Dispose();
if (preview == null) return; if (preview == null) return;
Dispatcher.BeginInvoke(new Action(() => Dispatcher.BeginInvoke(new Action(() =>
@@ -154,6 +164,19 @@ namespace Ink_Canvas
rb.Checked += (s, e) => StartVideoPresenterPreview(idx); rb.Checked += (s, e) => StartVideoPresenterPreview(idx);
CameraDevicesStackPanel.Children.Add(rb); 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) private void StartVideoPresenterPreview(int cameraIndex)