From aad65b63c6ff4ff7abc133e9c2099a20487798be Mon Sep 17 00:00:00 2001 From: zhuce <821293938@qq.com> Date: Fri, 29 Dec 2023 17:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.xaml | 2 ++ App.xaml.cs | 8 ++++-- Converters/BoolNegationConverter.cs | 21 ++++++++++++++++ MauiProgram.cs | 3 ++- Resources/Images/order_receiving_end.png | Bin 0 -> 5191 bytes Resources/Images/order_receiving_start.png | Bin 0 -> 4911 bytes ViewModels/HomeViewModel.cs | 15 +++++++++++ ViewModels/LoginViewModel.cs | 19 +++++++++++--- Views/HomeView.xaml | 28 +++++++++++++++++++++ Views/HomeView.xaml.cs | 19 ++++++++++++++ 10 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 Converters/BoolNegationConverter.cs create mode 100644 Resources/Images/order_receiving_end.png create mode 100644 Resources/Images/order_receiving_start.png create mode 100644 ViewModels/HomeViewModel.cs create mode 100644 Views/HomeView.xaml create mode 100644 Views/HomeView.xaml.cs diff --git a/App.xaml b/App.xaml index 30adc2c..ccdc506 100644 --- a/App.xaml +++ b/App.xaml @@ -2,6 +2,7 @@ @@ -9,6 +10,7 @@ + diff --git a/App.xaml.cs b/App.xaml.cs index 8c7be9e..2b0f2d1 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,4 +1,6 @@ -namespace autosos_maui; +using autosos_maui.Views; + +namespace autosos_maui; public partial class App : Application { @@ -7,5 +9,7 @@ public partial class App : Application InitializeComponent(); MainPage = new AppShell(); + + Routing.RegisterRoute("HomeView",typeof(HomeView)); } -} \ No newline at end of file +} diff --git a/Converters/BoolNegationConverter.cs b/Converters/BoolNegationConverter.cs new file mode 100644 index 0000000..e9758ca --- /dev/null +++ b/Converters/BoolNegationConverter.cs @@ -0,0 +1,21 @@ +using System.Globalization; + +namespace autosos_maui.Converters; + +public class BoolNegationConverter: IValueConverter +{ + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is bool boolValue) + { + return !boolValue; // 返回布尔值的相反值 + } + + return value; // 返回原始值(或者你可以返回默认的可见性) + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/MauiProgram.cs b/MauiProgram.cs index ce1540f..94e0ba6 100644 --- a/MauiProgram.cs +++ b/MauiProgram.cs @@ -32,6 +32,7 @@ public static class MauiProgram public static MauiAppBuilder RegisterViews(this MauiAppBuilder mauiAppBuilder) { mauiAppBuilder.Services.AddTransient(); + mauiAppBuilder.Services.AddTransient(); return mauiAppBuilder; } @@ -39,7 +40,7 @@ public static class MauiProgram public static MauiAppBuilder RegisterViewModels(this MauiAppBuilder mauiAppBuilder) { mauiAppBuilder.Services.AddSingleton(); - + mauiAppBuilder.Services.AddSingleton(); return mauiAppBuilder; } diff --git a/Resources/Images/order_receiving_end.png b/Resources/Images/order_receiving_end.png new file mode 100644 index 0000000000000000000000000000000000000000..507636c5a808065053305328d325b5605fcc9035 GIT binary patch literal 5191 zcmV-N6u9e&P)Px}0ZBwbRCr$1T?up?)s=nk_ae!XSsWWo2oQ#lNpL0}W|ZLA>aHp+$k;exH6$#V zkPL>vgf+lG0JCp_F$n}r2pKYvVGIn5gR!urs%i;iKtRl3U?2n%Fkm1ySQ1h%^MD<#0VdgiOxl2U;S493yM1Rm) z_k%%ob#~FHzR<@Xf4mbBwTsB9BJy=+PKn4?|7dm+(V9>w^xWLJ zb8&3PMQhittxG18`x8-{h_pgnF!K%~5@hD5nE56m>X9mSqi8VnG2~0|Unp(YZvlhc5>o5s}+G&wIM1rR9BQ*5zJAuJJ@fb#-;k z2!%qkMdZ6g^i3iP6VaPQbWKA;!`+RIjgZY{p|UX3w(Vdj6xt<~O5H+43yCN}M86l2 zOHI@4U}h=H(~fTtwrzVhGhaYN2N4l0ghztG;K|8k@;%G4pv1;S<7Q@0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u6l2q!w-T+n3wG~~Nd8?FLfAnb9hofFfGCpe!`(IV@ zzimO@`V;8rc)k)<{Jji{Xp~g!V*~BL|F(rs_IeJkOWpW!tX%m~CAM@JxK#r)4_Hog z$Pj*Gg2hreS(Z=aMA<)A$m8CpXI%Ghz5eQoVeIOC3WqNZ@I?z>m@1tTPrxwl#g;9< zt;7o}wK{78W*)E<0jm7g#6fV~gCMe(S4+uXL4Exm5bt{js&B(En5X^{L|(1NR<8PK zUh0j7{q7Y}S+Qcc_oXV;z4N|QCBiISGJ=`D!hgGfrVdC=f$4tCOaJssRU&VCU#i-1 h$BmWvPDNkl^bcE^x|Zqk92fuq002ovPDHLkV1oPeT~Yu5 literal 0 HcmV?d00001 diff --git a/ViewModels/HomeViewModel.cs b/ViewModels/HomeViewModel.cs new file mode 100644 index 0000000..2936c0b --- /dev/null +++ b/ViewModels/HomeViewModel.cs @@ -0,0 +1,15 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace autosos_maui.ViewModels; + +public partial class HomeViewModel: ObservableObject +{ + private bool _isToggled = false; + + public bool IsToggled + { + get => _isToggled; + set => SetProperty(ref _isToggled, value); + } + +} \ No newline at end of file diff --git a/ViewModels/LoginViewModel.cs b/ViewModels/LoginViewModel.cs index 33ae16a..118d6c6 100644 --- a/ViewModels/LoginViewModel.cs +++ b/ViewModels/LoginViewModel.cs @@ -6,13 +6,26 @@ namespace autosos_maui.ViewModels; public partial class LoginViewModel : ObservableObject { - [ObservableProperty] private string _userName = ""; - [ObservableProperty] private string _password = ""; + private string _userName = ""; + private string _password = ""; + + public string UserName + { + get => _userName; + set => SetProperty(ref _userName, value); + } + + public string Password + { + get => _password; + set => SetProperty(ref _password, value); + } [RelayCommand] public void Login() { Debug.WriteLine("login"); - Debug.WriteLine("username:{0},password:{1}",_userName,_password); + Debug.WriteLine("username:{0},password:{1}", UserName, Password); + Shell.Current.GoToAsync("HomeView"); } } \ No newline at end of file diff --git a/Views/HomeView.xaml b/Views/HomeView.xaml new file mode 100644 index 0000000..8c11e32 --- /dev/null +++ b/Views/HomeView.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Views/HomeView.xaml.cs b/Views/HomeView.xaml.cs new file mode 100644 index 0000000..189bfb1 --- /dev/null +++ b/Views/HomeView.xaml.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using autosos_maui.ViewModels; + +namespace autosos_maui.Views; + +public partial class HomeView : ContentPage +{ + private readonly HomeViewModel _homeViewModel; + + public HomeView(HomeViewModel homeViewModel) + { + BindingContext = _homeViewModel = homeViewModel; + InitializeComponent(); + } +} \ No newline at end of file