From 6b38fc9d892759561b101a22bee34579cfc14be1 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 9 Feb 2021 15:25:22 +0100 Subject: [PATCH] Added: MachineListPage --- Borepin/Borepin/App.xaml.cs | 4 +- Borepin/Borepin/Borepin.csproj | 10 +- .../Converter/MachineStateColorConverter.cs | 7 +- .../Converter/MachineStateStringConverter.cs | 35 +++ Borepin/Borepin/Model/Machine.cs | 54 +--- Borepin/Borepin/Page/MachineListPage.xaml | 22 ++ ...esPage.xaml.cs => MachineListPage.xaml.cs} | 4 +- Borepin/Borepin/Page/MachinePage.xaml | 15 +- Borepin/Borepin/Page/MachinesPage.xaml | 43 ---- Borepin/Borepin/Page/MainPage.xaml | 2 +- .../Borepin/PageModel/MachineListPageModel.cs | 102 ++++++++ Borepin/Borepin/PageModel/MachinePageModel.cs | 238 +++++------------- .../Borepin/PageModel/MachinesPageModel.cs | 50 ---- Borepin/Borepin/Service/BFFH/BFFHService.cs | 5 + Borepin/Borepin/Service/BFFH/IBFFHService.cs | 2 + Borepin/Borepin/View/MachineListItemView.xaml | 32 +++ .../Borepin/View/MachineListItemView.xaml.cs | 20 ++ .../ViewModel/MachineListItemViewModel.cs | 28 +++ .../ViewModel/ServerListItemViewModel.cs | 28 ++- 19 files changed, 339 insertions(+), 362 deletions(-) create mode 100644 Borepin/Borepin/Converter/MachineStateStringConverter.cs create mode 100644 Borepin/Borepin/Page/MachineListPage.xaml rename Borepin/Borepin/Page/{MachinesPage.xaml.cs => MachineListPage.xaml.cs} (77%) delete mode 100644 Borepin/Borepin/Page/MachinesPage.xaml create mode 100644 Borepin/Borepin/PageModel/MachineListPageModel.cs delete mode 100644 Borepin/Borepin/PageModel/MachinesPageModel.cs create mode 100644 Borepin/Borepin/View/MachineListItemView.xaml create mode 100644 Borepin/Borepin/View/MachineListItemView.xaml.cs create mode 100644 Borepin/Borepin/ViewModel/MachineListItemViewModel.cs diff --git a/Borepin/Borepin/App.xaml.cs b/Borepin/Borepin/App.xaml.cs index 13553bb..3eec22d 100644 --- a/Borepin/Borepin/App.xaml.cs +++ b/Borepin/Borepin/App.xaml.cs @@ -50,9 +50,9 @@ namespace Borepin // Register Navigation containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterForNavigation(); - containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); diff --git a/Borepin/Borepin/Borepin.csproj b/Borepin/Borepin/Borepin.csproj index e78156d..7ec38ab 100644 --- a/Borepin/Borepin/Borepin.csproj +++ b/Borepin/Borepin/Borepin.csproj @@ -28,8 +28,8 @@ - - MachinesPage.xaml + + MachineListPage.xaml SettingsPage.xaml @@ -47,6 +47,9 @@ LightTheme.xaml + + MachineListItemView.xaml + @@ -67,9 +70,6 @@ MSBuild:UpdateDesignTimeXaml - - MSBuild:UpdateDesignTimeXaml - MSBuild:UpdateDesignTimeXaml diff --git a/Borepin/Borepin/Converter/MachineStateColorConverter.cs b/Borepin/Borepin/Converter/MachineStateColorConverter.cs index 9ab249b..de7b2ca 100644 --- a/Borepin/Borepin/Converter/MachineStateColorConverter.cs +++ b/Borepin/Borepin/Converter/MachineStateColorConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Text; -using Borepin.Model; using Xamarin.Forms; namespace Borepin.Converter @@ -11,9 +8,9 @@ namespace Borepin.Converter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - switch((MachineStates)value) + switch((FabAccessAPI.Schema.State)value) { - case (MachineStates.Free): + case (FabAccessAPI.Schema.State.free): return (Color)Application.Current.Resources["FirstColor"]; default: return (Color)Application.Current.Resources["SixthColor"]; diff --git a/Borepin/Borepin/Converter/MachineStateStringConverter.cs b/Borepin/Borepin/Converter/MachineStateStringConverter.cs new file mode 100644 index 0000000..21bd030 --- /dev/null +++ b/Borepin/Borepin/Converter/MachineStateStringConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Globalization; +using Xamarin.Forms; + +namespace Borepin.Converter +{ + public class MachineStateStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + switch((FabAccessAPI.Schema.State)value) + { + case (FabAccessAPI.Schema.State.free): + return "Free"; + case (FabAccessAPI.Schema.State.inUse): + return "In Use"; + case (FabAccessAPI.Schema.State.toCheck): + return "To Check"; + case (FabAccessAPI.Schema.State.reserved): + return "Reserved"; + case (FabAccessAPI.Schema.State.blocked): + return "Blocked"; + case (FabAccessAPI.Schema.State.disabled): + return "Disabled"; + default: + return "Unknown"; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Borepin/Borepin/Model/Machine.cs b/Borepin/Borepin/Model/Machine.cs index b4d048f..af21027 100644 --- a/Borepin/Borepin/Model/Machine.cs +++ b/Borepin/Borepin/Model/Machine.cs @@ -1,54 +1,8 @@ -using Prism.Mvvm; - -namespace Borepin.Model +namespace Borepin.Model { - public enum MachineStates + public class Machine { - Free, - InUse, - ToCheck, - Blocked, - Disabled, - Reserved - } - - public class Machine : BindableBase - { - private string _ID; - public string ID - { - get => _ID; - set => SetProperty(ref _ID, value); - } - - private MachineStates _State; - public MachineStates State - { - get => _State; - set => SetProperty(ref _State, value); - } - - private string _Description; - public string Description - { - get => _Description; - set => SetProperty(ref _Description, value); - } - - private User _User; - public User User - { - get => _User; - set => SetProperty(ref _User, value); - } - } - - public class User - { - public string ID { get; set; } - - public string Name { get; set; } - - public string OriginalWorkshop { get; set; } + public FabAccessAPI.Machine Instance { get; set; } + public FabAccessAPI.Schema.Machine.MInfo MInfo { get; set; } } } diff --git a/Borepin/Borepin/Page/MachineListPage.xaml b/Borepin/Borepin/Page/MachineListPage.xaml new file mode 100644 index 0000000..0f10107 --- /dev/null +++ b/Borepin/Borepin/Page/MachineListPage.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Borepin/Borepin/Page/MachinesPage.xaml.cs b/Borepin/Borepin/Page/MachineListPage.xaml.cs similarity index 77% rename from Borepin/Borepin/Page/MachinesPage.xaml.cs rename to Borepin/Borepin/Page/MachineListPage.xaml.cs index 83d1f70..65f3609 100644 --- a/Borepin/Borepin/Page/MachinesPage.xaml.cs +++ b/Borepin/Borepin/Page/MachineListPage.xaml.cs @@ -10,9 +10,9 @@ using Xamarin.Forms.Xaml; namespace Borepin.Page { [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class MachinesPage : ContentPage + public partial class MachineListPage : ContentPage { - public MachinesPage() + public MachineListPage() { InitializeComponent(); } diff --git a/Borepin/Borepin/Page/MachinePage.xaml b/Borepin/Borepin/Page/MachinePage.xaml index a825df5..347475f 100644 --- a/Borepin/Borepin/Page/MachinePage.xaml +++ b/Borepin/Borepin/Page/MachinePage.xaml @@ -14,23 +14,10 @@ -