Katya 5 months ago
parent
commit
13f1f7937b

+ 4 - 4
ViewModels/MainWindowViewModel.cs

@@ -20,11 +20,11 @@ namespace YtYtAvalonia.ViewModels
 #pragma warning restore CA1822 // Mark members as static
         public string Greeting => "Welcome to Avalonia!";
 
-//        public UserControl Login { get => login; set => this.RaiseAndSetIfChanged(ref login, value); }
-//#pragma warning restore CA1822 // Mark members as static
+        public UserControl UC { get => uc; set => this.RaiseAndSetIfChanged(ref uc, value); }
+#pragma warning restore CA1822 // Mark members as static
 
-//        private UserControl login = new LoginView();
+        private UserControl uc = new LoginView();
 
-//        public void LoadLoginView() => Login = new LoginView();
+        public void LoadRegistrationView() => UC = new RegistrationView();
     }
 }

+ 4 - 4
ViewModels/RegistrationViewModel.cs

@@ -33,10 +33,10 @@ namespace YtYtAvalonia.ViewModels
         User currentUser;
         public RegistrationViewModel(SuharevaContext myConnection)
         {
-            this.myConnection = myConnection;
-            CurrentUser = new User();
-            myConnection.Add(CurrentUser);
-            myConnection.SaveChanges();
+            //this.myConnection = myConnection;
+            //CurrentUser = new User();
+            //myConnection.Add(CurrentUser);
+            //myConnection.SaveChanges();
         }
 
         public User CurrentUser { get => currentUser; set => currentUser = value; }

+ 1 - 0
Views/LoginView.axaml

@@ -1,6 +1,7 @@
 <UserControl xmlns="https://github.com/avaloniaui"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+			 xmlns:vm="using:YtYtAvalonia.ViewModels"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
              x:Class="YtYtAvalonia.View.LoginView">

+ 0 - 2
Views/RegistrationView.axaml

@@ -1,9 +1,7 @@
 <UserControl xmlns="https://github.com/avaloniaui"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-			 xmlns:vm="using:YtYtAvalonia.ViewModels"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
 			 xmlns:vm="using:YtYtAvalonia.ViewModels"
 			 x:DataType="vm:MainWindowViewModel"
              mc:Ignorable="d" d:DesignWidth="1920" d:DesignHeight="1080"