recipe name filter
This commit is contained in:
@@ -46,12 +46,14 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
private void AddErrorPreviewInternal(ErrorData errorData)
|
||||
{
|
||||
var pb = new PictureBox();
|
||||
var width = 293 / 2;
|
||||
var height = 220 / 2;
|
||||
pb.Size = new Size(width, height + 20);
|
||||
var width = 293 / 1.6f;
|
||||
var height = 220 / 1.6f;
|
||||
pb.Size = new Size((int)width, (int)height + 20);
|
||||
pb.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pb.Margin = new Padding(5,0,5,5);
|
||||
|
||||
var numberedImage = new Bitmap(width, height + 20);
|
||||
var text = DateTime.Now.ToString("yy-MM-dd") + " " + DateTime.Now.ToString("T");
|
||||
var numberedImage = new Bitmap((int)width, (int)height + 20);
|
||||
var text = errorData.Title;
|
||||
|
||||
using (Graphics g = Graphics.FromImage(numberedImage))
|
||||
{
|
||||
|
||||
@@ -36,11 +36,13 @@
|
||||
stats1 = new Stats();
|
||||
btnStart = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
flowLayoutPanel1 = new FlowLayoutPanel();
|
||||
flowLayoutPanel2 = new FlowLayoutPanel();
|
||||
btnSelectRecipe = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
btnStop = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
materialDivider2 = new MaterialSkin.Controls.MaterialDivider();
|
||||
((System.ComponentModel.ISupportInitialize)previewWindow1).BeginInit();
|
||||
flowLayoutPanel1.SuspendLayout();
|
||||
flowLayoutPanel2.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblCameraName
|
||||
@@ -110,8 +112,9 @@
|
||||
btnStart.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnStart.Depth = 0;
|
||||
btnStart.DrawBorder = false;
|
||||
btnStart.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
|
||||
btnStart.Icon = null;
|
||||
btnStart.Location = new Point(85, 97);
|
||||
btnStart.Location = new Point(21, 73);
|
||||
btnStart.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnStart.Name = "btnStart";
|
||||
btnStart.Primary = true;
|
||||
@@ -122,9 +125,7 @@
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
flowLayoutPanel1.Controls.Add(btnSelectRecipe);
|
||||
flowLayoutPanel1.Controls.Add(btnStart);
|
||||
flowLayoutPanel1.Controls.Add(btnStop);
|
||||
flowLayoutPanel1.Controls.Add(flowLayoutPanel2);
|
||||
flowLayoutPanel1.Dock = DockStyle.Right;
|
||||
flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
|
||||
flowLayoutPanel1.Location = new Point(1408, 0);
|
||||
@@ -134,14 +135,25 @@
|
||||
flowLayoutPanel1.Size = new Size(280, 498);
|
||||
flowLayoutPanel1.TabIndex = 10;
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
//
|
||||
flowLayoutPanel2.Controls.Add(btnSelectRecipe);
|
||||
flowLayoutPanel2.Controls.Add(btnStart);
|
||||
flowLayoutPanel2.Controls.Add(btnStop);
|
||||
flowLayoutPanel2.Location = new Point(61, 27);
|
||||
flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
flowLayoutPanel2.Size = new Size(200, 237);
|
||||
flowLayoutPanel2.TabIndex = 12;
|
||||
//
|
||||
// btnSelectRecipe
|
||||
//
|
||||
btnSelectRecipe.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnSelectRecipe.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnSelectRecipe.Depth = 0;
|
||||
btnSelectRecipe.DrawBorder = true;
|
||||
btnSelectRecipe.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
|
||||
btnSelectRecipe.Icon = null;
|
||||
btnSelectRecipe.Location = new Point(85, 27);
|
||||
btnSelectRecipe.Location = new Point(21, 3);
|
||||
btnSelectRecipe.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnSelectRecipe.Name = "btnSelectRecipe";
|
||||
btnSelectRecipe.Primary = false;
|
||||
@@ -156,8 +168,9 @@
|
||||
btnStop.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
btnStop.Depth = 0;
|
||||
btnStop.DrawBorder = false;
|
||||
btnStop.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
|
||||
btnStop.Icon = null;
|
||||
btnStop.Location = new Point(85, 167);
|
||||
btnStop.Location = new Point(21, 143);
|
||||
btnStop.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
btnStop.Name = "btnStop";
|
||||
btnStop.Primary = true;
|
||||
@@ -195,6 +208,7 @@
|
||||
Size = new Size(1688, 498);
|
||||
((System.ComponentModel.ISupportInitialize)previewWindow1).EndInit();
|
||||
flowLayoutPanel1.ResumeLayout(false);
|
||||
flowLayoutPanel2.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@@ -211,5 +225,6 @@
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnStop;
|
||||
private MaterialSkin.Controls.MaterialRaisedButton btnSelectRecipe;
|
||||
private MaterialSkin.Controls.MaterialDivider materialDivider2;
|
||||
private FlowLayoutPanel flowLayoutPanel2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
public void SetViewModel(SingleCameraVM singleCameraVm)
|
||||
{
|
||||
_singleCameraVm = singleCameraVm;
|
||||
singleCameraVm.SynchronizationContext = SynchronizationContext.Current;
|
||||
this.previewWindow1.SetViewModel(singleCameraVm.PreviewVm);
|
||||
this.errorPreview1.SetViewModel(singleCameraVm.ErrorsVm);
|
||||
this.stats1.SetViewModel(singleCameraVm.StatisticsVm);
|
||||
@@ -37,8 +38,11 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
btnStop.Command=_singleCameraVm.StopCommand;
|
||||
btnSelectRecipe.Command=_singleCameraVm.SelectRecipeCommand;
|
||||
|
||||
lblCameraName.DataBindings.Add("Text", _singleCameraVm, nameof(_singleCameraVm.CameraLabel), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
lblCameraName.DataBindings.Add("Text", _singleCameraVm, nameof(_singleCameraVm.CameraLabelAndStatus), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
btnSelectRecipe.DataBindings.Add("Text", _singleCameraVm, nameof(_singleCameraVm.CurrentRecipeName), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
btnStart.DataBindings.Add(nameof(btnStart.Visible), _singleCameraVm, nameof(_singleCameraVm.CanStart), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
btnStop.DataBindings.Add(nameof(btnStop.Visible), _singleCameraVm, nameof(_singleCameraVm.CanStop), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
btnSelectRecipe.DataBindings.Add(nameof(btnSelectRecipe.Primary), _singleCameraVm, nameof(_singleCameraVm.RecipeNotSelected), true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,23 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
{
|
||||
public partial class Stats : UserControl
|
||||
{
|
||||
private const string StartedAtLabel = "Started at";
|
||||
private const string RecipeLabel = "Recipe";
|
||||
private const string ProcessingTimeLabel = "Processing time";
|
||||
private const string GoodLabel = "Good";
|
||||
private const string BadLabel = "Bad";
|
||||
private const string TotalLabel = "Total";
|
||||
private const string DetailsLabel = "Details";
|
||||
private const string ErrorRateLabel = "Error rate";
|
||||
|
||||
private const string FontFamilyName = "Verdana";
|
||||
private const string Ellipsis = "...";
|
||||
|
||||
public void SetViewModel(StatisticsVM statisticsVm)
|
||||
{
|
||||
_statisticsVm = statisticsVm;
|
||||
_statisticsVm.PropertyChanged += _statisticsVm_PropertyChanged;
|
||||
Clear();
|
||||
}
|
||||
|
||||
private void _statisticsVm_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
@@ -17,29 +29,46 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case nameof(StatisticsVM.SessionStarted):
|
||||
UpdateMeta("Started at", _statisticsVm.SessionStarted, true);
|
||||
UpdateMeta(StartedAtLabel, _statisticsVm.SessionStarted, true);
|
||||
break;
|
||||
case nameof(StatisticsVM.RecipeName):
|
||||
UpdateMeta("Recipe", _statisticsVm.RecipeName, true);
|
||||
// we don't use RecipeName(it's on button)
|
||||
//UpdateMeta(RecipeLabel, _statisticsVm.RecipeName, true);
|
||||
break;
|
||||
case nameof(StatisticsVM.ProcessingTime):
|
||||
UpdateMeta("Processing time", _statisticsVm.ProcessingTime, true);
|
||||
UpdateMeta(ProcessingTimeLabel, _statisticsVm.ProcessingTime, true);
|
||||
break;
|
||||
case nameof(StatisticsVM.Good):
|
||||
UpdateMeta("Good", _statisticsVm.Good.ToString(), true);
|
||||
// don't need to show good count
|
||||
//UpdateMeta(GoodLabel, _statisticsVm.Good.ToString(), false);
|
||||
break;
|
||||
case nameof(StatisticsVM.Bad):
|
||||
UpdateMeta("Bad", _statisticsVm.Bad.ToString(), true);
|
||||
UpdateMeta(BadLabel, _statisticsVm.Bad.ToString(), false);
|
||||
break;
|
||||
case nameof(StatisticsVM.Total):
|
||||
UpdateMeta("Total", _statisticsVm.Total.ToString(), true);
|
||||
UpdateMeta(TotalLabel, _statisticsVm.Total.ToString(), false);
|
||||
break;
|
||||
case nameof(StatisticsVM.StatisticsDetails):
|
||||
UpdateMeta("Details", _statisticsVm.StatisticsDetails, false);
|
||||
UpdateMeta(DetailsLabel, _statisticsVm.StatisticsDetails, false);
|
||||
break;
|
||||
case nameof(StatisticsVM.ErrorRate):
|
||||
UpdateMeta(ErrorRateLabel, _statisticsVm.ErrorRate, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeFields()
|
||||
{
|
||||
UpdateMeta(StartedAtLabel,"");
|
||||
UpdateMeta(ProcessingTimeLabel, "");
|
||||
UpdateMeta(TotalLabel, "0");
|
||||
UpdateMeta(BadLabel, "0");
|
||||
UpdateMeta(ErrorRateLabel, "0");
|
||||
UpdateMeta(DetailsLabel, "");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Stats()
|
||||
{
|
||||
|
||||
@@ -64,15 +93,27 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
private readonly Bitmap _imageBadIndicator;
|
||||
private StatisticsVM _statisticsVm;
|
||||
|
||||
public void UpdateMeta(string name, string text, bool bold=false)
|
||||
public static string ShortenString(string input, int maxLength)
|
||||
{
|
||||
if (input.Length <= maxLength)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return input.Substring(0, maxLength) + Ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateMeta(string name, string text, bool bold = false)
|
||||
{
|
||||
Action a = new Action(() =>
|
||||
{
|
||||
if (!_meta.ContainsKey(name))
|
||||
{
|
||||
metaPanel.Controls.Add(new Label() { AutoSize = true, Margin = new Padding(0, 8, 0, 0), Text = name + ":", Font = new Font(new FontFamily("Verdana"), 8, FontStyle.Bold) });
|
||||
metaPanel.Controls.Add(new Label() { AutoSize = true, Margin = new Padding(0, 8, 0, 0), Text = name + ":", Font = new Font(new FontFamily(FontFamilyName), 8, FontStyle.Bold) });
|
||||
_meta[name] = new Label() { AutoSize = true, Margin = new Padding(0) };
|
||||
_meta[name].Font = new Font(new FontFamily("Verdana"), 8, bold?FontStyle.Bold:FontStyle.Regular);
|
||||
_meta[name].Font = new Font(new FontFamily(FontFamilyName), 8, bold ? FontStyle.Bold : FontStyle.Regular);
|
||||
metaPanel.Controls.Add(_meta[name]);
|
||||
|
||||
}
|
||||
@@ -94,22 +135,11 @@ namespace VisionBuilder.UI.Windows.Components
|
||||
|
||||
|
||||
|
||||
public static string ShortenString(string input, int maxLength)
|
||||
{
|
||||
if (input.Length <= maxLength)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return input.Substring(0, maxLength) + "...";
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_meta.Clear();
|
||||
metaPanel.Controls.Clear();
|
||||
InitializeFields();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user