| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 | 
							- using InABox.Core;
 
- using InABox.DynamicGrid;
 
- using InABox.WPF;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Media;
 
- namespace InABox.Poster.MYOB;
 
- public class MYOBCompanyFileEditor : BaseEditor
 
- {
 
-     protected override BaseEditor DoClone()
 
-     {
 
-         return new MYOBCompanyFileEditor();
 
-     }
 
- }
 
- public class MYOBCompanyFileEditorControl : DynamicEnclosedEditorControl<MYOBCompanyFile, MYOBCompanyFileEditor>
 
- {
 
-     private Grid Grid = null!;
 
-     private TextBox TextBox = null!;
 
-     private Button Select = null!;
 
-     private Button Clear = null!;
 
-     private readonly MYOBCompanyFile Value = new();
 
-     private static readonly Column<MYOBCompanyFile> IDColumn = new(x => x.ID);
 
-     private static readonly Column<MYOBCompanyFile> NameColumn = new(x => x.Name);
 
-     public override int DesiredHeight() => 25;
 
-     public override int DesiredWidth() => int.MaxValue;
 
-     protected override FrameworkElement CreateEditor()
 
-     {
 
-         Grid = new Grid
 
-         {
 
-             VerticalAlignment = VerticalAlignment.Stretch,
 
-             HorizontalAlignment = HorizontalAlignment.Stretch
 
-         };
 
-         Grid.AddColumn(GridUnitType.Star);
 
-         Grid.AddColumn(70);
 
-         Grid.AddColumn(70);
 
-         TextBox = new TextBox
 
-         {
 
-             VerticalAlignment = VerticalAlignment.Stretch,
 
-             VerticalContentAlignment = VerticalAlignment.Center,
 
-             HorizontalAlignment = HorizontalAlignment.Stretch,
 
-             IsEnabled = false
 
-         };
 
-         Grid.AddChild(TextBox, 0, 0);
 
-         Select = new Button
 
-         {
 
-             VerticalAlignment = VerticalAlignment.Stretch,
 
-             VerticalContentAlignment = VerticalAlignment.Center,
 
-             HorizontalAlignment = HorizontalAlignment.Stretch,
 
-             Content = "Select",
 
-             Margin = new Thickness(5, 0, 0, 0),
 
-         };
 
-         Select.Click += Select_Click;
 
-         Grid.AddChild(Select, 0, 1);
 
-         Clear = new Button
 
-         {
 
-             VerticalAlignment = VerticalAlignment.Stretch,
 
-             VerticalContentAlignment = VerticalAlignment.Center,
 
-             HorizontalAlignment = HorizontalAlignment.Stretch,
 
-             Content = "Clear",
 
-             Margin = new Thickness(5, 0, 0, 0),
 
-             Focusable = false
 
-         };
 
-         Clear.Click += Clear_Click;
 
-         Grid.AddChild(Clear, 0, 2);
 
-         return Grid;
 
-     }
 
-     public override void Configure()
 
-     {
 
-     }
 
-     private void Select_Click(object sender, RoutedEventArgs e)
 
-     {
 
-         if (e.OriginalSource != Select) return;
 
-         var file = MYOBCompanyFileSelectionDialog.SelectCompanyFile();
 
-         if(file is not null)
 
-         {
 
-             Value.ID = file.Id;
 
-             Value.Name = file.Name;
 
-             TextBox.Text = Value.Name;
 
-             CheckChanged();
 
-         }
 
-     }
 
-     private void Clear_Click(object sender, RoutedEventArgs e)
 
-     {
 
-         Value.ID = Guid.Empty;
 
-         Value.Name = "";
 
-         TextBox.Text = "";
 
-         CheckChanged();
 
-     }
 
-     protected override object? GetChildValue(string property)
 
-     {
 
-         if (IDColumn.IsEqualTo(property)) return Value.ID;
 
-         if (NameColumn.IsEqualTo(property)) return Value.Name;
 
-         return null;
 
-     }
 
-     protected override void SetChildValue(string property, object? value)
 
-     {
 
-         if (IDColumn.IsEqualTo(property)) Value.ID = (Guid)(value ?? Guid.Empty);
 
-         else if (NameColumn.IsEqualTo(property))
 
-         {
 
-             Value.Name = (value as string) ?? "";
 
-             TextBox.Text = Value.Name;
 
-         }
 
-     }
 
-     protected override IEnumerable<KeyValuePair<string, object?>> GetChildValues()
 
-     {
 
-         yield return new(IDColumn.Property, Value.ID);
 
-         yield return new(NameColumn.Property, Value.Name);
 
-     }
 
-     public override void SetColor(Color color)
 
-     {
 
-         TextBox.Background = IsEnabled ? new SolidColorBrush(color) : new SolidColorBrush(Colors.WhiteSmoke);
 
-     }
 
-     public override void SetFocus()
 
-     {
 
-         Select.Focus();
 
-     }
 
- }
 
 
  |