bind profile picture image between HomePage and Account
continuous-integration/drone/push Build is passing Details

pull/40/head
Maxime BATISTA 2 years ago
parent fcbbb28a34
commit 7a0eb8d0da

@ -22,7 +22,7 @@ public partial class App : Application, ConnectionObserver
public void OnAccountConnected(Account account) public void OnAccountConnected(Account account)
{ {
Shell shell = new MainAppShell(account); Shell shell = new MainAppShell(account, Notifier);
shell.GoToAsync("//MainPage"); shell.GoToAsync("//MainPage");
MainPage = shell; MainPage = shell;
} }

@ -1,9 +1,4 @@
using Models; using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook namespace ShoopNCook
{ {

@ -1,10 +1,4 @@
using System; namespace ShoopNCook
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook
{ {
/// <summary> /// <summary>
/// A notice reporter implementation that prints in console the applications's user notices. /// A notice reporter implementation that prints in console the applications's user notices.
@ -14,17 +8,17 @@ namespace ShoopNCook
{ {
public void Error(string message) public void Error(string message)
{ {
Console.WriteLine("<Notice Reporter> Error: " + message); Console.WriteLine("<User Notice> Error: " + message);
} }
public void Notice(string message) public void Notice(string message)
{ {
Console.WriteLine("<Notice Reporter> Notice: " + message); Console.WriteLine("<User Notice> Notice: " + message);
} }
public void Warn(string message) public void Warn(string message)
{ {
Console.WriteLine("<Notice Reporter> Warn: " + message); Console.WriteLine("<User Notice> Warn: " + message);
} }
} }
} }

@ -14,28 +14,24 @@
<ShellContent <ShellContent
x:Name="HomeTab" x:Name="HomeTab"
Title="Home" Title="Home"
ContentTemplate="{DataTemplate pages:HomePage}" Route="Home"
Route="HomePage"
Icon="home.svg"/> Icon="home.svg"/>
<ShellContent <ShellContent
x:Name="FavoritesTab" x:Name="FavoritesTab"
Title="Favorites" Title="Favorites"
ContentTemplate="{DataTemplate pages:FavoritesPage}"
Route="Favorites" Route="Favorites"
Icon="hearth_on.svg"/> Icon="hearth_on.svg"/>
<ShellContent <ShellContent
x:Name="MyListTab" x:Name="MyListTab"
Title="MyList" Title="MyList"
ContentTemplate="{DataTemplate pages:MyListPage}"
Route="MyList" Route="MyList"
Icon="list.svg"/> Icon="list.svg"/>
<ShellContent <ShellContent
x:Name="MoreTab" x:Name="MoreTab"
Title="More" Title="More"
ContentTemplate="{DataTemplate pages:MorePage}"
Route="More" Route="More"
Icon="more.svg"/> Icon="more.svg"/>
</TabBar> </TabBar>

@ -1,11 +1,16 @@
namespace ShoopNCook; namespace ShoopNCook;
using Microsoft.Maui.Controls; using Microsoft.Maui.Controls;
using Models; using Models;
using ShoopNCook.Pages;
public partial class MainAppShell : Shell public partial class MainAppShell : Shell
{ {
public MainAppShell(Account account) public MainAppShell(Account account, UserNotifier notifier)
{ {
InitializeComponent(); InitializeComponent();
HomeTab.ContentTemplate = new DataTemplate(() => new HomePage(account, notifier));
FavoritesTab.ContentTemplate = new DataTemplate(() => new FavoritesPage(account, notifier));
MyListTab.ContentTemplate = new DataTemplate(() => new MyListPage(account, notifier));
MoreTab.ContentTemplate = new DataTemplate(() => new MorePage(account, notifier));
} }
} }

@ -1,8 +1,10 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class FavoritesPage : ContentPage public partial class FavoritesPage : ContentPage
{ {
public FavoritesPage() public FavoritesPage(Account account, UserNotifier notifier)
{ {
InitializeComponent(); InitializeComponent();
} }

@ -13,16 +13,14 @@
JustifyContent="SpaceBetween" JustifyContent="SpaceBetween"
AlignItems="Center" AlignItems="Center"
AlignContent="Center" AlignContent="Center"
Margin="20,35,20,20" Margin="20,35,20,20">
>
<Border <Border
Style="{StaticResource SecondaryBorder}" Style="{StaticResource SecondaryBorder}"
BackgroundColor="{StaticResource BackgroundSecondary}" BackgroundColor="{StaticResource BackgroundSecondary}"
StrokeShape="RoundRectangle 1500" StrokeShape="RoundRectangle 1500">
>
<ImageButton <ImageButton
Source="default_profile_picture.png" x:Name="ProfilePictureImage"
WidthRequest="65" WidthRequest="65"
HeightRequest="65"/> HeightRequest="65"/>
</Border> </Border>

@ -1,10 +1,13 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class HomePage : ContentPage public partial class HomePage : ContentPage
{ {
public HomePage() public HomePage(Account account, UserNotifier notifier)
{ {
InitializeComponent(); InitializeComponent();
ProfilePictureImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
} }
private async void OnSyncButtonClicked(object sender, EventArgs e) private async void OnSyncButtonClicked(object sender, EventArgs e)
{ {

@ -1,16 +1,15 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class MorePage : ContentPage public partial class MorePage : ContentPage
{ {
public MorePage(): this("Adom Shafi", ImageSource.FromFile("default_profile_picture.png"))
{
}
public MorePage(string userName, ImageSource userImage) public MorePage(Account account, UserNotifier notifier)
{ {
InitializeComponent(); InitializeComponent();
ProfileImage.Source = userImage; ProfileImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
ProfileName.Text = userName; ProfileName.Text = account.User.Name;
} }
private async void OnMyRecipesButtonTapped(object sender, EventArgs e) private async void OnMyRecipesButtonTapped(object sender, EventArgs e)
{ {

@ -1,8 +1,10 @@
using Models;
namespace ShoopNCook.Pages; namespace ShoopNCook.Pages;
public partial class MyListPage : ContentPage public partial class MyListPage : ContentPage
{ {
public MyListPage() public MyListPage(Account account, UserNotifier notifier)
{ {
InitializeComponent(); InitializeComponent();
} }

Loading…
Cancel
Save