Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Flags]
- public enum MagicEditorAction
- {
- Create = 2,
- Delete = 4,
- Edit = 8,
- }
- public enum MagicButtonLocation
- {
- Left, Top, Right, Bottom
- }
- public enum TestEntityBehavior
- {
- Motionless,
- Sedentary,
- Active
- }
- public interface IMagicEditorTemplate
- {
- void DrawEditor<TEntity>();
- }
- public class MagicEntity
- {
- }
- public class MyEditorTemplate : IMagicEditorTemplate
- {
- //Very complicated rendering, work out a system for rendering
- public void DrawEditor<TEntity>()
- {
- throw new NotImplementedException();
- }
- }
- public interface IMagicEntityProvider
- {
- MagicEntity[] LoadEntities();
- }
- //public class SimplePersonProvider : IMagicEntityProvider
- //{
- // public MagicEntity[] LoadEntities() => new MagicEntity[]
- // {
- // new Person(),
- // new Person(),
- // new Person(),
- // new Person(),
- // new Person()
- // };
- //}
- //public class SimpleEntitiesProvider : IMagicEntityProvider
- //{
- // public MagicEntity[] LoadEntities() => new MagicEntity[]
- // {
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity(),
- // new TestEntity()
- // };
- //}
- //public class Person : MagicEntity
- //{
- // [MagicEditorIgnore]
- // public int Id { get; set; }
- // [MaxLength(30)]
- // [MagicTextBox]
- // public string FIO { get; set; }
- // [MagicTextBox]
- // public string Passport { get; set; }
- //}
- //public class TestEntity : MagicEntity
- //{
- // [MagicEditorIgnore]
- // [MagicTextBox]
- // [MagicSlider(Minimum: -25, Maximum: 25)]
- // public int Id { get; set; }
- // [MaxLength(120)]
- // [MagicTextBox]
- // public string Name { get; set; }
- // [MagicTextBox]
- // public string Description { get; set; }
- // [MagicToggle]
- // public TestEntityBehavior Behavior { get; set; }
- // [MagicDropdown(typeof(SimplePersonProvider))]
- // public Person Owner { get; set; }
- // [MagicListBox(
- // ButtonLocation: MagicButtonLocation.Bottom,
- // Button: MagicEditorAction.Create | MagicEditorAction.Delete | MagicEditorAction.Edit
- // EntityProvider: typeof(SimpleEntitiesProvider))]
- // public TestEntity[] SubEntities { get; set; }
- //}
- //public Form1()
- //{
- // InitializeComponent();
- //}
- //private void Form1_Load(object sender, EventArgs e)
- //{
- // var entity = new TestEntity();
- // //Usage example
- // MagicGUI
- // .EntityEditor(entity, MagicPlatform.WF) //Required
- // .Template<MyEditorTemplate>() //Optional
- // .ConfirmButton("Принять", OnConfirmClick) //Required
- // .CancelButton("Отменить", OnCancelClick) //Optional
- // .Open(position: FormStartPosition.CenterScreen, title: $"Редактор {nameof(TestEntity)}"); //Required
- //}
- //private void OnConfirmClick(TestEntity entity)
- //{
- //}
- //private void OnCancelClick(TestEntity entity)
- //{
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement