From a3bf515fb4de541eaca661905178b57a671de265 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Mon, 18 Jul 2022 21:47:35 +0200 Subject: [PATCH] Added: first implementation of categories --- .../Services/BrowserService.cs | 6 +- .../Borepin.UWP/Services/BrowserService.cs | 6 +- .../Borepin.iOS/Services/BrowserService.cs | 6 +- Borepin/Borepin/Base/ConnectionModelBase.cs | 3 +- .../Borepin/DialogModel/ConfirmDialogModel.cs | 4 +- .../Borepin/DialogModel/ScanDialogModel.cs | 4 +- .../Borepin/Model/ConnectionDataVisualize.cs | 2 - .../Model/MachineViewModelListGroup.cs | 19 +++++ Borepin/Borepin/Model/MachineVisualize.cs | 23 ++++-- Borepin/Borepin/Model/SpaceVisualize.cs | 1 - Borepin/Borepin/Model/UserVisualize.cs | 6 +- Borepin/Borepin/Page/MachineListPage.xaml | 3 +- .../Borepin/PageModel/MachineListPageModel.cs | 79 ++++++++++++++++--- Borepin/Borepin/PageModel/MachinePageModel.cs | 4 +- Borepin/Borepin/PageModel/ScanURNPageModel.cs | 4 +- Borepin/Borepin/PageModel/UserPageModel.cs | 6 +- .../Resources/Text/TextResource.Designer.cs | 9 +++ .../Borepin/Resources/Text/TextResource.resx | 3 + .../Service/Browser/BrowserLaunchMode.cs | 2 +- .../Service/Browser/BrowserTitleMode.cs | 2 +- .../ViewModel/MachineListItemViewModel.cs | 6 +- 21 files changed, 144 insertions(+), 54 deletions(-) create mode 100644 Borepin/Borepin/Model/MachineViewModelListGroup.cs diff --git a/Borepin/Borepin.Android/Services/BrowserService.cs b/Borepin/Borepin.Android/Services/BrowserService.cs index 7345dd6..c2e836a 100644 --- a/Borepin/Borepin.Android/Services/BrowserService.cs +++ b/Borepin/Borepin.Android/Services/BrowserService.cs @@ -7,7 +7,7 @@ namespace Borepin.Droid.Services { public class BrowserService : IBrowserService { - private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) + private Xamarin.Essentials.BrowserLaunchOptions _ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) { return new Xamarin.Essentials.BrowserLaunchOptions() { @@ -30,7 +30,7 @@ namespace Borepin.Droid.Services public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } public async Task OpenAsync(Uri uri) @@ -45,7 +45,7 @@ namespace Borepin.Droid.Services public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } } } \ No newline at end of file diff --git a/Borepin/Borepin.UWP/Services/BrowserService.cs b/Borepin/Borepin.UWP/Services/BrowserService.cs index 3669447..ddffa27 100644 --- a/Borepin/Borepin.UWP/Services/BrowserService.cs +++ b/Borepin/Borepin.UWP/Services/BrowserService.cs @@ -7,7 +7,7 @@ namespace Borepin.UWP.Services { public class BrowserService : IBrowserService { - private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) + private Xamarin.Essentials.BrowserLaunchOptions _ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) { return new Xamarin.Essentials.BrowserLaunchOptions() { @@ -30,7 +30,7 @@ namespace Borepin.UWP.Services public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } public async Task OpenAsync(Uri uri) @@ -45,7 +45,7 @@ namespace Borepin.UWP.Services public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } } } diff --git a/Borepin/Borepin.iOS/Services/BrowserService.cs b/Borepin/Borepin.iOS/Services/BrowserService.cs index 286116a..67f2cb4 100644 --- a/Borepin/Borepin.iOS/Services/BrowserService.cs +++ b/Borepin/Borepin.iOS/Services/BrowserService.cs @@ -7,7 +7,7 @@ namespace Borepin.iOS.Services { public class BrowserService : IBrowserService { - private Xamarin.Essentials.BrowserLaunchOptions ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) + private Xamarin.Essentials.BrowserLaunchOptions _ConvertBrowserLaunchOptions(Service.Browser.BrowserLaunchOptions browserLaunchOptions) { return new Xamarin.Essentials.BrowserLaunchOptions() { @@ -30,7 +30,7 @@ namespace Borepin.iOS.Services public async Task OpenAsync(string uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } public async Task OpenAsync(Uri uri) @@ -45,7 +45,7 @@ namespace Borepin.iOS.Services public async Task OpenAsync(Uri uri, Service.Browser.BrowserLaunchOptions browserLaunchOptions) { - await Browser.OpenAsync(uri, ConvertBrowserLaunchOptions(browserLaunchOptions)); + await Browser.OpenAsync(uri, _ConvertBrowserLaunchOptions(browserLaunchOptions)); } } } \ No newline at end of file diff --git a/Borepin/Borepin/Base/ConnectionModelBase.cs b/Borepin/Borepin/Base/ConnectionModelBase.cs index fc69cff..a07360e 100644 --- a/Borepin/Borepin/Base/ConnectionModelBase.cs +++ b/Borepin/Borepin/Base/ConnectionModelBase.cs @@ -2,6 +2,7 @@ using FabAccessAPI; using Prism.Navigation; using Prism.Services; +using System; using System.Threading.Tasks; namespace Borepin.Base @@ -109,7 +110,7 @@ namespace Borepin.Base { await LoadAPIData().ConfigureAwait(false); } - catch + catch(Exception ex) { IsConnected = false; await _API.Disconnect().ConfigureAwait(false); diff --git a/Borepin/Borepin/DialogModel/ConfirmDialogModel.cs b/Borepin/Borepin/DialogModel/ConfirmDialogModel.cs index 902f751..dbe3bf5 100644 --- a/Borepin/Borepin/DialogModel/ConfirmDialogModel.cs +++ b/Borepin/Borepin/DialogModel/ConfirmDialogModel.cs @@ -59,7 +59,7 @@ namespace Borepin.DialogModel IDialogParameters parameters = new DialogParameters() { { "result", "confirm" }, - { "instance", _Instance } + { "instance", _Instance }, }; RequestClose(parameters); } @@ -75,7 +75,7 @@ namespace Borepin.DialogModel IDialogParameters parameters = new DialogParameters() { { "result", "abort" }, - { "instance", _Instance } + { "instance", _Instance }, }; RequestClose(parameters); } diff --git a/Borepin/Borepin/DialogModel/ScanDialogModel.cs b/Borepin/Borepin/DialogModel/ScanDialogModel.cs index 5ebd646..0543b8e 100644 --- a/Borepin/Borepin/DialogModel/ScanDialogModel.cs +++ b/Borepin/Borepin/DialogModel/ScanDialogModel.cs @@ -71,7 +71,7 @@ namespace Borepin.DialogModel { { "result", "scanned" }, { "value", ScanResult.Text }, - { "instance", _Instance } + { "instance", _Instance }, }; RequestClose(parameters); } @@ -90,7 +90,7 @@ namespace Borepin.DialogModel IDialogParameters parameters = new DialogParameters() { { "result", "abort" }, - { "instance", _Instance } + { "instance", _Instance }, }; RequestClose(parameters); } diff --git a/Borepin/Borepin/Model/ConnectionDataVisualize.cs b/Borepin/Borepin/Model/ConnectionDataVisualize.cs index 2654090..01bd41a 100644 --- a/Borepin/Borepin/Model/ConnectionDataVisualize.cs +++ b/Borepin/Borepin/Model/ConnectionDataVisualize.cs @@ -13,8 +13,6 @@ namespace Borepin.Model public ConnectionDataVisualize(ConnectionData connectionData) { _ConnectionData = connectionData; - - LoadData(); } #endregion diff --git a/Borepin/Borepin/Model/MachineViewModelListGroup.cs b/Borepin/Borepin/Model/MachineViewModelListGroup.cs new file mode 100644 index 0000000..058e47f --- /dev/null +++ b/Borepin/Borepin/Model/MachineViewModelListGroup.cs @@ -0,0 +1,19 @@ +using Borepin.ViewModel; +using NaturalSort.Extension; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Borepin.Model +{ + public class MachineViewModelListGroup : List + { + public string Category { get; set; } + public void Sort_Machines() + { + List ordered = new List(this.OrderBy(x => x.Machine.Name, StringComparison.OrdinalIgnoreCase.WithNaturalSort())); + Clear(); + AddRange(ordered); + } + } +} diff --git a/Borepin/Borepin/Model/MachineVisualize.cs b/Borepin/Borepin/Model/MachineVisualize.cs index a77867b..709c7c5 100644 --- a/Borepin/Borepin/Model/MachineVisualize.cs +++ b/Borepin/Borepin/Model/MachineVisualize.cs @@ -1,5 +1,6 @@ using FabAccessAPI.Schema; using Prism.Mvvm; +using System.Threading.Tasks; using static FabAccessAPI.Schema.Machine; namespace Borepin.Model @@ -14,13 +15,11 @@ namespace Borepin.Model public MachineVisualize(Machine machine) { _Machine = machine; - - LoadData(); } #endregion #region Methods - public async void LoadData() + public async Task LoadData() { //ID = _Machine.Id; //Space = new SpaceVisualize(_Machine.Space); @@ -28,11 +27,12 @@ namespace Borepin.Model Description = _Machine.Description; Wiki = _Machine.Wiki; State = _Machine.State; + Category = _Machine.Category; if(_Machine.Manager.Just != null) { Manager = new UserVisualize(_Machine.Manager.Just); - Manager.LoadData(); + await Manager.LoadData().ConfigureAwait(false); } else { @@ -49,17 +49,17 @@ namespace Borepin.Model else { CurrentUser = new UserVisualize(machineInfoExtended.CurrentUser.Just); - CurrentUser.LoadData(); + await CurrentUser.LoadData().ConfigureAwait(false); } - if (machineInfoExtended.LastUser .Just== null) + if (machineInfoExtended.LastUser.Just == null) { LastUser = null; } else { LastUser = new UserVisualize(machineInfoExtended.LastUser.Just); - LastUser.LoadData(); + await LastUser.LoadData().ConfigureAwait(false); } } else @@ -74,7 +74,7 @@ namespace Borepin.Model CanCheck = !((CheckInterface_Proxy)_Machine.Check).IsNull; CanManage = !((ManageInterface_Proxy)_Machine.Manage).IsNull; CanAdmin = !((AdminInterface_Proxy)_Machine.Admin).IsNull; - CanNotUseByPermission = State == MachineState.free && CanUse == false; + CanNotUseByPermission = State == MachineState.free && !CanUse; } #endregion @@ -100,6 +100,13 @@ namespace Borepin.Model set => SetProperty(ref _Name, value); } + private string _Category; + public string Category + { + get => _Category; + set => SetProperty(ref _Category, value); + } + private string _Description; public string Description { diff --git a/Borepin/Borepin/Model/SpaceVisualize.cs b/Borepin/Borepin/Model/SpaceVisualize.cs index e264dfc..addd06f 100644 --- a/Borepin/Borepin/Model/SpaceVisualize.cs +++ b/Borepin/Borepin/Model/SpaceVisualize.cs @@ -13,7 +13,6 @@ namespace Borepin.Model public SpaceVisualize(Space space) { _Space = space; - LoadData(); } #endregion diff --git a/Borepin/Borepin/Model/UserVisualize.cs b/Borepin/Borepin/Model/UserVisualize.cs index 399dc64..8f3d3b5 100644 --- a/Borepin/Borepin/Model/UserVisualize.cs +++ b/Borepin/Borepin/Model/UserVisualize.cs @@ -1,5 +1,6 @@  using FabAccessAPI.Schema; using Prism.Mvvm; +using System.Threading.Tasks; namespace Borepin.Model { @@ -13,16 +14,17 @@ namespace Borepin.Model public UserVisualize(User user) { _User = user; - LoadData(); } #endregion #region LoadData - public void LoadData() + public Task LoadData() { //ID = _User.Id; Username = _User.Username; //Space = new SpaceVisualize(_User.Space); + + return Task.CompletedTask; } #endregion diff --git a/Borepin/Borepin/Page/MachineListPage.xaml b/Borepin/Borepin/Page/MachineListPage.xaml index 679a5df..f0b9c88 100644 --- a/Borepin/Borepin/Page/MachineListPage.xaml +++ b/Borepin/Borepin/Page/MachineListPage.xaml @@ -29,7 +29,8 @@ Android="True"/> - + + diff --git a/Borepin/Borepin/PageModel/MachineListPageModel.cs b/Borepin/Borepin/PageModel/MachineListPageModel.cs index ea87752..8b81d4f 100644 --- a/Borepin/Borepin/PageModel/MachineListPageModel.cs +++ b/Borepin/Borepin/PageModel/MachineListPageModel.cs @@ -12,6 +12,7 @@ using NaturalSort.Extension; using System.Linq; using Borepin.Service; using static FabAccessAPI.Schema.Machine; +using Borepin.Model; namespace Borepin.PageModel { @@ -28,41 +29,93 @@ namespace Borepin.PageModel #region Data public override async Task LoadAPIData() { - User user_self = await _API.Session.UserSystem.Info.GetUserSelf().ConfigureAwait(false); - IReadOnlyList machine_list = await _API.Session.MachineSystem.Info.GetMachineList().ConfigureAwait(false); - List viewmodel_list_user_assigned = new List(); - List viewmodel_list_not_user_assigned = new List(); + await _CreateMachineList(new List(machine_list)).ConfigureAwait(false); + } + + private async Task _CreateMachineList(List machine_list) + { + List viewmodel_group_list = new List(); + MachineViewModelListGroup viewmodel_group_inusebyme = new MachineViewModelListGroup() + { + Category = Resources.Text.TextResource.InUseByMe, + }; + MachineViewModelListGroup viewmodel_group_uncategorised = new MachineViewModelListGroup() + { + Category = null, + }; + foreach (Machine machine in machine_list) { - if(!((InUseInterface_Proxy)machine.Inuse).IsNull) + if (!((InUseInterface_Proxy)machine.Inuse).IsNull) { MachineListItemViewModel new_viewmodel = new MachineListItemViewModel(_NavigationService, _PageDialogService) { IsInUseByMe = true, }; await new_viewmodel.LoadInstance(machine).ConfigureAwait(false); - viewmodel_list_user_assigned.Add(new_viewmodel); + + new_viewmodel.Machine.Category = Resources.Text.TextResource.InUseByMe; + + viewmodel_group_inusebyme.Add(new_viewmodel); + } + else if (machine.Category == null) + { + MachineListItemViewModel new_viewmodel = new MachineListItemViewModel(_NavigationService, _PageDialogService); + await new_viewmodel.LoadInstance(machine).ConfigureAwait(false); + + viewmodel_group_inusebyme.Add(new_viewmodel); } else { MachineListItemViewModel new_viewmodel = new MachineListItemViewModel(_NavigationService, _PageDialogService); await new_viewmodel.LoadInstance(machine).ConfigureAwait(false); - viewmodel_list_not_user_assigned.Add(new_viewmodel); + + MachineViewModelListGroup viewmodel_group = viewmodel_group_list.Find(x => string.Equals(x.Category, machine.Category, StringComparison.Ordinal)); + if (viewmodel_group != null) + { + viewmodel_group.Add(new_viewmodel); + } + else + { + MachineViewModelListGroup new_viewmodel_group = new MachineViewModelListGroup() + { + Category = machine.Category, + }; + new_viewmodel_group.Add(new_viewmodel); + viewmodel_group_list.Add(new_viewmodel_group); + } } } - List viewmodel_list_sorted = new List(); - viewmodel_list_sorted.AddRange(viewmodel_list_user_assigned.OrderBy(x => x.Machine.Name, StringComparison.OrdinalIgnoreCase.WithNaturalSort())); - viewmodel_list_sorted.AddRange(viewmodel_list_not_user_assigned.OrderBy(x => x.Machine.Name, StringComparison.OrdinalIgnoreCase.WithNaturalSort())); - MachineListItemViewModel_List = viewmodel_list_sorted; + viewmodel_group_inusebyme.Sort_Machines(); + viewmodel_group_uncategorised.Sort_Machines(); + foreach(MachineViewModelListGroup viewmodel_group in viewmodel_group_list) + { + viewmodel_group.Sort_Machines(); + } + + List viewmodel_group_list_sorted = new List(); + if(viewmodel_group_inusebyme.Count != 0) + { + viewmodel_group_list_sorted.Add(viewmodel_group_inusebyme); + } + + viewmodel_group_list_sorted.AddRange(new List(viewmodel_group_list.OrderBy(x => x.Category, StringComparison.OrdinalIgnoreCase.WithNaturalSort()))); + + if (viewmodel_group_uncategorised.Count != 0) + { + viewmodel_group_list_sorted.Add(viewmodel_group_uncategorised); + } + + MachineListItemViewModel_List = viewmodel_group_list_sorted; } #endregion #region Fields - private IList _MachineListItemViewModel_List; - public IList MachineListItemViewModel_List + private IList _MachineListItemViewModel_List; + public IList MachineListItemViewModel_List { get => _MachineListItemViewModel_List; set => SetProperty(ref _MachineListItemViewModel_List, value); diff --git a/Borepin/Borepin/PageModel/MachinePageModel.cs b/Borepin/Borepin/PageModel/MachinePageModel.cs index de5ea2b..10d8d80 100644 --- a/Borepin/Borepin/PageModel/MachinePageModel.cs +++ b/Borepin/Borepin/PageModel/MachinePageModel.cs @@ -19,7 +19,7 @@ namespace Borepin.PageModel #region Private Fields private string _ID; private Machine _Machine; - private IBrowserService _BrowserService; + private readonly IBrowserService _BrowserService; #endregion #region Contructors @@ -55,7 +55,7 @@ namespace Borepin.PageModel { _Machine = (await _API.Session.MachineSystem.Info.GetMachine(_ID).ConfigureAwait(false)).Just; MachineItem = new MachineVisualize(_Machine); - MachineItem.LoadData(); + await MachineItem.LoadData().ConfigureAwait(false); } #endregion diff --git a/Borepin/Borepin/PageModel/ScanURNPageModel.cs b/Borepin/Borepin/PageModel/ScanURNPageModel.cs index d48e6c0..7974fa4 100644 --- a/Borepin/Borepin/PageModel/ScanURNPageModel.cs +++ b/Borepin/Borepin/PageModel/ScanURNPageModel.cs @@ -36,9 +36,9 @@ namespace Borepin.PageModel PossibleFormats = new List() { BarcodeFormat.QR_CODE, - BarcodeFormat.EAN_13 + BarcodeFormat.EAN_13, // TODO add more Barcode Formats if needed - } + }, }; } //set => SetProperty(ref _ScanOptions, value); diff --git a/Borepin/Borepin/PageModel/UserPageModel.cs b/Borepin/Borepin/PageModel/UserPageModel.cs index 461b975..933daca 100644 --- a/Borepin/Borepin/PageModel/UserPageModel.cs +++ b/Borepin/Borepin/PageModel/UserPageModel.cs @@ -24,7 +24,7 @@ namespace Borepin.PageModel #region Private Fields private string _ID; private User _User; - private IDialogService _DialogService; + private readonly IDialogService _DialogService; private bool _IsDialog; #endregion @@ -65,7 +65,7 @@ namespace Borepin.PageModel _User = (await _API.Session.UserSystem.Search.GetUserByName(_ID).ConfigureAwait(false)).Just; UserItem = new UserVisualize(_User); - UserItem.LoadData(); + await UserItem.LoadData().ConfigureAwait(false); IReadOnlyList role_list = await _API.Session.PermissionSystem.Info.GetRoleList().ConfigureAwait(false); List user_role_list = new List(await _User.Info.ListRoles().ConfigureAwait(false)); @@ -78,7 +78,7 @@ namespace Borepin.PageModel { role, _User, - user_role_list.Exists(x => string.Equals(x.Name, role.Name, StringComparison.Ordinal)) + user_role_list.Exists(x => string.Equals(x.Name, role.Name, StringComparison.Ordinal)), }; await new_viewmodel.LoadInstance(array).ConfigureAwait(false); diff --git a/Borepin/Borepin/Resources/Text/TextResource.Designer.cs b/Borepin/Borepin/Resources/Text/TextResource.Designer.cs index 0c6d3f7..34a14b6 100644 --- a/Borepin/Borepin/Resources/Text/TextResource.Designer.cs +++ b/Borepin/Borepin/Resources/Text/TextResource.Designer.cs @@ -350,6 +350,15 @@ namespace Borepin.Resources.Text { } } + /// + /// Looks up a localized string similar to In Use By Me. + /// + internal static string InUseByMe { + get { + return ResourceManager.GetString("InUseByMe", resourceCulture); + } + } + /// /// Looks up a localized string similar to You do not have the authorization to use this machine. ///Ask in your Space if you can be trained on the machine to be unlocked for the machine.. diff --git a/Borepin/Borepin/Resources/Text/TextResource.resx b/Borepin/Borepin/Resources/Text/TextResource.resx index ee5ccfc..76330ce 100644 --- a/Borepin/Borepin/Resources/Text/TextResource.resx +++ b/Borepin/Borepin/Resources/Text/TextResource.resx @@ -215,6 +215,9 @@ You can also put down several servers and then connect to the desired server. Host + + In Use By Me + You do not have the authorization to use this machine. Ask in your Space if you can be trained on the machine to be unlocked for the machine. diff --git a/Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs b/Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs index 59352d8..347d687 100644 --- a/Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs +++ b/Borepin/Borepin/Service/Browser/BrowserLaunchMode.cs @@ -3,6 +3,6 @@ public enum BrowserLaunchMode { SystemPreferred = 0, - External = 1 + External = 1, } } diff --git a/Borepin/Borepin/Service/Browser/BrowserTitleMode.cs b/Borepin/Borepin/Service/Browser/BrowserTitleMode.cs index 5b1d639..909af8a 100644 --- a/Borepin/Borepin/Service/Browser/BrowserTitleMode.cs +++ b/Borepin/Borepin/Service/Browser/BrowserTitleMode.cs @@ -4,6 +4,6 @@ { Default = 0, Show = 1, - Hide = 2 + Hide = 2, } } diff --git a/Borepin/Borepin/ViewModel/MachineListItemViewModel.cs b/Borepin/Borepin/ViewModel/MachineListItemViewModel.cs index a091648..43b19a7 100644 --- a/Borepin/Borepin/ViewModel/MachineListItemViewModel.cs +++ b/Borepin/Borepin/ViewModel/MachineListItemViewModel.cs @@ -20,15 +20,13 @@ namespace Borepin.ViewModel #endregion #region LoadData - public override Task LoadInstance(object instance) + public override async Task LoadInstance(object instance) { if(instance is Machine) { Machine = new MachineVisualize(instance as Machine); - Machine.LoadData(); + await Machine.LoadData().ConfigureAwait(false); } - - return Task.CompletedTask; } #endregion