Imagara 2 éve
szülő
commit
5a551e599d

+ 44 - 0
RaspisKusach/Functions.cs

@@ -1,6 +1,10 @@
 using System;
 using System.Linq;
 using System.Text.RegularExpressions;
+using Microsoft.Win32;
+using System.IO;
+using System.Windows.Media.Imaging;
+
 namespace RaspisKusach
 {
     public class Functions
@@ -88,5 +92,45 @@ namespace RaspisKusach
         //{
         //    return cnt.db.User.Select(item => item.PhoneNumber).Contains(Phone);
         //}
+
+        public static byte[] BitmapSourceToByteArray(BitmapSource image)
+        {
+            #region Кодирование картинки
+            using (var stream = new MemoryStream())
+            {
+                var encoder = new PngBitmapEncoder();
+                encoder.Frames.Add(BitmapFrame.Create(image));
+                encoder.Save(stream);
+                return stream.ToArray();
+            }
+            #endregion
+        }
+
+        public static BitmapImage SelectImage()
+        {
+            #region Выбор картинки
+            OpenFileDialog op = new OpenFileDialog
+            {
+                Title = "Выбрать изображение",
+                Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
+                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
+                        "Portable Network Graphic (*.png)|*.png"
+            };
+            if (op.ShowDialog() == true)
+                return new BitmapImage(new Uri(op.FileName));
+            else
+                return null;
+            #endregion
+        }
+
+        //public static BitmapImage NewImage(Users user)
+        //{
+        //    MemoryStream ms = new MemoryStream(user.Image);
+        //    BitmapImage image = new BitmapImage();
+        //    image.BeginInit();
+        //    image.StreamSource = ms;
+        //    image.EndInit();
+        //    return image;
+        //}
     }
 }

+ 0 - 50
RaspisKusach/ImagesManip.cs

@@ -1,50 +0,0 @@
-using Microsoft.Win32;
-using System;
-using System.IO;
-using System.Windows.Media.Imaging;
-
-namespace RaspisKusach
-{
-    internal class ImagesManip
-    {
-        public static byte[] BitmapSourceToByteArray(BitmapSource image)
-        {
-            #region Кодирование картинки
-            using (var stream = new MemoryStream())
-            {
-                var encoder = new PngBitmapEncoder();
-                encoder.Frames.Add(BitmapFrame.Create(image));
-                encoder.Save(stream);
-                return stream.ToArray();
-            }
-            #endregion
-        }
-
-        public static BitmapImage SelectImage()
-        {
-            #region Выбор картинки
-            OpenFileDialog op = new OpenFileDialog
-            {
-                Title = "Выбрать изображение",
-                Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
-                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
-                        "Portable Network Graphic (*.png)|*.png"
-            };
-            if (op.ShowDialog() == true)
-                return new BitmapImage(new Uri(op.FileName));
-            else
-                return null;
-            #endregion
-        }
-
-        //public static BitmapImage NewImage(Users user)
-        //{
-        //    MemoryStream ms = new MemoryStream(user.Image);
-        //    BitmapImage image = new BitmapImage();
-        //    image.BeginInit();
-        //    image.StreamSource = ms;
-        //    image.EndInit();
-        //    return image;
-        //}
-    }
-}

+ 62 - 4
RaspisKusach/MainWindow.xaml

@@ -5,10 +5,68 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:RaspisKusach"
         mc:Ignorable="d"
-        Title="Расписание" 
+        Title="Расписание"
+        WindowStartupLocation="CenterScreen"
+        WindowStyle="None"
+        ResizeMode="NoResize"
         Height="450" 
         Width="800">
-    <Frame Name="MainFrame"
-           NavigationUIVisibility="Hidden">
-    </Frame>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="25"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Border Name="Bar"
+                Background="#252525"
+                Grid.Row="0"
+                MouseDown="Border_MouseDown">
+            <Grid HorizontalAlignment="Stretch" Background="WhiteSmoke">
+                <StackPanel Orientation="Horizontal">
+                    <Image Source="/Resources/StandartProfile.png" 
+                           Height="{Binding Path=ActualHeight, ElementName=Bar}"/>
+                    <Label Content="dfgdfgdfg"
+                       Foreground="Gray"
+                       FontWeight="SemiBold"/>
+                </StackPanel>
+                
+                <StackPanel HorizontalAlignment="Right"
+                            Orientation="Horizontal">
+
+                    <Button Style="{x:Null}"
+                            Width="20" 
+                            Height="20"
+                            Content="—"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold" 
+                            Click="ButtonMininize_Click"/>
+
+                    <Button Visibility="Collapsed"
+                            Style="{x:Null}"
+                            Width="20" Height="20"
+                            Content="☐"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold"
+                            Click="WindowStateButton_Click"/>
+
+
+                    <Button Style="{x:Null}"
+                            Width="20" Height="20"
+                            Content="X"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold"
+                            Click="CloseButton_Click"/>
+                </StackPanel>
+            </Grid>
+        </Border>
+        <Frame Name="MainFrame"
+               Grid.Row="1"
+               NavigationUIVisibility="Hidden" >
+        </Frame>
+    </Grid>
 </Window>

+ 26 - 1
RaspisKusach/MainWindow.xaml.cs

@@ -1,4 +1,6 @@
 using System.Windows;
+using System.Windows.Input;
+
 namespace RaspisKusach
 {
     public partial class MainWindow : Window
@@ -6,7 +8,30 @@ namespace RaspisKusach
         public MainWindow()
         {
             InitializeComponent();
-            MainFrame.Content = new Pages.MainPage();
+            MainFrame.Content = new Pages.LoginPage();
+        }
+        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.LeftButton == MouseButtonState.Pressed)
+                DragMove();
+        }
+
+        private void ButtonMininize_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.MainWindow.WindowState = WindowState.Minimized;
+        }
+
+        private void WindowStateButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (Application.Current.MainWindow.WindowState != WindowState.Maximized)
+                Application.Current.MainWindow.WindowState = WindowState.Maximized;
+            else
+                Application.Current.MainWindow.WindowState = WindowState.Normal;
+        }
+
+        private void CloseButton_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
         }
     }
 }

+ 81 - 0
RaspisKusach/Pages/LoginPage.xaml

@@ -0,0 +1,81 @@
+<Page x:Class="RaspisKusach.Pages.LoginPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:RaspisKusach.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" 
+      d:DesignWidth="800">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition/>
+            <ColumnDefinition Width="2*"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="2.75*"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Image Source="/Resources/BackGround.jpg" 
+               Grid.RowSpan="3" 
+               Grid.ColumnSpan="3"
+               Stretch="Fill"/>
+        <Border Grid.Row="1" 
+                Grid.Column="1"
+                BorderBrush="Black"
+                BorderThickness="2">
+            <Grid Style="{x:Null}" 
+                  Background="{x:Null}">
+                <Grid Background="Gray"
+                      Opacity="0.85"/>
+                <StackPanel Orientation="Vertical"
+                        Margin="10"
+                        VerticalAlignment="Center"
+                        HorizontalAlignment="Center">
+                    <Label Content="Логин:" 
+                       Foreground="{StaticResource TextColor}"
+                       Height="40" 
+                       Width="240"
+                       FontSize="20"/>
+                    <TextBox Name="LogBox" 
+                             Foreground="{StaticResource TextColor}"
+                             TextWrapping="Wrap" 
+                             VerticalAlignment="Top" 
+                             Height="40" 
+                             Width="240"
+                             FontSize="20"/>
+                    <Label Content="Пароль:"
+                           Foreground="{StaticResource TextColor}"
+                           Height="40" 
+                           Width="240"
+                           FontSize="20"/>
+                    <PasswordBox Name="PassBox"
+                                 Foreground="{StaticResource TextColor}"
+                                 Height="40" 
+                                 Width="240"
+                                 FontSize="20"/>
+                    <StackPanel Orientation="Horizontal"
+                                Margin="0,20,0,0">
+                        <Button Name="RegButton" 
+                                Content="Регистрация"
+                                Height="40" 
+                                Width="150" 
+                                Margin="0,0,30,0"
+                                FontSize="20"
+                                Click="RegButton_Click"/>
+                        <Button x:Name="LogButton" 
+                                Content="Вход"
+                                Height="40" 
+                                Width="150"
+                                FontSize="20"
+                                IsDefault="True"
+                                Click="LogButton_Click">
+                        </Button>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+        </Border>
+    </Grid>
+</Page>

+ 38 - 0
RaspisKusach/Pages/LoginPage.xaml.cs

@@ -0,0 +1,38 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace RaspisKusach.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для LoginPage.xaml
+    /// </summary>
+    public partial class LoginPage : Page
+    {
+        public LoginPage()
+        {
+            InitializeComponent();
+        }
+
+        private void RegButton_Click(object sender, RoutedEventArgs e)
+        {
+            NavigationService.Navigate(new Pages.RegisterPage());
+        }
+
+        private void LogButton_Click(object sender, RoutedEventArgs e)
+        {
+            NavigationService.Navigate(new Pages.MainPage());
+        }
+    }
+}

+ 1 - 1
RaspisKusach/Pages/MainPage.xaml.cs

@@ -20,7 +20,7 @@ namespace RaspisKusach.Pages
         public MainPage()
         {
             InitializeComponent();
-            ListBox.ItemsSource = cnt.db.Table.ToList();
+            //ListBox.ItemsSource = cnt.db.Table.ToList();
         }
 
         private void Button_Click(object sender, RoutedEventArgs e)

+ 81 - 0
RaspisKusach/Pages/RegisterPage.xaml

@@ -0,0 +1,81 @@
+<Page x:Class="RaspisKusach.Pages.RegisterPage"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:RaspisKusach.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800">
+
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition/>
+            <ColumnDefinition Width="2*"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="2.75*"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Image Source="/Resources/BackGround.jpg" 
+               Grid.RowSpan="3" 
+               Grid.ColumnSpan="3"
+               Stretch="Fill"/>
+        <Border Grid.Row="1" 
+                Grid.Column="1"
+                BorderBrush="Black"
+                BorderThickness="2">
+            <Grid Style="{x:Null}" 
+                  Background="{x:Null}">
+                <Grid Background="Gray"
+                      Opacity="0.85"/>
+                <StackPanel Orientation="Vertical"
+                        Margin="10"
+                        VerticalAlignment="Center"
+                        HorizontalAlignment="Center">
+                    <Label Content="Логин:" 
+                       Foreground="{StaticResource TextColor}"
+                       Height="40" 
+                       Width="240"
+                       FontSize="20"/>
+                    <TextBox Name="LogBox" 
+                             Foreground="{StaticResource TextColor}"
+                             TextWrapping="Wrap" 
+                             VerticalAlignment="Top" 
+                             Height="40" 
+                             Width="240"
+                             FontSize="20"/>
+                    <Label Content="Пароль:"
+                           Foreground="{StaticResource TextColor}"
+                           Height="40" 
+                           Width="240"
+                           FontSize="20"/>
+                    <PasswordBox Name="PassBox"
+                                 Foreground="{StaticResource TextColor}"
+                                 Height="40" 
+                                 Width="240"
+                                 FontSize="20"/>
+                    <StackPanel Orientation="Horizontal"
+                                Margin="0,20,0,0">
+                        <Button Name="BackButton" 
+                                Content="Назад"
+                                Height="40" 
+                                Width="150" 
+                                Margin="0,0,30,0"
+                                FontSize="20"
+                                Click="BackButton_Click"/>
+                        <Button x:Name="RegisterButton" 
+                                Content="Регистрация"
+                                Height="40" 
+                                Width="150"
+                                FontSize="20"
+                                IsDefault="True"
+                                Click="RegisterButton_Click">
+                        </Button>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+        </Border>
+    </Grid>
+</Page>

+ 39 - 0
RaspisKusach/Pages/RegisterPage.xaml.cs

@@ -0,0 +1,39 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace RaspisKusach.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для RegisterPage.xaml
+    /// </summary>
+    public partial class RegisterPage : Page
+    {
+        public RegisterPage()
+        {
+            InitializeComponent();
+        }
+
+        private void BackButton_Click(object sender, RoutedEventArgs e)
+        {
+            NavigationService.Navigate(new Pages.LoginPage());
+        }
+
+        private void RegisterButton_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBox.Show("{Status here}");
+            NavigationService.Navigate(new Pages.LoginPage());
+        }
+    }
+}

+ 15 - 1
RaspisKusach/RaspisKusach.csproj

@@ -82,9 +82,15 @@
     </Compile>
     <Compile Include="Encrypt.cs" />
     <Compile Include="Functions.cs" />
+    <Compile Include="Pages\LoginPage.xaml.cs">
+      <DependentUpon>LoginPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\MainPage.xaml.cs">
       <DependentUpon>MainPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\RegisterPage.xaml.cs">
+      <DependentUpon>RegisterPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Session.cs" />
     <Compile Include="Styles\Style.cs" />
     <Compile Include="Table.cs">
@@ -98,15 +104,22 @@
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="ImagesManip.cs" />
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Pages\LoginPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\MainPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\RegisterPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\Style.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -160,6 +173,7 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.cs</LastGenOutput>
     </Content>
+    <Resource Include="Resources\Background.jpg" />
   </ItemGroup>
   <ItemGroup>
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />

BIN
RaspisKusach/Resources/Background.jpg


+ 6 - 5
RaspisKusach/Styles/Style.xaml

@@ -4,7 +4,7 @@
     
     
     <SolidColorBrush x:Key="TextColor" 
-                     Color="White">
+                     Color="#8B00FF">
     </SolidColorBrush>
 
     <SolidColorBrush x:Key="color1" 
@@ -28,16 +28,17 @@
             <Setter.Value>
                 <ControlTemplate TargetType="Button">
                     <Border Name="Border" 
-                            CornerRadius="15"
-                            Background="Gray"
-                            BorderBrush="Black">
+                            CornerRadius="10"
+                            Background="DimGray"
+                            BorderBrush="Black"
+                            BorderThickness="1">
                         <ContentPresenter HorizontalAlignment="Center" 
                                           VerticalAlignment="Center"/>
                     </Border>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
-        <Setter Property="Foreground" Value="White"/>
+        <Setter Property="Foreground" Value="{StaticResource TextColor}"/>
     </Style>
 
 </ResourceDictionary>