Fixed "no data" message appearing immediately
Fixed TaskCanceledException handling on shutdown
This commit is contained in:
parent
346d3f5913
commit
8f61224777
@ -75,6 +75,9 @@ namespace IPCamAppBar
|
||||
await ReadFrames(responseStream, cancellationToken);
|
||||
}
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
|
@ -9,6 +9,7 @@ namespace IPCamAppBar
|
||||
public partial class CameraView : UserControl
|
||||
{
|
||||
private DateTime lastFrameTime;
|
||||
private Timer noDataTimer;
|
||||
|
||||
|
||||
public CameraView(string url)
|
||||
@ -19,10 +20,11 @@ namespace IPCamAppBar
|
||||
cameraStream.Frame += CameraStreamOnFrame;
|
||||
cameraStream.Start(url);
|
||||
|
||||
var noDataTimer = new Timer();
|
||||
noDataTimer.Interval = 1000;
|
||||
noDataTimer = new Timer
|
||||
{
|
||||
Interval = 1000
|
||||
};
|
||||
noDataTimer.Tick += CheckNoData;
|
||||
noDataTimer.Start();
|
||||
|
||||
Disposed += (sender, args) =>
|
||||
{
|
||||
@ -46,6 +48,7 @@ namespace IPCamAppBar
|
||||
NoDataLabel.Visible = false;
|
||||
|
||||
lastFrameTime = DateTime.Now;
|
||||
noDataTimer.Start();
|
||||
|
||||
var viewImage = new Bitmap(Width, Height);
|
||||
using (var graphics = Graphics.FromImage(viewImage))
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"AppBar": {
|
||||
"Monitor": 1,
|
||||
"Monitor": 0,
|
||||
"Side": "Top",
|
||||
"Size": 480
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user