Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit f1ca857

Browse files
committed
Change Revision to a single object
1 parent b212c4a commit f1ca857

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/InvvardDev.EZLayoutDisplay.Desktop/Helper/EZLayoutMaker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public EZLayout PrepareEZLayout(ErgodoxLayout ergodoxLayout, string layoutRevisi
2929

3030
var ezLayout = new EZLayout { HashId = ergodoxLayout.HashId, Name = ergodoxLayout.Title };
3131

32-
var ergodoxLayers = ergodoxLayout.Revisions.FirstOrDefault(r => r.HashId == layoutRevisionIds)?.Layers ?? ergodoxLayout.Revisions.First().Layers;
32+
var ergodoxLayers = ergodoxLayout.Revision.Layers ?? ergodoxLayout.Revision.Layers;
3333

3434
if (ergodoxLayers?.Any() != null)
3535
{

src/InvvardDev.EZLayoutDisplay.Desktop/ViewModel/SettingsViewModel.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ private void CheckLatestRevisionId(ErgodoxLayout layoutInfo)
434434
return;
435435
}
436436

437-
CurrentLayoutRevisionId = layoutInfo.Revisions.Last().HashId;
437+
CurrentLayoutRevisionId = layoutInfo.Revision.HashId;
438438
}
439439

440440
private void ClearLayoutInfo()
@@ -462,15 +462,13 @@ private void UpdateLayoutInfo(ErgodoxLayout layoutInfo)
462462
Tags = new ObservableCollection<string>(layoutInfo.Tags.Select(t => t.Name));
463463
}
464464

465-
if (layoutInfo.Revisions.Any(r => r.HashId == CurrentLayoutRevisionId))
465+
if (layoutInfo.Revision != null)
466466
{
467-
var revision = layoutInfo.Revisions.First(r => r.HashId == CurrentLayoutRevisionId);
468-
469-
KeyboardModel = GetKeyBoardDescription(_keyboardGeometry, revision.Model);
470-
UpdateLayoutButtons(revision);
467+
KeyboardModel = GetKeyBoardDescription(_keyboardGeometry, layoutInfo.Revision.Model);
468+
UpdateLayoutButtons(layoutInfo.Revision);
471469
LayoutStatus = !_layoutIsCompiled ? "Not compiled" : "Compiled";
472470

473-
Layers = new ObservableCollection<string>(revision.Layers.Select(l => l.ToString()));
471+
Layers = new ObservableCollection<string>(layoutInfo.Revision.Layers.Select(l => l.ToString()));
474472
}
475473
}
476474

0 commit comments

Comments
 (0)