feat: add login window

This commit is contained in:
Иван Овсянников 2024-09-04 12:08:53 +03:00
parent c7dc215c06
commit 008059e590
35 changed files with 280 additions and 14 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3,12 +3,24 @@
"WorkspaceRootPath": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\servicewindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:servicewindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\servicewindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:servicewindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\colors.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:colors.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@ -23,6 +35,52 @@
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ServiceWindow.axaml",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml",
"RelativeDocumentMoniker": "ServiceWindow.axaml",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml",
"RelativeToolTip": "ServiceWindow.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-09-04T09:01:06.796Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "ServiceWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml.cs",
"RelativeDocumentMoniker": "ServiceWindow.axaml.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml.cs",
"RelativeToolTip": "ServiceWindow.axaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T09:01:06.344Z",
"EditorCaption": ""
}
]
}
]
},
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"FloatingWindowState": {
"Id": "5d89f0c1-b63e-4cca-bbc9-915882977650",
"Display": 1,
"X": -8,
"Y": 331,
"Width": 1907,
"Height": 727,
"WindowState": 2
},
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "MainWindow.axaml",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml",
"RelativeDocumentMoniker": "MainWindow.axaml",
@ -34,16 +92,29 @@
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 2,
"Title": "MainWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml.cs",
"RelativeDocumentMoniker": "MainWindow.axaml.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml.cs",
"RelativeToolTip": "MainWindow.axaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAC8AAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T07:02:41.443Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "Colors.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\Colors.cs",
"RelativeDocumentMoniker": "Colors.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\Colors.cs",
"RelativeToolTip": "Colors.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T07:42:06.694Z",
"EditorCaption": ""
}
]
}

View File

@ -3,12 +3,24 @@
"WorkspaceRootPath": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\servicewindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:servicewindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\servicewindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:servicewindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:mainwindow.axaml||{6D5344A2-2FCD-49DE-A09D-6A14FD1B1224}"
},
{
"AbsoluteMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|c:\\users\\profi\\desktop\\xofei\\demoservice\\colors.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{4C331754-91EE-4598-950D-54DF0C075B84}|DemoService.csproj|solutionrelative:colors.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@ -23,6 +35,52 @@
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "ServiceWindow.axaml",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml",
"RelativeDocumentMoniker": "ServiceWindow.axaml",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml",
"RelativeToolTip": "ServiceWindow.axaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-09-04T09:01:06.796Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "ServiceWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml.cs",
"RelativeDocumentMoniker": "ServiceWindow.axaml.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\ServiceWindow.axaml.cs",
"RelativeToolTip": "ServiceWindow.axaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T09:01:06.344Z",
"EditorCaption": ""
}
]
}
]
},
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"FloatingWindowState": {
"Id": "5d89f0c1-b63e-4cca-bbc9-915882977650",
"Display": 1,
"X": -8,
"Y": 331,
"Width": 1907,
"Height": 727,
"WindowState": 2
},
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "MainWindow.axaml",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml",
"RelativeDocumentMoniker": "MainWindow.axaml",
@ -34,16 +92,29 @@
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 2,
"Title": "MainWindow.axaml.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml.cs",
"RelativeDocumentMoniker": "MainWindow.axaml.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\MainWindow.axaml.cs",
"RelativeToolTip": "MainWindow.axaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAC8AAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T07:02:41.443Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "Colors.cs",
"DocumentMoniker": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\Colors.cs",
"RelativeDocumentMoniker": "Colors.cs",
"ToolTip": "C:\\Users\\PROFI\\Desktop\\Xofei\\DemoService\\Colors.cs",
"RelativeToolTip": "Colors.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-09-04T07:42:06.694Z",
"EditorCaption": ""
}
]
}

17
Colors.cs Normal file
View File

@ -0,0 +1,17 @@
using Avalonia.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DemoService
{
internal class Colors
{
public static SolidColorBrush white = new(Color.FromRgb(255, 255, 255));
public static SolidColorBrush lightYellow = new(Color.FromRgb(255, 255, 225));
public static SolidColorBrush orange = new(Color.FromRgb(255, 156, 26));
public static SolidColorBrush red = new(Color.FromRgb(255, 0, 0));
}
}

View File

@ -2,7 +2,48 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
x:Class="DemoService.MainWindow"
Title="DemoService">
Title="Сервис «Подай на 16»"
WindowStartupLocation="CenterScreen"
Width="800" Height="600">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center"
Margin="0 0 0 50"
FontSize="40"
FontWeight="DemiBold">
Подай на 16
</TextBlock>
<Button Name="UserButton"
Click="UserLogIn"
HorizontalAlignment="Center"
Margin="0 0 0 30">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center">
Войти как пользователь
</TextBlock>
</Button>
<TextBlock Name="PasswordError"
HorizontalAlignment="Center"
Margin="0 0 0 10"
Foreground="Red">
Неверный код
</TextBlock>
<TextBox Name="Password"
Watermark="Код администратора"
HorizontalAlignment="Center"
Width="200"
Margin="0 0 0 5"/>
<Button Name="AdminButton"
Click="AdminLogIn"
HorizontalAlignment="Center"
Width="200">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center">
Войти как администратор
</TextBlock>
</Button>
</StackPanel>
</Window>

View File

@ -1,12 +1,48 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace DemoService
{
public partial class MainWindow : Window
{
private readonly string adminCode = "0000";
public MainWindow()
{
InitializeComponent();
Background = Colors.white;
UserButton.Background = Colors.orange;
PasswordError.Foreground = Colors.white;
AdminButton.Background = Colors.orange;
}
public void UserLogIn(object sender, RoutedEventArgs args)
{
ServiceWindow serviceWindow = new(false);
serviceWindow.Show();
Close();
}
public void AdminLogIn(object sender, RoutedEventArgs args)
{
if (PasswordCheck(Password.Text))
{
ServiceWindow serviceWindow = new(true);
serviceWindow.Show();
Close();
}
else
{
PasswordError.Foreground = Colors.red;
}
}
public bool PasswordCheck(string? password)
{
if (password == adminCode)
{
return true;
}
else
{
return false;
}
}
}
}

8
ServiceWindow.axaml Normal file
View File

@ -0,0 +1,8 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
x:Class="DemoService.ServiceWindow"
Title="ServiceWindow">
</Window>

19
ServiceWindow.axaml.cs Normal file
View File

@ -0,0 +1,19 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace DemoService;
public partial class ServiceWindow : Window
{
private readonly bool Admin;
public ServiceWindow()
{
InitializeComponent();
}
public ServiceWindow(bool admin)
{
InitializeComponent();
Admin = admin;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
57eedc95c6453df5d1b12bd930aca2e8960a0eb9374f8b26f19d6568102b733f
ebdbd69ee71690d5a277b51907ba79d1895737938826127021d29991e44d9527

Binary file not shown.

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DemoService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c7dc215c06b81b8f6e9383caa0145ec960da3502")]
[assembly: System.Reflection.AssemblyProductAttribute("DemoService")]
[assembly: System.Reflection.AssemblyTitleAttribute("DemoService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
51fb3378f50b1d2b1f909024dfc809a62aebd19b981c2c861e85b7d931cbad48
0ae32d03b87404d9214960bbb1dd3f16ad12a69a40c7fef303822a2df8feff01

View File

@ -22,3 +22,6 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/PROFI/Desktop/Xofei/DemoService/MainWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/PROFI/Desktop/Xofei/DemoService/ServiceWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml

View File

@ -1 +1 @@
bf56d1d2d7cb66d6fd79bdd3ff466fbb2ab50a87f55f354382d5187f6a479661
8e205a12ad6329e0398b6b1e069d72a39bb88a3e3f86e0e4a758440e4838af65

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.