123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- using Avalonia;
- using Avalonia.Controls;
- using Avalonia.Controls.Shapes;
- using Avalonia.Interactivity;
- using Avalonia.Layout;
- using Avalonia.Markup.Xaml;
- using Avalonia.Media;
- using Culusas;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection.Metadata;
- using System.Security.Claims;
- using System.Text;
- using System.Threading.Tasks;
- using static System.Net.Mime.MediaTypeNames;
- using System.Xml.Linq;
- using System.Drawing.Imaging;
- using System.Drawing;
- using Culusas.Views;
- using ReactiveUI;
- using Avalonia.Threading;
- using Culusas.Models;
- using System.Runtime.Intrinsics.Arm;
- using WECPOFLogic;
- namespace Culusas.ViewModels
- {
- public class AutorizahonPagesViewModel : ReactiveObject
- {
- private string Log;
- private string Pass;
- private Canvas Chap;
- private bool Dip = true;
- private bool Visibility = false;
- private string CapHa;
- public string Password
- {
- get => Pass;
- set => this.RaiseAndSetIfChanged(ref Pass, value);
- }
- public string Login
- {
- get => Log;
- set => this.RaiseAndSetIfChanged(ref Log, value);
- }
- public Canvas Caph
- {
- get => Chap;
- set => this.RaiseAndSetIfChanged(ref Chap, value);
- }
- public bool Dilai
- {
- get => Dip;
- set => this.RaiseAndSetIfChanged(ref Dip, value);
- }
- private bool Prosmotr = false;
- public bool Visibilitys
- {
- get => Prosmotr;
- set => this.RaiseAndSetIfChanged(ref Prosmotr, value);
- }
- public string CaphaText
- {
- get => CapHa;
- set => this.RaiseAndSetIfChanged(ref CapHa, value);
- }
- private void Parah(object? sender, EventArgs e)
- {
- Dilai = true;
- Visibilitys = true;
- }
- public bool NextCulucu()
- {
- if (!Visibilitys)
- {
- if (Log == UserBD.Logi && Pass == UserBD.Pass)
- {
- // var box = MessageBoxManager
- //.GetMessageBoxStandard("Вход", "Вы вошли");
- // box.ShowAsync();
- return true;
- }
- else
- {
- // var box = MessageBoxManager
- //.GetMessageBoxStandard("Вход", "Введите правельные данные");
- // box.ShowAsync();
- Visibility = true;
- CaphaCreate();
- return false;
- }
- }
- else
- {
- if (Log == UserBD.Logi && Pass == UserBD.Pass && CapHa.ToUpper() == UserBD.Cupch)
- {
- //var box = MessageBoxManager.GetMessageBoxStandard("Вход", "Вы вошли");
- //box.ShowAsync();
- return true;
- }
- else
- {
- Login = "";
- Password = "";
- CaphaText = "";
- Dilai = false;
- Visibility = false;
- // var box = MessageBoxManager
- //.GetMessageBoxStandard("Вход", "Вы не правильно заполнили поля, они заблокированы на 10 секунд");
- // box.ShowAsync();
- disTaim.Tick += new EventHandler(Parah);
- disTaim.Interval = new TimeSpan(0, 0, 10);
- disTaim.Start();
- return false;
- }
- }
- }
- public DispatcherTimer disTaim = new DispatcherTimer();
- bool ZcanTM = true;
- public bool ConechTM
- {
- get => ZcanTM;
- set => this.RaiseAndSetIfChanged(ref ZcanTM, value);
- }
- bool TimEye = false;
- public bool TimersEye
- {
- get => TimEye;
- set => this.RaiseAndSetIfChanged(ref TimEye, value);
- }
- //public void VisibleED(object? sender, EventArgs e)
- //{
- // VisabilityBD = true;
- // ConechTM = true;
- //}
- //public void Taimers()
- //{
- // disTaim.Tick += new EventHandler(VisibleED);
- // disTaim.Interval = new TimeSpan(0, 0, 10);
- // disTaim.Start();
- // VisabilityBD = false;
- // ConechTM = false;
- // TimersEye = true;
- // AutorixVM.Login = " ";
- // AutorixVM.Password = " ";
- //}
- //Canvas can;
- //public Canvas Can
- //{
- // get => can;
- // set => this.RaiseAndSetIfChanged(ref can, value);
- //}
- //bool visa = false;
- //public bool VisabilityBD
- //{
- // get => visa;
- // set => this.RaiseAndSetIfChanged(ref visa, value);
- //}
- public void CaphaCreate()
- {
- UserBD.Cupch = "";
- SolidColorBrush color = new SolidColorBrush(Colors.Yellow);
- Canvas canava = new Canvas()
- {
- Width = 200,
- Height = 200,
- Background = color,
- Margin = new Thickness(0, 10, 0, 0)
- };
- Random r = new Random();
- int fs;
- Avalonia.Media.FontStyle fontStyle = Avalonia.Media.FontStyle.Normal;
- FontWeight fontWeight = FontWeight.Normal;
- for (int i = 1; i <= 10; i++)
- {
- fs = r.Next(1, 3);
- if (fs == 1)
- {
- fontStyle = Avalonia.Media.FontStyle.Oblique;
- }
- if (fs == 2)
- {
- fontWeight = FontWeight.Bold;
- }
- if (fs == 3)
- {
- fontWeight = FontWeight.Bold;
- fontStyle = Avalonia.Media.FontStyle.Italic;
- }
- TextBlock tb = new TextBlock()
- {
- Padding = new Thickness(i * 19, r.Next(100), 0, r.Next(100)),
- Foreground = new SolidColorBrush(Colors.LimeGreen),
- FontStyle = fontStyle,
- FontWeight = fontWeight
- };
- if (i % 2 == 0)
- {
- tb.Text = Convert.ToString((char)r.Next(65, 90));
- }
- else
- {
- tb.Text = Convert.ToString(r.Next(1, 9));
- }
- UserBD.Cupch += tb.Text;
- canava.Children.Add(tb);
- Line line = new Line()
- {
- StartPoint = new Avalonia.Point(r.Next(200), r.Next(200)),
- EndPoint = new Avalonia.Point(r.Next(200), r.Next(200)),
- Stroke = Avalonia.Media.Brushes.Red,
- StrokeThickness = 3
- };
- canava.Children.Add(line);
- }
- Chap = canava;
- }
- }
- }
-
-
-
-
-
|