Files
wg_cpso/CPSO/Forms/61_Settings/ViewStatusBlockSettings.cs
2026-03-25 18:20:24 +08:00

66 lines
2.4 KiB
C#

using CaeGlobals;
using DynamicTypeDescriptor;
using System;
using System.ComponentModel;
#pragma warning disable IDE0130
namespace CPSO.Settings
{
[Serializable]
public class ViewStatusBlockSettings : IViewSettings, IReset
{
// Variables
private StatusBlockSettings _statusBlockSettings;
private DynamicCustomTypeDescriptor _dctd = null;
// Properties
[Category("Design")]
[OrderedDisplayName(0, 10, "Status block visibility")]
[Description("Turn status block on or off.")]
public bool Visibility
{
get => _statusBlockSettings.Visible;
set => _statusBlockSettings.Visible = value;
}
//
[Category("Design")]
[OrderedDisplayName(1, 10, "Background type")]
[Description("Select the background type.")]
public AnnotationBackgroundType BackgroundType
{
get => _statusBlockSettings.BackgroundType;
set => _statusBlockSettings.BackgroundType = value;
}
//
[Category("Design")]
[OrderedDisplayName(2, 10, "Draw a border rectangle")]
[Description("Draw a border rectangle around the status block.")]
public bool DrawBorder
{
get => _statusBlockSettings.DrawBorder;
set => _statusBlockSettings.DrawBorder = value;
}
// Constructors
public ViewStatusBlockSettings(StatusBlockSettings statusBlockSettings)
{
_statusBlockSettings = statusBlockSettings;
_dctd = ProviderInstaller.Install(this);
// Now lets display Yes/No instead of True/False
_dctd.RenameBooleanPropertyToYesNo(nameof(Visibility));
_dctd.RenameBooleanPropertyToOnOff(nameof(DrawBorder));
}
// Methods
public ISettings GetBase()
{
return _statusBlockSettings;
}
public void Reset()
{
_statusBlockSettings.Reset();
}
}
}