86 lines
1.9 KiB
C#
86 lines
1.9 KiB
C#
///
|
|
/// Copyright (c) 2017 Senus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using TBF.Resources;
|
|
|
|
namespace TBF.UI.Camera
|
|
{
|
|
public partial class CameraPictureCtrl : UserControl, ICameraPicture
|
|
{
|
|
private DateTime imageTimeStamp;
|
|
|
|
public Image NewImage
|
|
{
|
|
set
|
|
{
|
|
pictureBox.Image = value;
|
|
imageTimeStamp = DateTime.Now;
|
|
ledPictureBox.BackColor = Color.Red;
|
|
}
|
|
}
|
|
|
|
public Image Image
|
|
{
|
|
set { pictureBox.Image = value; }
|
|
get { return pictureBox.Image; }
|
|
}
|
|
|
|
public DateTime TimeStamp
|
|
{
|
|
set { imageTimeStamp = value; }
|
|
get { return imageTimeStamp; }
|
|
}
|
|
|
|
public string Caption
|
|
{
|
|
set { captionLabel.Text = value; }
|
|
get { return captionLabel.Text; }
|
|
}
|
|
|
|
|
|
public CameraPictureCtrl()
|
|
{
|
|
InitializeComponent();
|
|
|
|
captionLabel.Text = Strings.No_info_available;
|
|
}
|
|
|
|
public CameraPictureCtrl(ICameraPicture oriCamPicture)
|
|
{
|
|
InitializeComponent();
|
|
|
|
captionLabel.Text = oriCamPicture.Caption;
|
|
pictureBox.Image = oriCamPicture.Image;
|
|
imageTimeStamp = oriCamPicture.TimeStamp;
|
|
|
|
UpdateLed(DateTime.Now);
|
|
}
|
|
|
|
|
|
public void UpdateLed(DateTime now)
|
|
{
|
|
ledPictureBox.BackColor = (now - imageTimeStamp > TimeSpan.FromMilliseconds(500))
|
|
? SystemColors.Control
|
|
: Color.Red;
|
|
}
|
|
|
|
private void stopButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void saveButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void maxButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|