ソースを参照

Исправлена ошибка с записью

Fox 6 ヶ月 前
コミット
3b1480fad1
3 ファイル変更26 行追加2 行削除
  1. BIN
      Assets/logo.ico
  2. 3 1
      Views/GeneratePage.axaml
  3. 23 1
      Views/GeneratePage.axaml.cs

BIN
Assets/logo.ico


+ 3 - 1
Views/GeneratePage.axaml

@@ -8,7 +8,7 @@
 			       x:DataType="vm:MainWindowViewModel"
              >
 
-  <StackPanel  VerticalAlignment="Center">
+  <StackPanel  VerticalAlignment="Center" Background="{Binding }">
     <TextBlock FontSize="24" FontWeight="Bold" HorizontalAlignment="Center">АССИСТЕНТ РЕГИСТРАЦИИ</TextBlock>
     <StackPanel>
       <TextBox Width="700" Watermark="Введите ФИО" Name="FIO"/>
@@ -40,6 +40,8 @@
       <StackPanel Margin="0 10 0 0" HorizontalAlignment="Center">
         <Button Width="700" HorizontalContentAlignment="Center" FontWeight="Bold" BorderBrush="Black" Background="White" Foreground="#545454" Content="Посмотреть данные пользователей" Command="{Binding ViewUsersData}"/>
       </StackPanel>
+      
+      <Button Content="Тёмная тема" Click=""/>
     </StackPanel>
    
     

+ 23 - 1
Views/GeneratePage.axaml.cs

@@ -5,10 +5,16 @@ using Avalonia.Interactivity;
 using Avalonia.Markup.Xaml;
 using MsBox.Avalonia;
 using System;
+using System.Windows;
+using System.Text;
 using System.IO;
 using LoginGenerator.Models;
 using System.Collections.Generic;
 using System.Linq;
+using System.Drawing.Imaging;
+using Avalonia.Input;
+using Avalonia.Media;
+using System.Drawing;
 
 namespace LoginGenerator;
 
@@ -23,6 +29,15 @@ public partial class GeneratePage : UserControl
         InitializeComponent();
     }
 
+    private SolidColorBrush background = new SolidColorBrush(Avalonia.Media.Color.FromRgb(255,255,255));
+
+    public SolidColorBrush MyProperty
+    {
+        get { return background; }
+        set { background = value; }
+    }
+
+
     private void CopyAll_Click(object sender, RoutedEventArgs e)
     {
         IClipboard Clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
@@ -49,6 +64,7 @@ public partial class GeneratePage : UserControl
             {
                 var box = MessageBoxManager.GetMessageBoxStandard("Îøèáêà", "Ïîëüçîâàòåëü ñ òàêèì ëîãèíîì óæå ñóùåñòâóåò");
                 box.ShowAsync();
+                return;
             }
             DateTime dateTime = DateTime.Now;
             File.AppendAllText(FilePath.PATH, $"{FIO.Text} {Login.Text} {Pass.Text} {dateTime.ToShortDateString()}\n");
@@ -258,7 +274,8 @@ public partial class GeneratePage : UserControl
                 newUsers.Add(u);
             }
         }
-        if(newUsers.Where(x=>x.Login == Login.Text).First()==null)
+        Users? maybeNew = newUsers.Where(x => x.Login == Login.Text).FirstOrDefault();
+        if (maybeNew == null)
         {
             return true;
         }
@@ -280,4 +297,9 @@ public partial class GeneratePage : UserControl
             return true;
         }
     }
+
+    private void SwitchTheme(object sender, RoutedEventArgs e)
+    {
+        
+    }
 }