mr.solder5 5 年 前
コミット
623250409b

+ 1 - 1
InteractiveKiosk/App.xaml

@@ -2,7 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:local="clr-namespace:InteractiveKiosk"
-             StartupUri="MainWindow.xaml">
+             StartupUri="AuthorizationWindow.xaml">
     <Application.Resources>
          
     </Application.Resources>

+ 97 - 6
InteractiveKiosk/AuthorizationWindow.xaml

@@ -5,15 +5,106 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:InteractiveKiosk"
         mc:Ignorable="d"
-        Title="Окно авторизации" Height="400" Width="600" WindowStartupLocation="CenterScreen" Icon="Logo.png">
-    <Grid>
+        Title="Окно авторизации" Height="300" Width="520" AllowsTransparency="True" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Icon="Logo.png" WindowStyle="None" Background="Transparent">
+    <Window.Resources>
+        <Style x:Key="LoginButton" TargetType="Button">
+            <Setter Property="OverridesDefaultStyle" Value="True"/>
+            <Setter Property="Background" Value="White"/>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="Button">
+                        <Border Name="Border" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
+                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        </Border>
+                        <ControlTemplate.Triggers>
+                            <EventTrigger RoutedEvent="PreviewMouseDown">
+                                <BeginStoryboard>
+                                    <Storyboard>
+                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.100" To="2, 2, 0, 0"/>
+                                    </Storyboard>
+                                </BeginStoryboard>
+                            </EventTrigger>
+                            <EventTrigger RoutedEvent="PreviewMouseUp">
+                                <BeginStoryboard>
+                                    <Storyboard>
+                                        <ThicknessAnimation Storyboard.TargetProperty="Margin" Duration="0:0:0.100" To="0, 0, 0, 0"/>
+                                    </Storyboard>
+                                </BeginStoryboard>
+                            </EventTrigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </Window.Resources>
+    <Grid Name="Authorization" Background="Transparent" MouseDown="Authorization_MouseDown">
+        <Polygon Fill="White" Opacity="0.3" Points="107,0,115,7,249,7,257,0" Margin="80,0,0,0"></Polygon>
+        <Border CornerRadius="20" BorderBrush="Black" BorderThickness="0">
+            <Border.Background>
+                <ImageBrush ImageSource="file.jpg"/>
+            </Border.Background>
+        </Border>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+            <Image Name="MinButton" Height="20" Width="20" Margin="10,-255,-15,0" MouseDown="MinButton_MouseDown">
+                <Image.Style>
+                    <Style TargetType="{x:Type Image}">
+                        <Setter Property="Source" Value="Resources/min(inactive).png"/>
+                        <Style.Triggers>
+                            <DataTrigger Binding="{Binding IsMouseOver, ElementName=MinButton}"
+                                         Value="True">
+                                <Setter Property="Source" Value="Resources/min.png"/>
+                            </DataTrigger>
+                        </Style.Triggers>
+                    </Style>
+                </Image.Style>
+            </Image>
+            <Image Name="ExitButton" Height="20" Width="20" Margin="20,-255,20,0" MouseDown="ExitButton_MouseDown">
+                <Image.Style>
+                    <Style TargetType="{x:Type Image}">
+                        <Setter Property="Source" Value="Resources/exit(inactive).png"/>
+                        <Style.Triggers>
+                            <DataTrigger Binding="{Binding IsMouseOver, ElementName=ExitButton}"
+                                         Value="True">
+                                <Setter Property="Source" Value="Resources/exit.png"/>
+                            </DataTrigger>
+                        </Style.Triggers>
+                    </Style>
+                </Image.Style>
+            </Image>
+        </StackPanel>
         <TextBox Name="username" GotFocus="Username_GotFocus" LostFocus="Username_LostFocus" HorizontalAlignment="Left" Height="23" Margin="256,27,0,0" TextWrapping="Wrap" Text="Логин" VerticalAlignment="Top" Width="120" TextChanged="username_TextChanged"/>
         <TextBlock HorizontalAlignment="Left" Margin="122,27,0,0" TextWrapping="Wrap" Text="Имя пользователя:" VerticalAlignment="Top" Height="23" Width="106"/>
-        <PasswordBox Name="password2" HorizontalAlignment="Left" Margin="394,54,0,0" VerticalAlignment="Top" Width="120" Height="23"/>
-        <TextBox Name="password" GotFocus="Password_GotFocus" LostFocus="Password_LostFocus" HorizontalAlignment="Left" Height="23" Margin="256,75,0,0" TextWrapping="Wrap" Text="Пароль" VerticalAlignment="Top" Width="120" TextChanged="password_TextChanged"/>
+        <PasswordBox Name="password2" HorizontalAlignment="Left" Margin="90,244,0,0" VerticalAlignment="Top" Width="120" Height="23"/>
+        <TextBox Name="password" GotFocus="Password_GotFocus" LostFocus="Password_LostFocus" HorizontalAlignment="Left" Height="23" Margin="256,75,0,0" TextWrapping="Wrap" Text="Пароль" VerticalAlignment="Top" Width="120" TextChanged="password_TextChanged" />
         <TextBlock HorizontalAlignment="Left" Margin="122,75,0,0" TextWrapping="Wrap" Text="Пароль:" VerticalAlignment="Top" Height="23" Width="106"/>
-        <Button Content="Вход" Click = "LoginButton" HorizontalAlignment="Left" Margin="122,122,0,0" VerticalAlignment="Top" Width="75" />
         <CheckBox Content="Показать пароль" HorizontalAlignment="Left" Margin="256,122,0,0" VerticalAlignment="Top"/>
-        <ListBox Name="listbox" HorizontalAlignment="Left" Height="100" Margin="10,10,0,0" VerticalAlignment="Top" Width="100"/>
+        <ListBox Name="listbox" HorizontalAlignment="Left" Height="100" Margin="10,65,0,0" VerticalAlignment="Top" Width="100"/>
+        <Border Height="30" Width="100" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="256, 230, 0, 0" CornerRadius="2" BorderThickness="1" Background="Black">
+            <Border.Style>
+                <Style TargetType="{x:Type Border}">
+                    <Setter Property="BorderBrush" Value="Black"/>
+                    <Style.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter Property="BorderBrush" Value="Black"/>
+                        </Trigger>
+                        <EventTrigger RoutedEvent="PreviewMouseDown">
+                            <BeginStoryboard>
+                                <Storyboard>
+                                    <ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" Duration="0:0:0.100" To="Black"/>
+                                </Storyboard>
+                            </BeginStoryboard>
+                        </EventTrigger>
+                        <EventTrigger RoutedEvent="PreviewMouseUp">
+                            <BeginStoryboard>
+                                <Storyboard>
+                                    <ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" Duration="0:0:0.100" To="Black"/>
+                                </Storyboard>
+                            </BeginStoryboard>
+                        </EventTrigger>
+                    </Style.Triggers>
+                </Style>
+            </Border.Style>
+            <Button Content="Вход" Click="LoginButton" Style="{StaticResource LoginButton}" FontFamily="Arial Black"></Button>
+        </Border>
     </Grid>
 </Window>

+ 30 - 12
InteractiveKiosk/AuthorizationWindow.xaml.cs

@@ -88,19 +88,37 @@ namespace InteractiveKiosk
 
         private void LoginButton(object sender, RoutedEventArgs e)
         {
-            if (username.Text == "" || password.Text == "")
-            {
-                MessageBox.Show("Введено неверное значение!");
-                return;
-            }
-            if (db.ParkManagers.Select(item => item.Username + " " + item.Password).Contains(username.Text + " " + password.Text))
-            {
-                MessageBox.Show("Добро пожаловать, вы авторизированы");
-                this.Close();
-            }
-            else
+            //if (username.Text == "" || password.Text == "")
+            //{
+            //    MessageBox.Show("Введено неверное значение!");
+            //    return;
+            //}
+            //if (db.ParkManagers.Select(item => item.Username + " " + item.Password).Contains(username.Text + " " + password.Text))
+            //{
+            //    MessageBox.Show("Добро пожаловать, вы авторизированы");
+            //    this.Close();
+            //}
+            //else
+            //{
+            //    MessageBox.Show("Введено неверное значение логина/пароля");
+            //}
+        }
+
+        private void MinButton_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            this.WindowState = WindowState.Minimized;
+        }
+
+        private void ExitButton_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void Authorization_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ChangedButton == MouseButton.Left)
             {
-                MessageBox.Show("Введено неверное значение логина/пароля");
+                this.DragMove();
             }
         }
     }

+ 5 - 0
InteractiveKiosk/InteractiveKiosk.csproj

@@ -226,6 +226,11 @@
       <DependentUpon>DataBase.edmx</DependentUpon>
       <LastGenOutput>DataBase.cs</LastGenOutput>
     </Content>
+    <Resource Include="Resources\exit%28inactive%29.png" />
+    <Resource Include="Resources\exit.png" />
+    <Resource Include="Resources\min%28inactive%29.png" />
+    <Resource Include="Resources\min.png" />
+    <Resource Include="file.jpg" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 6 - 1
InteractiveKiosk/MainWindow.xaml

@@ -5,8 +5,13 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:InteractiveKiosk"
         mc:Ignorable="d"
-        Title="Главная страница" Height="950" Width="700" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Loaded="WindowLoaded" Icon="Logo.png">
+        Title="Главная страница" Height="950" Width="700" AllowsTransparency="True" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Loaded="WindowLoaded" Icon="Logo.png" WindowStyle="None" Background="Transparent" >
     <Grid>
+        <Border CornerRadius="20" BorderBrush="Black" BorderThickness="0">
+            <Border.Background>
+                <ImageBrush ImageSource="file.jpg"/>
+            </Border.Background>
+        </Border>
         <Button Content="ВОЙТИ" HorizontalAlignment="Left" Margin="625,10,0,0" VerticalAlignment="Top" Width="45" Height="19" Background="#00000000" FontFamily="Century Gothic" BorderBrush="#00000000" Click="Authorization"/>
         <Button Content="КАРТА ПАРКА" HorizontalAlignment="Left" Margin="46,633,0,0" VerticalAlignment="Top" Width="240" Height="225" Foreground="Black" FontSize="22" FontFamily="Showcard Gothic" FontWeight="Bold" Background="#00000000" Click="Map">
         </Button>

BIN
InteractiveKiosk/Resources/exit(inactive).png


BIN
InteractiveKiosk/Resources/exit.png


BIN
InteractiveKiosk/Resources/min(inactive).png


BIN
InteractiveKiosk/Resources/min.png


BIN
InteractiveKiosk/file.jpg