|
|
@@ -190,21 +190,29 @@ public partial class DigitalFormsHostViewModel<TModel, TShell, TParent, TParentL
|
|
|
|
|
|
DigitalForm = Model.FirstOrDefault(x => x.ID == FormID)!.Entity;
|
|
|
Variables = Model.Variables.Where(x => x.FormID == FormID).Select(x => x.Entity).ToArray();
|
|
|
- DigitalFormLayout = Model.Layouts.Where(x => x.FormID == FormID).First().Entity;
|
|
|
+
|
|
|
+ var dfLayout = Model.Layouts.Where(x => x.FormID == FormID).FirstOrDefault()?.Entity;
|
|
|
+ if(dfLayout is null)
|
|
|
+ {
|
|
|
+ await Dispatcher.UIThread.InvokeAsync(() => MessageDialog.ShowMessage("No layout found for this form."));
|
|
|
+ ProgressVisible = false;
|
|
|
+ return TimeSpan.Zero;
|
|
|
+ }
|
|
|
+ DigitalFormLayout = dfLayout;
|
|
|
|
|
|
if(DataAccess.Status == ConnectionStatus.Connected)
|
|
|
{
|
|
|
if(Parent.ID != Guid.Empty)
|
|
|
{
|
|
|
- Parent = Client.Query(
|
|
|
+ var row = Client.Query(
|
|
|
new Filter<TParent>(x => x.ID).IsEqualTo(Parent.ID),
|
|
|
DFUtils.EntityColumns<TForm, TParent, TParentLink>(Variables))
|
|
|
- .ToObjects<TParent>()
|
|
|
- .First();
|
|
|
+ .Rows.FirstOrDefault();
|
|
|
+ row?.FillObject(Parent);
|
|
|
}
|
|
|
if(InstanceID != Guid.Empty)
|
|
|
{
|
|
|
- Form = Client.Query(
|
|
|
+ var row = Client.Query(
|
|
|
new Filter<TForm>(x => x.ID).IsEqualTo(InstanceID),
|
|
|
Columns.None<TForm>()
|
|
|
.Add(
|
|
|
@@ -220,8 +228,8 @@ public partial class DigitalFormsHostViewModel<TModel, TShell, TParent, TParentL
|
|
|
x => x.FormStarted,
|
|
|
x => x.FormOpen,
|
|
|
x => x.BlobData))
|
|
|
- .ToObjects<TForm>()
|
|
|
- .First();
|
|
|
+ .Rows.First();
|
|
|
+ row.FillObject(Form);
|
|
|
}
|
|
|
CacheManager.SaveBinary<DigitalFormCacheModel<TParent, TParentLink, TForm>>(CacheFileName, new()
|
|
|
{
|
|
|
@@ -410,6 +418,7 @@ public partial class DigitalFormsHostViewModel<TModel, TShell, TParent, TParentL
|
|
|
x.Configure(parent, shell.FormID, shell.Entity);
|
|
|
x.OnSaved += () =>
|
|
|
{
|
|
|
+ shell.SyncRow();
|
|
|
model.RefreshAsync(true).ContinueWith(task =>
|
|
|
{
|
|
|
if(task.Exception is not null)
|