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);
|
await ReadFrames(responseStream, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (TaskCanceledException)
|
||||||
|
{
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
@ -9,6 +9,7 @@ namespace IPCamAppBar
|
|||||||
public partial class CameraView : UserControl
|
public partial class CameraView : UserControl
|
||||||
{
|
{
|
||||||
private DateTime lastFrameTime;
|
private DateTime lastFrameTime;
|
||||||
|
private Timer noDataTimer;
|
||||||
|
|
||||||
|
|
||||||
public CameraView(string url)
|
public CameraView(string url)
|
||||||
@ -19,10 +20,11 @@ namespace IPCamAppBar
|
|||||||
cameraStream.Frame += CameraStreamOnFrame;
|
cameraStream.Frame += CameraStreamOnFrame;
|
||||||
cameraStream.Start(url);
|
cameraStream.Start(url);
|
||||||
|
|
||||||
var noDataTimer = new Timer();
|
noDataTimer = new Timer
|
||||||
noDataTimer.Interval = 1000;
|
{
|
||||||
|
Interval = 1000
|
||||||
|
};
|
||||||
noDataTimer.Tick += CheckNoData;
|
noDataTimer.Tick += CheckNoData;
|
||||||
noDataTimer.Start();
|
|
||||||
|
|
||||||
Disposed += (sender, args) =>
|
Disposed += (sender, args) =>
|
||||||
{
|
{
|
||||||
@ -46,6 +48,7 @@ namespace IPCamAppBar
|
|||||||
NoDataLabel.Visible = false;
|
NoDataLabel.Visible = false;
|
||||||
|
|
||||||
lastFrameTime = DateTime.Now;
|
lastFrameTime = DateTime.Now;
|
||||||
|
noDataTimer.Start();
|
||||||
|
|
||||||
var viewImage = new Bitmap(Width, Height);
|
var viewImage = new Bitmap(Width, Height);
|
||||||
using (var graphics = Graphics.FromImage(viewImage))
|
using (var graphics = Graphics.FromImage(viewImage))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"AppBar": {
|
"AppBar": {
|
||||||
"Monitor": 1,
|
"Monitor": 0,
|
||||||
"Side": "Top",
|
"Side": "Top",
|
||||||
"Size": 480
|
"Size": 480
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user