|
@@ -53,7 +53,14 @@ public partial class DynamicEditorForm : ThemableChromelessWindow, IDynamicEdito
|
|
|
#region IDynamicEditorForm
|
|
|
|
|
|
public bool ReadOnly { get => Form.ReadOnly; set => Form.ReadOnly = value; }
|
|
|
- public BaseObject[] Items { get => Form.Items; set => Form.Items = value; }
|
|
|
+ public BaseObject[] Items
|
|
|
+ {
|
|
|
+ get => Form.Items;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ Form.Items = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
public DynamicEditorPages? Pages { get => Form.Pages; }
|
|
|
|
|
|
public event OnBeforeLoad? OnBeforeLoad;
|
|
@@ -86,6 +93,8 @@ public partial class DynamicEditorForm : ThemableChromelessWindow, IDynamicEdito
|
|
|
|
|
|
public DynamicGridSaveEvent? OnSaveItem { get => Form.OnSaveItem; set { Form.OnSaveItem = value; } }
|
|
|
|
|
|
+ public event IDynamicEditorForm.OnReloadEventHandler? OnReload { add => Form.OnReload += value; remove => Form.OnReload -= value; }
|
|
|
+
|
|
|
|
|
|
public IDynamicEditorControl FindEditor(string columnName) => Form.FindEditor(columnName);
|
|
|
public object? GetEditorValue(string columnName) => Form.GetEditorValue(columnName);
|
|
@@ -106,18 +115,6 @@ public partial class DynamicEditorForm : ThemableChromelessWindow, IDynamicEdito
|
|
|
Form.OnFormCustomiseEditor += (sender, items, column, editor) => OnFormCustomiseEditor?.Invoke(sender, items, column, editor);
|
|
|
}
|
|
|
|
|
|
- private bool _first = true;
|
|
|
-
|
|
|
- protected override void OnActivated(EventArgs e)
|
|
|
- {
|
|
|
- if (_first)
|
|
|
- {
|
|
|
- _first = false;
|
|
|
- this.MoveToCenter();
|
|
|
- }
|
|
|
- base.OnActivated(e);
|
|
|
- }
|
|
|
-
|
|
|
public DynamicEditorForm(Type type, DynamicEditorPages? pages = null, DynamicEditorButtons? buttons = null,
|
|
|
Func<Type, CoreTable>? pageDataHandler = null, bool preloadPages = false): this()
|
|
|
{
|
|
@@ -201,7 +198,12 @@ public partial class DynamicEditorForm : ThemableChromelessWindow, IDynamicEdito
|
|
|
bChanged = true;
|
|
|
}
|
|
|
|
|
|
- private void ThemableChromelessWindow_Loaded(object sender, RoutedEventArgs e)
|
|
|
+ private void Form_OnReload(IDynamicEditorForm form)
|
|
|
+ {
|
|
|
+ SetSize();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetSize()
|
|
|
{
|
|
|
var screen = WpfScreen.GetScreenFrom(new Point(Left, Top));
|
|
|
|
|
@@ -217,9 +219,6 @@ public partial class DynamicEditorForm : ThemableChromelessWindow, IDynamicEdito
|
|
|
var maxwidth = screen.WorkingArea.Width - 0;
|
|
|
Width = desiredwidth > maxwidth ? maxwidth : desiredwidth;
|
|
|
|
|
|
- Left = screen.DeviceBounds.Left + (screen.DeviceBounds.Width - Width) / 2.0F;
|
|
|
- Top = screen.DeviceBounds.Top + (screen.DeviceBounds.Height - Height) / 2.0F;
|
|
|
-
|
|
|
var scaption = Form.Items[0].GetType().GetCaption();
|
|
|
Title = "Edit " + scaption.SplitCamelCase();
|
|
|
}
|