Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.79 KB | None | 0 0
  1. [Flags]
  2.         public enum MagicEditorAction
  3.         {
  4.             Create = 2,
  5.             Delete = 4,
  6.             Edit = 8,
  7.         }
  8.  
  9.         public enum MagicButtonLocation
  10.         {
  11.             Left, Top, Right, Bottom
  12.         }
  13.  
  14.         public enum TestEntityBehavior
  15.         {
  16.             Motionless,
  17.             Sedentary,
  18.             Active
  19.         }
  20.  
  21.         public interface IMagicEditorTemplate
  22.         {
  23.             void DrawEditor<TEntity>();
  24.         }
  25.  
  26.         public class MagicEntity
  27.         {
  28.         }
  29.  
  30.         public class MyEditorTemplate : IMagicEditorTemplate
  31.         {
  32.             //Very complicated rendering, work out a system for rendering
  33.             public void DrawEditor<TEntity>()
  34.             {
  35.                 throw new NotImplementedException();
  36.             }
  37.         }
  38.  
  39.         public interface IMagicEntityProvider
  40.         {
  41.             MagicEntity[] LoadEntities();
  42.         }
  43.  
  44.         //public class SimplePersonProvider : IMagicEntityProvider
  45.         //{
  46.         //    public MagicEntity[] LoadEntities() => new MagicEntity[]
  47.         //    {
  48.         //        new Person(),
  49.         //        new Person(),
  50.         //        new Person(),
  51.         //        new Person(),
  52.         //        new Person()
  53.         //    };
  54.         //}
  55.  
  56.         //public class SimpleEntitiesProvider : IMagicEntityProvider
  57.         //{
  58.         //    public MagicEntity[] LoadEntities() => new MagicEntity[]
  59.         //    {
  60.         //        new TestEntity(),
  61.         //        new TestEntity(),
  62.         //        new TestEntity(),
  63.         //        new TestEntity(),
  64.         //        new TestEntity(),
  65.         //        new TestEntity(),
  66.         //        new TestEntity(),
  67.         //        new TestEntity()
  68.         //    };
  69.         //}
  70.  
  71.         //public class Person : MagicEntity
  72.         //{
  73.         //    [MagicEditorIgnore]
  74.         //    public int Id { get; set; }
  75.  
  76.         //    [MaxLength(30)]
  77.         //    [MagicTextBox]
  78.         //    public string FIO { get; set; }
  79.  
  80.         //    [MagicTextBox]
  81.         //    public string Passport { get; set; }
  82.         //}
  83.  
  84.         //public class TestEntity : MagicEntity
  85.         //{
  86.         //    [MagicEditorIgnore]
  87.         //    [MagicTextBox]
  88.         //    [MagicSlider(Minimum: -25, Maximum: 25)]
  89.         //    public int Id { get; set; }
  90.  
  91.         //    [MaxLength(120)]
  92.         //    [MagicTextBox]
  93.         //    public string Name { get; set; }
  94.  
  95.         //    [MagicTextBox]
  96.         //    public string Description { get; set; }
  97.  
  98.         //    [MagicToggle]
  99.         //    public TestEntityBehavior Behavior { get; set; }
  100.  
  101.         //    [MagicDropdown(typeof(SimplePersonProvider))]
  102.         //    public Person Owner { get; set; }
  103.  
  104.         //    [MagicListBox(
  105.         //        ButtonLocation: MagicButtonLocation.Bottom,
  106.         //        Button: MagicEditorAction.Create | MagicEditorAction.Delete | MagicEditorAction.Edit
  107.         //        EntityProvider: typeof(SimpleEntitiesProvider))]
  108.         //    public TestEntity[] SubEntities { get; set; }
  109.         //}
  110.  
  111.         //public Form1()
  112.         //{
  113.         //    InitializeComponent();
  114.         //}
  115.  
  116.         //private void Form1_Load(object sender, EventArgs e)
  117.         //{
  118.         //    var entity = new TestEntity();
  119.  
  120.         //    //Usage example
  121.         //    MagicGUI
  122.         //        .EntityEditor(entity, MagicPlatform.WF) //Required
  123.         //        .Template<MyEditorTemplate>() //Optional
  124.         //        .ConfirmButton("Принять", OnConfirmClick) //Required
  125.         //        .CancelButton("Отменить", OnCancelClick) //Optional
  126.         //        .Open(position: FormStartPosition.CenterScreen, title: $"Редактор {nameof(TestEntity)}"); //Required
  127.         //}
  128.  
  129.         //private void OnConfirmClick(TestEntity entity)
  130.         //{
  131.  
  132.         //}
  133.  
  134.         //private void OnCancelClick(TestEntity entity)
  135.         //{
  136.  
  137.         //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement