diff --git a/PlantBox.Client/PlantBox.Client/Forms/HomeItem.xaml b/PlantBox.Client/PlantBox.Client/Forms/HomeItem.xaml index d81b451..299b78f 100644 --- a/PlantBox.Client/PlantBox.Client/Forms/HomeItem.xaml +++ b/PlantBox.Client/PlantBox.Client/Forms/HomeItem.xaml @@ -6,7 +6,8 @@ + RowHeight="{OnPlatform Android=85}" + SeparatorVisibility="None" + ItemTapped="ListView_ItemTapped"> diff --git a/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs b/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs index 5597613..e13ab24 100644 --- a/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs +++ b/PlantBox.Client/PlantBox.Client/Forms/HomePage.xaml.cs @@ -1,4 +1,7 @@ -using System; +using PlantBox.Client.Forms.Plant; +using PlantBox.Client.Models; +using PlantBox.Shared.Communication.Commands; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -17,5 +20,12 @@ namespace PlantBox.Client.Forms { InitializeComponent(); } - } + + private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e) + { + var plant = (PlantInfo)e.Item; + + await Navigation.PushAsync(new PlantPage(plant)); + } + } } \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml b/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml new file mode 100644 index 0000000..86089dc --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml.cs b/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml.cs new file mode 100644 index 0000000..5645478 --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/CaptorsPage.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace PlantBox.Client.Forms.Plant +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class CaptorsPage : ContentPage + { + public CaptorsPage () + { + InitializeComponent (); + } + } +} \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml b/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml new file mode 100644 index 0000000..7e1da5f --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml.cs b/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml.cs new file mode 100644 index 0000000..0288e78 --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/HistoricPage.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace PlantBox.Client.Forms.Plant +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class HistoricPage : ContentPage + { + public HistoricPage () + { + InitializeComponent (); + } + } +} \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml b/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml new file mode 100644 index 0000000..67a1cae --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml.cs b/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml.cs new file mode 100644 index 0000000..ff0bbb1 --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Forms/Plant/PlantPage.xaml.cs @@ -0,0 +1,31 @@ +using PlantBox.Client.Models; +using PlantBox.Client.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace PlantBox.Client.Forms.Plant +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class PlantPage : TabbedPage + { + public PlantPage(PlantInfo plant) + { + InitializeComponent(); + + Children.Add(new CaptorsPage() + { + Title = Locale.Informations + }); + Children.Add(new HistoricPage() + { + Title = Locale.Historic + }); + } + } +} \ No newline at end of file diff --git a/PlantBox.Client/PlantBox.Client/Models/PlantInfo.cs b/PlantBox.Client/PlantBox.Client/Models/PlantInfo.cs new file mode 100644 index 0000000..1cc3d3c --- /dev/null +++ b/PlantBox.Client/PlantBox.Client/Models/PlantInfo.cs @@ -0,0 +1,23 @@ +using PlantBox.Shared.Communication.Commands; +using System; +using System.Collections.Generic; +using System.Text; + +namespace PlantBox.Client.Models +{ + public class PlantInfo + { + public string Name { get; } + public ulong ID { get; } + public PlantType Type { get; } + public PlantState State { get; } + + public PlantInfo(string name, ulong iD, PlantType type, PlantState state) + { + Name = name; + ID = iD; + Type = type; + State = state; + } + } +} diff --git a/PlantBox.Client/PlantBox.Client/PlantBox.Client.csproj b/PlantBox.Client/PlantBox.Client/PlantBox.Client.csproj index d584124..bceb626 100644 --- a/PlantBox.Client/PlantBox.Client/PlantBox.Client.csproj +++ b/PlantBox.Client/PlantBox.Client/PlantBox.Client.csproj @@ -53,6 +53,15 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + MSBuild:UpdateDesignTimeXaml diff --git a/PlantBox.Client/PlantBox.Client/Resources/Locale.Designer.cs b/PlantBox.Client/PlantBox.Client/Resources/Locale.Designer.cs index 577ea5f..f7ebfbb 100644 --- a/PlantBox.Client/PlantBox.Client/Resources/Locale.Designer.cs +++ b/PlantBox.Client/PlantBox.Client/Resources/Locale.Designer.cs @@ -78,6 +78,15 @@ namespace PlantBox.Client.Resources { } } + /// + /// Recherche une chaîne localisée semblable à Captors. + /// + internal static string Captors { + get { + return ResourceManager.GetString("Captors", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à General. /// @@ -87,6 +96,15 @@ namespace PlantBox.Client.Resources { } } + /// + /// Recherche une chaîne localisée semblable à Historic. + /// + internal static string Historic { + get { + return ResourceManager.GetString("Historic", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à Home. /// diff --git a/PlantBox.Client/PlantBox.Client/Resources/Locale.fr.resx b/PlantBox.Client/PlantBox.Client/Resources/Locale.fr.resx index 5f5ece7..2989527 100644 --- a/PlantBox.Client/PlantBox.Client/Resources/Locale.fr.resx +++ b/PlantBox.Client/PlantBox.Client/Resources/Locale.fr.resx @@ -123,9 +123,15 @@ Auteur + + Capteurs + Général + + Historique + Accueil diff --git a/PlantBox.Client/PlantBox.Client/Resources/Locale.resx b/PlantBox.Client/PlantBox.Client/Resources/Locale.resx index 0d952dc..479fbd0 100644 --- a/PlantBox.Client/PlantBox.Client/Resources/Locale.resx +++ b/PlantBox.Client/PlantBox.Client/Resources/Locale.resx @@ -123,9 +123,15 @@ Author + + Captors + General + + Historic + Home diff --git a/PlantBox.Client/PlantBox.Client/ViewModels/HomeViewModel.cs b/PlantBox.Client/PlantBox.Client/ViewModels/HomeViewModel.cs index d600c16..d90daa1 100644 --- a/PlantBox.Client/PlantBox.Client/ViewModels/HomeViewModel.cs +++ b/PlantBox.Client/PlantBox.Client/ViewModels/HomeViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; @@ -14,23 +15,25 @@ namespace PlantBox.Client.ViewModels { public event PropertyChangedEventHandler PropertyChanged; - public ObservableCollection Plants { get; set; } + public ObservableCollection Plants { get; set; } public HomeViewModel() { Plants = LoadPlants(App.Settings.IDs); } - public ObservableCollection LoadPlants(IEnumerable ids) + public ObservableCollection LoadPlants(IEnumerable ids) { // Mock - return new ObservableCollection() - { - new InfoResponse("Salon", PlantType.Ficus, PlantState.Good, 75.2), - new InfoResponse("Chambre", PlantType.Bamboo, PlantState.Warning, 11.2), - new InfoResponse("Hello", PlantType.Cactus, PlantState.Bad, 45.2), - new InfoResponse("Hello", PlantType.Cactus, PlantState.Bad, 45.2) - }; + return new ObservableCollection + ( + new[] { + new PlantInfo("Salon", 0, PlantType.Ficus, PlantState.Good), + new PlantInfo("Chambre", 1, PlantType.Bamboo, PlantState.Warning), + new PlantInfo("Hellx", 2, PlantType.Cactus, PlantState.Bad), + new PlantInfo("Hello", 3, PlantType.Cactus, PlantState.Bad) + }.OrderBy(x => x.State).ThenBy(x => x.Name) + ); } protected void OnPropertyChanged([CallerMemberName] string propertyName = null)