Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Commit 03c2669

Browse files
committed
fix: fix camera ignoring reloading
1 parent 4fc8f23 commit 03c2669

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Source/MainWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ private static readonly (Mat Departure, Mat Destination) IconOrder = (
9393
/// </summary>
9494
private const int SerialPortBufferLength = 1048576;
9595

96+
public int _lastCameraIndex = 0;
97+
9698
#endregion
9799

98100

Source/SettingsWindow.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public partial class SettingsWindow : Form
3939
private ConfigType _config;
4040
private string _configFilePath = SettingsWindow.DefaultConfigFilePath;
4141
private MainWindow _mainWindow;
42-
private int _lastCameraIndex = 0;
4342

4443
#endregion
4544

@@ -74,7 +73,7 @@ private void ApplyConfig()
7473
var camera = this._mainWindow.Camera;
7574
this._mainWindow.Camera = null;
7675

77-
if (this._mainWindow.Config.Camera != this._lastCameraIndex)
76+
if (this._mainWindow.Config.Camera != this._mainWindow._lastCameraIndex)
7877
{
7978
// Release the camera (if it is opened) and open the new camera.
8079
camera?.Release();
@@ -91,7 +90,7 @@ private void ApplyConfig()
9190
);
9291
}
9392

94-
this._lastCameraIndex = this._mainWindow.Config.Camera;
93+
this._mainWindow._lastCameraIndex = this._mainWindow.Config.Camera;
9594
}
9695

9796
this._mainWindow.CameraFrameSize = new OpenCvSharp.Size(

0 commit comments

Comments
 (0)