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 0000000..507636c Binary files /dev/null and b/Resources/Images/order_receiving_end.png differ diff --git a/Resources/Images/order_receiving_start.png b/Resources/Images/order_receiving_start.png new file mode 100644 index 0000000..73efa58 Binary files /dev/null and b/Resources/Images/order_receiving_start.png differ 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