using PCHMI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.Design;

namespace CowainHmi.Alarm
{
    public class AlarmUIEditor : UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService windowsFormsEditorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (windowsFormsEditorService != null)
            {
                FrmEditAlarmTable form = new FrmEditAlarmTable((string)value);
                windowsFormsEditorService.ShowDialog(form);
                context.OnComponentChanged();
            }
            return value;
        }
    }
}
