three windows
This commit is contained in:
parent
3db87ed23d
commit
d823905d6c
BIN
demo15012025/.DS_Store
vendored
BIN
demo15012025/.DS_Store
vendored
Binary file not shown.
@ -7,7 +7,7 @@
|
|||||||
Title="Auth">
|
Title="Auth">
|
||||||
<DockPanel Background="Bisque">
|
<DockPanel Background="Bisque">
|
||||||
<StackPanel Spacing="5" HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel Spacing="5" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<TextBox x:Name="Email" Width="200" Watermark="login"/>
|
<TextBox x:Name="Id" Width="200" Watermark="id"/>
|
||||||
<TextBox x:Name="Password" Width="200" Watermark="password"/>
|
<TextBox x:Name="Password" Width="200" Watermark="password"/>
|
||||||
<Button Click="AuthButton_OnClick" Content="auth" Foreground="Black" Background="LightGray"/>
|
<Button Click="AuthButton_OnClick" Content="auth" Foreground="Black" Background="LightGray"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -13,20 +13,21 @@ public partial class Auth : Window
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var email = Email?.Text;
|
var idText = Id?.Text;
|
||||||
var password = Password?.Text;
|
var password = Password?.Text;
|
||||||
|
|
||||||
var client = MainWindow.ClientAuthList?.FirstOrDefault(it => it.Email == email);
|
if (int.TryParse(idText, out var id))
|
||||||
|
{
|
||||||
|
var client = MainWindow.ClientAuthList?.FirstOrDefault(it => it.Id == id);
|
||||||
|
|
||||||
if (client != null && client.Password == password)
|
if (client != null && client.Password == password)
|
||||||
{
|
{
|
||||||
Console.WriteLine("success");
|
Console.WriteLine("success");
|
||||||
if (client.Role == 1)
|
if (client.Role == 1)
|
||||||
{
|
{
|
||||||
OrganizatorWindow organizatorWindow = new OrganizatorWindow();
|
OrganizatorWindow organizatorWindow = new OrganizatorWindow(client);
|
||||||
organizatorWindow.ShowDialog(this);
|
organizatorWindow.ShowDialog(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,4 +36,9 @@ public partial class Auth : Window
|
|||||||
Console.WriteLine("wrong");
|
Console.WriteLine("wrong");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Invalid ID format");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -41,10 +41,11 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
dataSourceClient = context.Clients.Select(it => new ClientAuth
|
dataSourceClient = context.Clients.Select(it => new ClientAuth
|
||||||
{
|
{
|
||||||
Email = it.Email,
|
Id = it.Id,
|
||||||
Password = it.Password,
|
Password = it.Password,
|
||||||
Role = it.Role,
|
Role = it.Role,
|
||||||
FIO = it.Fio,
|
FIO = it.Fio,
|
||||||
|
PhotoPath = it.Photopath,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
DirectionsList = context.Directions.Select(it => it.Name).ToList();
|
DirectionsList = context.Directions.Select(it => it.Name).ToList();
|
||||||
|
@ -1,11 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Avalonia.Media.Imaging;
|
||||||
using demo15012025.Models;
|
using demo15012025.Models;
|
||||||
|
|
||||||
namespace demo15012025.ModelsMine;
|
namespace demo15012025.ModelsMine;
|
||||||
|
|
||||||
public class ClientAuth: Client
|
public class ClientAuth: Client
|
||||||
{
|
{
|
||||||
public string Email { get; set; } = null!;
|
public int Id { get; set; }
|
||||||
public string Password { get; set; } = null!;
|
public string Password { get; set; } = null!;
|
||||||
public int Role { get; set; }
|
public int Role { get; set; }
|
||||||
public string FIO { get; set; } = null!;
|
public string FIO { get; set; } = null!;
|
||||||
|
public string PhotoPath { get; set; } = null!;
|
||||||
|
public Bitmap? Image
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string absolutePath = Path.Combine(AppContext.BaseDirectory, PhotoPath);
|
||||||
|
return new Bitmap(absolutePath);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,17 +4,19 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
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="450"
|
||||||
x:Class="demo15012025.OrganizatorWindow"
|
x:Class="demo15012025.OrganizatorWindow"
|
||||||
x:CompileBindings="False"
|
|
||||||
Title="OrganizatorWindow">
|
Title="OrganizatorWindow">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Border DockPanel.Dock="Top" Background="Aqua" Height="50">
|
<Border DockPanel.Dock="Top" Background="Aqua" Height="50">
|
||||||
<TextBlock Text="Окно организатора" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
|
<TextBlock Text="Окно организатора" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<Border Background="BlanchedAlmond">
|
||||||
|
<Grid>
|
||||||
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
|
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
|
||||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250">
|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250">
|
||||||
<Image Width="150" Height="250"/>
|
<Image Width="150" Height="250" x:Name="imageOrg"/>
|
||||||
<Border BorderBrush="Gray" BorderThickness="1" Padding="5">
|
<Border BorderBrush="Gray" BorderThickness="1" Padding="5">
|
||||||
<TextBlock HorizontalAlignment="Center" Width="150" Height="50" FontSize="20" TextAlignment="Center" >
|
<TextBlock HorizontalAlignment="Center" Width="150" Height="50" FontSize="20" TextAlignment="Center" Foreground="Black">
|
||||||
<Run Text="Мой" />
|
<Run Text="Мой" />
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
<Run Text="профиль" />
|
<Run Text="профиль" />
|
||||||
@ -22,19 +24,23 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
|
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250" Spacing="15">
|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250" Spacing="15">
|
||||||
<!-- <TextBlock Text="{Binding output}"/> -->
|
<TextBlock x:Name="textHello" Foreground="Black" FontSize="16"/>
|
||||||
<Button x:Name="Button1" Height="80" Width="300" Click="_1Button_OnClick">
|
|
||||||
|
<Button x:Name="Button1" Height="80" Width="300" Background="Beige" Foreground="Black" BorderBrush="DarkGoldenrod" BorderThickness="2" Click="_1Button_OnClick">
|
||||||
<TextBlock Text="Мероприятия" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<TextBlock Text="Мероприятия" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="Button2" Height="80" Width="300" Click="_2Button_OnClick">
|
<Button x:Name="Button2" Height="80" Width="300" Background="Beige" Foreground="Black" BorderBrush="DarkGoldenrod" BorderThickness="2" Click="_2Button_OnClick">
|
||||||
<TextBlock Text="Участники" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<TextBlock Text="Участники" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="Button3" Height="80" Width="300" Click="_3Button_OnClick">
|
<Button x:Name="Button3" Height="80" Width="300" Background="Beige" Foreground="Black" BorderBrush="DarkGoldenrod" BorderThickness="2" Click="_3Button_OnClick">
|
||||||
<TextBlock Text="Жюри" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<TextBlock Text="Жюри" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Window>
|
</Window>
|
@ -3,31 +3,32 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using demo15012025.ModelsMine;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
||||||
|
|
||||||
namespace demo15012025;
|
namespace demo15012025;
|
||||||
|
|
||||||
public partial class OrganizatorWindow : Window
|
public partial class OrganizatorWindow : Window
|
||||||
{
|
{
|
||||||
|
private string _output;
|
||||||
public OrganizatorWindow()
|
public OrganizatorWindow(ClientAuth clientAuth)
|
||||||
{
|
{
|
||||||
var output = "";
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var bello = "";
|
||||||
DateTime currentTime = DateTime.Now;
|
DateTime currentTime = DateTime.Now;
|
||||||
if (currentTime.Hour > 9 && currentTime.Hour < 11)
|
if (currentTime.Hour > 9 && currentTime.Hour < 11)
|
||||||
{
|
{
|
||||||
output = "Доброе утро!\n";
|
bello = "Доброе утро!\n";
|
||||||
} else if (currentTime.Hour > 11 && currentTime.Hour < 18)
|
} else if (currentTime.Hour > 11 && currentTime.Hour < 18)
|
||||||
{
|
{
|
||||||
output = "Добрый день!\n";
|
bello = "Добрый день!\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = "Добрый вечер!\n";
|
bello = "Добрый вечер!\n";
|
||||||
}
|
}
|
||||||
|
textHello.Text = bello+clientAuth.FIO;
|
||||||
//todo передавай имя из прошлого окна ++ проблемы с output
|
imageOrg.Source = clientAuth.Image;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _3Button_OnClick(object? sender, RoutedEventArgs e)
|
private void _3Button_OnClick(object? sender, RoutedEventArgs e)
|
||||||
@ -38,7 +39,8 @@ public partial class OrganizatorWindow : Window
|
|||||||
|
|
||||||
private void _2Button_OnClick(object? sender, RoutedEventArgs e)
|
private void _2Button_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
Zaglushka zaglushka = new Zaglushka();
|
||||||
|
zaglushka.ShowDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _1Button_OnClick(object? sender, RoutedEventArgs e)
|
private void _1Button_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
9
demo15012025/Zaglushka.axaml
Normal file
9
demo15012025/Zaglushka.axaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="demo15012025.Zaglushka"
|
||||||
|
Title="Zaglushka">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</Window>
|
13
demo15012025/Zaglushka.axaml.cs
Normal file
13
demo15012025/Zaglushka.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace demo15012025;
|
||||||
|
|
||||||
|
public partial class Zaglushka : Window
|
||||||
|
{
|
||||||
|
public Zaglushka()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
BIN
demo15012025/bin/.DS_Store
vendored
BIN
demo15012025/bin/.DS_Store
vendored
Binary file not shown.
BIN
demo15012025/bin/Debug/.DS_Store
vendored
BIN
demo15012025/bin/Debug/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
6ba651331e2d52a468e8ce9a93040cd15b1ed1d04dc3b8bfd4b6f1066e860cec
|
6ca666c1542ca9238c67dd1a54ec89d3bccc3454bd741e4b3adaf5b5f952d81a
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo15012025")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3db87ed23d758d9ce8019736887da1a5ffeb7ca9")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("demo15012025")]
|
[assembly: System.Reflection.AssemblyProductAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo15012025")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
41005c7534528e296b01f2da27e8d291f7195ca9115a03f21b2481a4440c0335
|
24a6a02c857323065555cf2adff2f30d21c3351bda097b2a5c06f3a37503196d
|
||||||
|
@ -33,3 +33,6 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|||||||
|
|
||||||
[/Users/rinchi/RiderProjects/demo15012025/demo15012025/RegJhuri.axaml]
|
[/Users/rinchi/RiderProjects/demo15012025/demo15012025/RegJhuri.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
|
[/Users/rinchi/RiderProjects/demo15012025/demo15012025/Zaglushka.axaml]
|
||||||
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
@ -1 +1 @@
|
|||||||
031ebb689cc6e87e8f89ef8dd7d8adc363e1a99b8c788e0af1f816c4dde16bae
|
c421778bb34eea18f587a2c14ad2e4633a2b2fd80de3dd47f078eebc41303934
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user