|
@@ -1042,7 +1042,7 @@ namespace InABox.DynamicGrid
|
|
|
var datacolname = colname.Replace(".", "_");
|
|
|
var table = DataGridItems;
|
|
|
if (table is null) return;
|
|
|
-
|
|
|
+
|
|
|
var colno = table.Columns.IndexOf(datacolname);
|
|
|
if (colno < 0)
|
|
|
{
|
|
@@ -2751,40 +2751,47 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
private readonly Dictionary<Tuple<Type, Type>, Dictionary<object, object>> _lookupcache = new();
|
|
|
|
|
|
- protected virtual void DefineLookups(ILookupEditorControl sender, T[] items)
|
|
|
+ protected virtual void DefineLookups(ILookupEditorControl sender, T[] items, bool async = true)
|
|
|
{
|
|
|
if (sender.EditorDefinition is not ILookupEditor editor)
|
|
|
return;
|
|
|
|
|
|
var colname = sender.ColumnName;
|
|
|
-
|
|
|
- //Logger.Send(LogType.Information, typeof(T).Name, "Into Define Lookups: " + colname);
|
|
|
- Task.Run(() =>
|
|
|
+ if (async)
|
|
|
{
|
|
|
- try
|
|
|
+ Task.Run(() =>
|
|
|
{
|
|
|
- var values = editor.Values(colname, items);
|
|
|
- Dispatcher.Invoke(
|
|
|
- () =>
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //Logger.Send(LogType.Information, typeof(T).Name, "Dispatching Results" + colname);
|
|
|
- sender.LoadLookups(values);
|
|
|
- }
|
|
|
- catch (Exception e2)
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var values = editor.Values(colname, items);
|
|
|
+ Dispatcher.Invoke(
|
|
|
+ () =>
|
|
|
{
|
|
|
- Logger.Send(LogType.Information, typeof(T).Name,
|
|
|
- "Exception (2) in LoadLookups: " + e2.Message + "\n" + e2.StackTrace);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //Logger.Send(LogType.Information, typeof(T).Name, "Dispatching Results" + colname);
|
|
|
+ sender.LoadLookups(values);
|
|
|
+ }
|
|
|
+ catch (Exception e2)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Information, typeof(T).Name,
|
|
|
+ "Exception (2) in LoadLookups: " + e2.Message + "\n" + e2.StackTrace);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Logger.Send(LogType.Information, typeof(T).Name, "Exception (1) in LoadLookups: " + e.Message + "\n" + e.StackTrace);
|
|
|
- }
|
|
|
- });
|
|
|
+ );
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Information, typeof(T).Name,
|
|
|
+ "Exception (1) in LoadLookups: " + e.Message + "\n" + e.StackTrace);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var values = editor.Values(colname, items);
|
|
|
+ sender.LoadLookups(values);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|