🐛 fix the is-user-connected binder + end review code. close #12

pull/20/head
Alexandre Agostinho 2 years ago
parent 0e8b12077d
commit 63c749fcfc

@ -28,11 +28,10 @@ namespace Views
#endif #endif
}); });
MainPage = new Home();
/* - Comment(ctrl-k + ctrl-c)/Uncomment(ctrl-k + ctrl-u) to change page - */
Application.Current.UserAppTheme = AppTheme.Dark; MainPage = new Home();
//MainPage = new MyPosts();
} }
} }
} }

@ -29,7 +29,7 @@ public partial class ContainerBase : ContentView
// Bind IsNotConnected // Bind IsNotConnected
public static readonly BindableProperty IsNotConnectedProperty = public static readonly BindableProperty IsNotConnectedProperty =
BindableProperty.Create("IsNotConnected", typeof(bool), typeof(Button), false); BindableProperty.Create("IsNotConnected", typeof(bool), typeof(Button), true);
public bool IsNotConnected public bool IsNotConnected
{ {

@ -2,6 +2,7 @@
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Views" xmlns:local="clr-namespace:Views"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="Views.ContainerFlyout" x:Class="Views.ContainerFlyout"
x:Name="fl" x:Name="fl"
BackgroundColor="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Gray600}}"> BackgroundColor="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Gray600}}">
@ -30,8 +31,8 @@
<Label Text="Jean-Baptiste De La Fontaine" <Label Text="Jean-Baptiste De La Fontaine"
HorizontalOptions="Center" Margin="15" HorizontalOptions="Center" Margin="15"
FontSize="20" FontAttributes="Bold" HorizontalTextAlignment="Center" FontSize="20" FontAttributes="Bold" HorizontalTextAlignment="Center"
IsVisible="{Binding IsConnected, Source={x:Reference fl}}" TextColor="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}"
IsEnabled="{Binding IsConnected, Source={x:Reference fl}}"/> IsVisible="{Binding IsNotConnected, Converter={toolkit:InvertedBoolConverter} ,Source={x:Reference fl}}"/>
</VerticalStackLayout> </VerticalStackLayout>
@ -46,7 +47,7 @@
<!-- Footer --> <!-- Footer -->
<Button Text="Déconnection" ImageSource="logout_icon.png" <Button Text="Déconnection" ImageSource="logout_icon.png"
Style="{StaticResource button2}" Style="{StaticResource button2}"
IsVisible="{Binding IsConnected, Source={x:Reference fl}}"/> IsVisible="{Binding IsNotConnected, Converter={toolkit:InvertedBoolConverter}, Source={x:Reference fl}}"/>
</VerticalStackLayout> </VerticalStackLayout>
</Grid> </Grid>

@ -19,18 +19,13 @@ public partial class ContainerFlyout : ContentView
// Bind IsNotConnected // Bind IsNotConnected
public static readonly BindableProperty IsNotConnectedProperty = public static readonly BindableProperty IsNotConnectedProperty =
BindableProperty.Create("IsNotConnected", typeof(bool), typeof(Button), false); BindableProperty.Create("IsNotConnected", typeof(bool), typeof(Button), true);
public bool IsNotConnected public bool IsNotConnected
{ {
get => (bool)GetValue(IsNotConnectedProperty); get => (bool)GetValue(IsNotConnectedProperty);
set => SetValue(IsNotConnectedProperty, value); set => SetValue(IsNotConnectedProperty, value);
} }
public bool IsConnected
{
get => !(bool)GetValue(IsNotConnectedProperty);
set => SetValue(IsNotConnectedProperty, !value);
}
// bind NeedReturn // bind NeedReturn
public static readonly BindableProperty NeedReturnProperty = public static readonly BindableProperty NeedReturnProperty =

@ -5,7 +5,8 @@
xmlns:local="clr-namespace:Views" xmlns:local="clr-namespace:Views"
x:Class="Views.Home"> x:Class="Views.Home">
<local:ContainerBase> <local:ContainerBase
IsNotConnected="True">
<!-- Flyout --> <!-- Flyout -->
<local:ContainerBase.MyFlyoutContent> <local:ContainerBase.MyFlyoutContent>
@ -14,7 +15,7 @@
<Button Text="Recherche" ImageSource="search_icon.png" <Button Text="Recherche" ImageSource="search_icon.png"
MaximumHeightRequest="20" MaximumHeightRequest="20"
Style="{StaticResource button1}"/> Style="{StaticResource button1}"/>
<SearchBar Placeholder="Mots-clés (ex.: rapide, fromage)" FontAttributes="Italic" <SearchBar Placeholder="Mots-clés (ex.: rapide, fromage)" FontAttributes="Italic" TextColor="Black"
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}" BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray300}}"
Margin="15, 10, 15, 40"/> Margin="15, 10, 15, 40"/>

@ -3,8 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Views" xmlns:local="clr-namespace:Views"
x:Class="Views.MyPosts" x:Class="Views.MyPosts"
Title="MyPosts" Title="MyPosts">
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray500}}">
<local:ContainerBase <local:ContainerBase
IsNotConnected="False" IsNotConnected="False"

Loading…
Cancel
Save