WPFHelperForAlex 1.0.3
dotnet add package WPFHelperForAlex --version 1.0.3
NuGet\Install-Package WPFHelperForAlex -Version 1.0.3
<PackageReference Include="WPFHelperForAlex" Version="1.0.3" />
<PackageVersion Include="WPFHelperForAlex" Version="1.0.3" />
<PackageReference Include="WPFHelperForAlex" />
paket add WPFHelperForAlex --version 1.0.3
#r "nuget: WPFHelperForAlex, 1.0.3"
#:package WPFHelperForAlex@1.0.3
#addin nuget:?package=WPFHelperForAlex&version=1.0.3
#tool nuget:?package=WPFHelperForAlex&version=1.0.3
//authorizatiomwindow.xaml
<window x: class = "wpfapp1.authorizationwindow"
xmlns = "https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns: x = "https://schemas.microsoft.com/winfx/2006/xaml"
xmlns: d = "https://schemas.microsoft.com/expression/blend/2008"
xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns: local = "clr-namespace:wpfapp1"
mc: ignorable = "d"
title = "authorizationwindow" height = "450" width = "800" >
<grid >
<label content = "авторизация" horizontalalignment = "center" margin = "0,38,0,0" verticalalignment = "top" / >
<textbox x: name = "logbox" horizontalalignment = "center" margin = "0,217,0,0" textwrapping = "wrap" text = "login" verticalalignment = "top" width = "120" / >
<textbox x: name = "pasbox" horizontalalignment = "center" margin = "0,251,0,0" textwrapping = "wrap" text = "password" verticalalignment = "top" width = "120" textchanged = "pasbox_textchanged" / >
<button x: name = "loginbutton" content = "войти" horizontalalignment = "center" margin = "0,290,0,0" verticalalignment = "top" click = "loginbutton_click" / >
<button x: name = "guestbutton" content = "войти как гость" horizontalalignment = "center" margin = "0,385,0,0" verticalalignment = "top" click = "button_click" / >
< / grid >
< / window >
//authorizationwindow.xaml.cs
using microsoft.entityframeworkcore;
using microsoft.entityframeworkcore.storage;
using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;
using system.windows;
using system.windows.controls;
using system.windows.data;
using system.windows.documents;
using system.windows.input;
using system.windows.media;
using system.windows.media.imaging;
using system.windows.shapes;
using wpfapp1.models;
namespace wpfapp1
{
/// <summary>
/// логика взаимодействия для authorizationwindow.xaml
/// </summary>
public partial class authorizationwindow : window
{
wpfcontext db = wpfcontext.getinstance();
public authorizationwindow()
{
initializecomponent();
}
private void pasbox_textchanged(object sender, textchangedeventargs e)
{
}
private void loginbutton_click(object sender, routedeventargs e)
{
if (!string.isnullorempty(logbox.text) && !string.isnullorempty(pasbox.text))
{
var user = db.users.include(u = > u.idrolenavigation).firstordefault(x = > x.login == logbox.text && x.password == pasbox.text);
if (user != null)
{
mainwindow mainwindow = new mainwindow(user);
mainwindow.show();
this.close();
}
else
{
messagebox.show("неверный логин или пароль");
}
}
else
{
messagebox.show("заполните поля login и password");
}
}
private void button_click(object sender, routedeventargs e)
{
mainwindow mainwindow = new mainwindow(null);
mainwindow.show();
this.close();
}
}
}
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.