Przeglądaj źródła

Новое окно MenuWindow, перемещение между окнами после авторизации и на кнопку "Выход".

gr672_lii 5 lat temu
rodzic
commit
9a62b16dd6

+ 8 - 0
CopyCenter/CopyCenter.csproj

@@ -76,6 +76,9 @@
     <Compile Include="Discount.cs">
       <DependentUpon>DataBase.tt</DependentUpon>
     </Compile>
+    <Compile Include="MenuWindow.xaml.cs">
+      <DependentUpon>MenuWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Order.cs">
       <DependentUpon>DataBase.tt</DependentUpon>
     </Compile>
@@ -115,6 +118,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="MenuWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Style.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -155,6 +162,7 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
+    <Resource Include="exit_PNG29.png" />
     <Resource Include="04e31393e803da57d190cf03e6fb0090.jpg" />
     <Content Include="DataBase.Context.tt">
       <Generator>TextTemplatingFileGenerator</Generator>

+ 6 - 3
CopyCenter/MainWindow.xaml.cs

@@ -31,16 +31,19 @@ namespace CopyCenter
         {
             if (login.Text == "" || password.Password == "")
             {
-                MessageBox.Show("Ошибка пустые поля");
+                MessageBox.Show("Введено неверное значение!");
                 return;
             }
             if (db.User.Select(item => item.Login + " " + item.Password).Contains(login.Text + " " + password.Password))
             {
-                MessageBox.Show("Вы авторизированы");
+                MessageBox.Show("Добро пожаловать, вы авторизированы");
+                MenuWindow mw = new MenuWindow();
+                mw.Show();
+                this.Close();
             }
             else
             {
-                MessageBox.Show("Ошибка логина/пароля");
+                MessageBox.Show("Введено неверное значение логина/пароля1");
             }
         }
     }

+ 26 - 0
CopyCenter/MenuWindow.xaml

@@ -0,0 +1,26 @@
+<Window x:Class="CopyCenter.MenuWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        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"
+        xmlns:local="clr-namespace:CopyCenter"
+        mc:Ignorable="d"
+        Title="Меню" Height="325" Width="730">
+    <Grid Margin="0,0,2,0">
+        <Grid.Background>
+            <ImageBrush ImageSource="04e31393e803da57d190cf03e6fb0090.jpg" />
+        </Grid.Background>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
+            <Button Content="Клиенты" Width="120" Height="30" Margin="25,0,30,35" Background="DarkOrange" FontSize="14" FontFamily="Century Gothic" Foreground="White" />
+            <Button Content="Карты" Width="120" Height="30" Margin="5,0,30,35" Background="DarkOrange" FontSize="14" FontFamily="Century Gothic" Foreground="White"/>
+            <Button Content="Заказы" Width="120" Height="30" Margin="5,0,30,35" Background="DarkOrange" FontSize="14" FontFamily="Century Gothic" Foreground="White"/>
+            <Button Content="Услуги" Width="120" Height="30" Margin="5,0,30,35" Background="DarkOrange" FontSize="14" FontFamily="Century Gothic" Foreground="White"/>
+        </StackPanel>
+        <Button Content="" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Top" Width="45" Click="Button_Click" Height="40">
+                <Button.Background>
+                <ImageBrush ImageSource="exit_PNG29.png"/>
+            </Button.Background>
+        </Button>
+
+    </Grid>
+</Window>

+ 34 - 0
CopyCenter/MenuWindow.xaml.cs

@@ -0,0 +1,34 @@
+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;
+
+namespace CopyCenter
+{
+    /// <summary>
+    /// Логика взаимодействия для MenuWindow.xaml
+    /// </summary>
+    public partial class MenuWindow : Window
+    {
+        public MenuWindow()
+        {
+            InitializeComponent();
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            MainWindow mw = new MainWindow();
+            mw.Show();
+            this.Close();
+        }
+    }
+}

BIN
CopyCenter/exit_PNG29.png