ГаряевСА 1 сар өмнө
parent
commit
6f5410d8dd

+ 17 - 0
Captcha/Models/ModelClass.cs

@@ -10,8 +10,25 @@ namespace Captcha.Models
     {
         static string _login = "timan_cool";
         static string _password = "10082005";
+        public static List<string> _arithmetic = new List<string>
+        {
+            "Сложение",
+            "Вычитание",
+            "Умножение",
+            "Деление"
+        };
 
         public static string Login { get => _login; set => _login = value; }
         public static string Password { get => _password; set => _password = value; }
+
+
+
+
+
+        
+
+
+
+
     }
 }

+ 1 - 3
Captcha/ViewModels/Page1VM.cs

@@ -135,9 +135,7 @@ namespace Captcha.ViewModels
         {
             if (login == ModelClass.Login && password == ModelClass.Password && itCaptcha == strCaptcha)
             {
-                Message = "Авторизация прошла успешно";
-                StackVis = false;
-
+                ToPageCalculate();
             }
             else
             {

+ 35 - 1
Captcha/ViewModels/PageCalculateVM.cs

@@ -1,5 +1,8 @@
-using System;
+using Captcha.Models;
+using ReactiveUI;
+using System;
 using System.Collections.Generic;
+using System.IO.Pipelines;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -8,6 +11,37 @@ namespace Captcha.ViewModels
 {
     internal class PageCalculateVM : ViewModelBase
     {
+        List<string> _arif = ModelClass._arithmetic;
 
+        float _a, _b, _result = 0;
+
+        char _c = ' ';
+
+        public List<string> Arif { get => _arif; set => _arif = value; }
+        public float A { get => _a; set => _a = value; }
+        public float B { get => _b; set => _b = value; }
+        public char C { get => _c; set => _c = value; }
+        public float Result { get => _result; set => this.RaiseAndSetIfChanged(ref _result, value); }
+        void Сalculation()
+        {
+            int index = 0;
+            switch (index)
+            {
+                case 0:
+                    _result = A + B;
+                    break;
+                case 1:
+                    _result = A - B;
+                    break;
+                case 2:
+                    _result = A * B;
+                    break;
+                case 3:
+                    _result = A / B;
+                    break;
+                default:
+                    break;
+            }
+        }
     }
 }

+ 25 - 2
Captcha/Views/PageCalculate.axaml

@@ -4,7 +4,30 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         xmlns:vm="using:Captcha.ViewModels"
 			 mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
-                        x:DataType="vm:MainWindowViewModel"
+                        x:DataType="vm:PageCalculateVM"
 			 x:Class="Captcha.PageCalculate">
-  Welcome to Avalonia!
+	<StackPanel HorizontalAlignment="Center" Name="Login" Margin="20">
+			<Border Classes = "trash" Padding="40">
+				<StackPanel >
+					<StackPanel>
+						<TextBlock Margin="0,0,0,20" >
+							Выберете арифметическую операцию:
+						</TextBlock>
+						<ComboBox Margin="0,0,0,20" HorizontalAlignment = "Center" ItemsSource="{Binding Arif}" SelectedItem="{Binding SelIt}"></ComboBox>
+					</StackPanel>
+					<StackPanel HorizontalAlignment = "Center" Orientation="Horizontal">
+						<TextBox Text="{Binding A}" Margin="0,0,20,20"></TextBox>
+						<TextBlock Text="{Binding C}" Margin="0,0,20,20"></TextBlock>
+						<TextBox Text="{Binding B}" Margin="0,0,0,20"></TextBox>
+					</StackPanel>
+					<StackPanel>
+						<Button HorizontalAlignment = "Center" Margin="0,0,0,20" Content="Вычислить"/>
+						<StackPanel Orientation="Horizontal">
+							<TextBlock Text="Результат: " Margin="0,0,0,20"></TextBlock>
+							<TextBlock Text="{Binding Result}" Margin="0,0,0,20"></TextBlock>
+						</StackPanel>
+					</StackPanel>					
+				</StackPanel>
+			</Border>
+		</StackPanel>
 </UserControl>