2017-06-12 19:09:09 +00:00
|
|
|
|
using System;
|
2017-06-19 01:38:00 +00:00
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Converters;
|
2017-06-12 19:09:09 +00:00
|
|
|
|
|
|
|
|
|
namespace Ooui
|
|
|
|
|
{
|
2017-06-13 07:03:01 +00:00
|
|
|
|
public class Button : FormControl
|
2017-06-12 19:09:09 +00:00
|
|
|
|
{
|
2017-06-19 01:38:00 +00:00
|
|
|
|
public ButtonType Type {
|
2018-02-02 02:43:23 +00:00
|
|
|
|
get => GetAttribute ("type", ButtonType.Submit);
|
|
|
|
|
set => SetAttributeProperty ("type", value);
|
2017-06-19 01:38:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-14 23:48:42 +00:00
|
|
|
|
public Button ()
|
2017-06-15 06:20:51 +00:00
|
|
|
|
: base ("button")
|
2017-06-14 23:48:42 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Button (string text)
|
2017-06-15 06:20:51 +00:00
|
|
|
|
: this ()
|
2017-06-14 23:48:42 +00:00
|
|
|
|
{
|
|
|
|
|
Text = text;
|
|
|
|
|
}
|
2020-03-09 00:32:49 +00:00
|
|
|
|
|
|
|
|
|
public Button (string text, TargetEventHandler clickHandler)
|
|
|
|
|
: this (text)
|
|
|
|
|
{
|
|
|
|
|
Click += clickHandler;
|
|
|
|
|
}
|
2017-06-12 19:09:09 +00:00
|
|
|
|
}
|
2017-06-19 01:38:00 +00:00
|
|
|
|
|
|
|
|
|
[JsonConverter (typeof (StringEnumConverter))]
|
|
|
|
|
public enum ButtonType
|
|
|
|
|
{
|
|
|
|
|
[EnumMember (Value = "submit")]
|
|
|
|
|
Submit,
|
|
|
|
|
[EnumMember (Value = "reset")]
|
|
|
|
|
Reset,
|
|
|
|
|
[EnumMember (Value = "button")]
|
|
|
|
|
Button,
|
|
|
|
|
}
|
2017-06-12 19:09:09 +00:00
|
|
|
|
}
|