61 lines
2.5 KiB
C#
61 lines
2.5 KiB
C#
using Inspectron.Settings;
|
|
using Inspectron.Settings.Attributes;
|
|
using Lindt.Colorballs.Duo.Utils;
|
|
using VisionBuilder.UI.Common;
|
|
|
|
namespace VisionBuilder.UI.Ringbuffer;
|
|
|
|
public class VisionBuilderRingbufferSettings : ISettings
|
|
{
|
|
|
|
public VisionBuilderRingbufferSettings(string cameraName)
|
|
{
|
|
CameraName = cameraName;
|
|
}
|
|
|
|
public string CameraName { get; }
|
|
|
|
public int MaxBad { get; set; } = 10000;
|
|
public int MaxGood { get; set; } = 100;
|
|
|
|
|
|
[SettingDescription(
|
|
@"
|
|
Specifies directory, in which MaxBad and MaxGood are applied.
|
|
"+ PathSettingsUtils.INSTUCTIONS
|
|
)]
|
|
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
|
public string Root { get; set; } = @"..\Data\Ringbuffer\$SS_MONTH_NAME $SS_YEAR";
|
|
|
|
|
|
|
|
[SettingDescription("Specifies directory, relative to the Root")]
|
|
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
|
public string GoodImagesPathTemplate { get; set; } = @"\$RECIPE_NAME";
|
|
|
|
[SettingDescription("Specifies directory, relative to the Root")]
|
|
[SettingPreview(typeof(VisionBuilderRingbufferSettings),nameof(ImagesPathTemplatePreview))]
|
|
public string BadImagesPathTemplate { get; set; } =
|
|
@"\$RECIPE_NAME\$DEFECT_NAME";
|
|
|
|
|
|
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
|
public string FilenameTemplate { get; set; } = "$YEAR-$MONTH_NUM-$DAY $HOUR-$MINUTE-$SECOND $MS";
|
|
|
|
|
|
public void RegisterSettings(InspectronSettings settings)
|
|
{
|
|
settings.RegisterSimple(this, () => this.MaxGood, CameraName+"/Ringbuffer", nameof(MaxGood));
|
|
settings.RegisterSimple(this, () => this.MaxBad, CameraName + "/Ringbuffer", nameof(MaxBad));
|
|
settings.RegisterSimple(this, () => this.Root, CameraName + "/Ringbuffer", nameof(Root));
|
|
settings.RegisterSimple(this, () => this.GoodImagesPathTemplate, CameraName + "/Ringbuffer", nameof(GoodImagesPathTemplate));
|
|
settings.RegisterSimple(this, () => this.BadImagesPathTemplate, CameraName + "/Ringbuffer", nameof(BadImagesPathTemplate));
|
|
settings.RegisterSimple(this, () => this.FilenameTemplate, CameraName + "/Ringbuffer", nameof(FilenameTemplate));
|
|
}
|
|
|
|
public static string ImagesPathTemplatePreview(object template)
|
|
{
|
|
return PathSettingsUtils.ConvertVariables((string) template, DateTime.Now, DateTime.Now, "my recipe",
|
|
"my defect", "my camera");
|
|
}
|
|
} |