Imagara 3 年之前
父節點
當前提交
85c16c659b

+ 1 - 1
PartsWarehouse/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:PartsWarehouse"
-             StartupUri="LoginWindow.xaml">
+             StartupUri="MainWindow.xaml">
     <Application.Resources>
         <ResourceDictionary Source="Styles/Style.xaml"/>
     </Application.Resources>

+ 1 - 1
PartsWarehouse/EDM.edmx.diagram

@@ -4,7 +4,7 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="a983730c88db49b8acf871fd319e858a" Name="Diagram1">
+      <Diagram DiagramId="a983730c88db49b8acf871fd319e858a" Name="Diagram1" ZoomLevel="126">
         <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.Parts" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
         <EntityTypeShape EntityType="PartsWarehouseDataBaseModel.User" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
       </Diagram>

+ 58 - 0
PartsWarehouse/ImagesManip.cs

@@ -0,0 +1,58 @@
+using Microsoft.Win32;
+using System;
+using System.IO;
+using System.Windows.Media.Imaging;
+
+namespace PartsWarehouse
+{
+    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();
+            op.Title = "Выбрать изображение";
+            op.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(Chat chat)
+        //{
+        //    MemoryStream ms = new MemoryStream(chat.ImgSource);
+        //    BitmapImage image = new BitmapImage();
+        //    image.BeginInit();
+        //    image.StreamSource = ms;
+        //    image.EndInit();
+        //    return image;
+        //}
+
+        public static BitmapImage NewImage(User user)
+        {
+            MemoryStream ms = new MemoryStream(user.ProfileImgSource);
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.StreamSource = ms;
+            image.EndInit();
+            return image;
+        }
+    }
+}

+ 41 - 21
PartsWarehouse/MainWindow.xaml

@@ -5,15 +5,15 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:PartsWarehouse"
         mc:Ignorable="d"
-        ResizeMode="NoResize"
         WindowStartupLocation="CenterScreen"
-        Height="350" 
-        Width="600"
-        WindowStyle="None">
+        WindowStyle="None"
+        ResizeMode="NoResize"
+        Height="450" 
+        Width="800">
     <Grid>
         <Grid.RowDefinitions>
+            <RowDefinition Height="25"/>
             <RowDefinition/>
-            <RowDefinition Height="13*"/>
         </Grid.RowDefinitions>
         <Border
             Background="#252525"
@@ -58,23 +58,43 @@
             </Grid>
         </Border>
 
-        <Grid Grid.Row="1" Background="Gray">
-            <Grid.RowDefinitions>
-                <RowDefinition Height="16*"/>
-                <RowDefinition Height="49*"/>
-            </Grid.RowDefinitions>
-            <Grid Grid.Row="0" Background="red">
-                
-            </Grid>
 
-            <ListBox Name="PartsListBox" 
-                     Grid.Row="1"
-                     Background="#32353B"
-                     BorderBrush="#32353B">
-                <ScrollViewer Name="scroll"
-                              VerticalScrollBarVisibility="Visible">
-                </ScrollViewer>
-            </ListBox>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="150"/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+
+            <StackPanel Background="#292b2f" 
+                        Grid.Column="0">
+                <TextBox Height="30"
+                         Margin="5"
+                         Text="Vin...">
+                    
+                </TextBox>
+                <Button Height="30"
+                        Margin="5"
+                        Content="Поиск">
+                    
+                </Button>
+                <Button Height="30"
+                        Margin="5"
+                        Content="Каталог">
+
+                </Button>
+                <Button Height="30"
+                        Margin="5"
+                        Content="Профиль">
+
+                </Button>
+            </StackPanel>
+            
+            <Grid Grid.Column="1">
+                <Frame Name="MainFrame"
+                   NavigationUIVisibility="Hidden"
+                   Background="#36393F"/>
+            </Grid>
         </Grid>
     </Grid>
+
 </Window>

+ 19 - 43
PartsWarehouse/MainWindow.xaml.cs

@@ -15,60 +15,36 @@ using System.Windows.Shapes;
 
 namespace PartsWarehouse
 {
-    /// <summary>
-    /// Логика взаимодействия для MainWindow.xaml
-    /// </summary>
     public partial class MainWindow : Window
     {
         public MainWindow()
         {
             InitializeComponent();
+            MainFrame.Content = new СatalogPage();
         }
 
-        private void SendMessage(string nickName, string message, string date, BitmapImage imageSource)
+        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
         {
-            Grid messageGrid = new Grid();
-            messageGrid.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x40, 0x44, 0x4B));
-            messageGrid.Height = 45;
-            messageGrid.Width = 590;
-            messageGrid.Margin = new Thickness(10, 5, 10, 5);
-
-            Image messageImage = new Image();
-            messageImage.Source = imageSource;
-            messageImage.Width = 35;
-            messageImage.Height = 35;
-            messageImage.Margin = new Thickness(5);
-            messageImage.HorizontalAlignment = HorizontalAlignment.Left;
-            messageGrid.Children.Add(messageImage);
-
-            StackPanel stackpanel = new StackPanel();
-            stackpanel.Orientation = Orientation.Horizontal;
-
-            Label authorLabel = new Label();
-            authorLabel.Content = nickName;
-            authorLabel.Foreground = Brushes.White;
-            authorLabel.FontWeight = FontWeights.Bold;
-            authorLabel.HorizontalAlignment = HorizontalAlignment.Left;
-            authorLabel.VerticalAlignment = VerticalAlignment.Top;
-            authorLabel.Margin = new Thickness(40, 0, 0, 0);
-
-            Label dateLabel = new Label();
-            dateLabel.Content = date;
-            dateLabel.Foreground = Brushes.White;
+            if (e.LeftButton == MouseButtonState.Pressed)
+                DragMove();
+        }
 
-            stackpanel.Children.Add(authorLabel);
-            stackpanel.Children.Add(dateLabel);
-            messageGrid.Children.Add(stackpanel);
+        private void ButtonMininize_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.MainWindow.WindowState = WindowState.Minimized;
+        }
 
-            Label messageLabel = new Label();
-            messageLabel.Content = message;
-            messageLabel.Foreground = Brushes.White;
-            messageLabel.HorizontalAlignment = HorizontalAlignment.Left;
-            messageLabel.VerticalAlignment = VerticalAlignment.Bottom;
-            messageLabel.Margin = new Thickness(40, 0, 0, 0);
-            messageGrid.Children.Add(messageLabel);
+        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;
+        }
 
-            PartsListBox.Items.Add(messageGrid);
+        private void CloseButton_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
         }
     }
 }

+ 47 - 0
PartsWarehouse/PartsPage.xaml

@@ -0,0 +1,47 @@
+<Page x:Class="PartsWarehouse.PartsPage"
+      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:PartsWarehouse"
+      mc:Ignorable="d" 
+      d:DesignHeight="421"
+      d:DesignWidth="634"
+      Title="ChatPage">
+
+    <Grid Background="#32353B">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="32*"/>
+            <RowDefinition Height="389*"/>
+        </Grid.RowDefinitions>
+
+        <Grid Grid.Row="0"
+              Background="#36393F">
+            <StackPanel Orientation="Horizontal">
+                <Label Name="ChatName"
+                   Content="ZZZZZZ" 
+                   Foreground="{StaticResource TextColor}"
+                   FontSize="14"/>
+                <Button Width="15" 
+                        Height="15">
+                    <Image Source="Resources\NotFound.png"></Image>
+                </Button>
+                <Button Width="15" 
+                        Height="15">
+                    <Image Source="Resources\NotFound.png"></Image>
+                </Button>
+            </StackPanel>
+
+        </Grid>
+
+        <Grid Grid.Row="1" Margin="0,0,0,47">
+            <ListBox Name="MessageListBox" 
+                     Background="#32353B"
+                     BorderBrush="#32353B">
+                <ScrollViewer Name="scroll"
+                              VerticalScrollBarVisibility="Visible">
+                </ScrollViewer>
+            </ListBox>
+        </Grid>
+    </Grid>
+</Page>

+ 28 - 0
PartsWarehouse/PartsPage.xaml.cs

@@ -0,0 +1,28 @@
+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 PartsWarehouse
+{
+    /// <summary>
+    /// Логика взаимодействия для PartsPage.xaml
+    /// </summary>
+    public partial class PartsPage : Page
+    {
+        public PartsPage()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 17 - 0
PartsWarehouse/PartsWarehouse.csproj

@@ -85,12 +85,16 @@
       <DependentUpon>ErrorWindow.xaml</DependentUpon>
     </Compile>
     <Compile Include="Functions.cs" />
+    <Compile Include="ImagesManip.cs" />
     <Compile Include="LoginWindow.xaml.cs">
       <DependentUpon>LoginWindow.xaml</DependentUpon>
     </Compile>
     <Compile Include="Parts.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
+    <Compile Include="PartsPage.xaml.cs">
+      <DependentUpon>PartsPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Profile.cs" />
     <Compile Include="RegisterWindow.xaml.cs">
       <DependentUpon>RegisterWindow.xaml</DependentUpon>
@@ -99,6 +103,9 @@
     <Compile Include="User.cs">
       <DependentUpon>EDM.tt</DependentUpon>
     </Compile>
+    <Compile Include="СatalogPage.xaml.cs">
+      <DependentUpon>СatalogPage.xaml</DependentUpon>
+    </Compile>
     <Page Include="ErrorWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -119,6 +126,10 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="PartsPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="RegisterWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -127,6 +138,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="СatalogPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">
@@ -173,9 +188,11 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.cs</LastGenOutput>
     </Content>
+    <Resource Include="Resources\NotFound.png" />
   </ItemGroup>
   <ItemGroup>
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

二進制
PartsWarehouse/Resources/NotFound.png


+ 37 - 0
PartsWarehouse/СatalogPage.xaml

@@ -0,0 +1,37 @@
+<Page x:Class="PartsWarehouse.СatalogPage"
+      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:PartsWarehouse"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="СatalogPage">
+
+    <Grid>
+        <ComboBox>
+            <ComboBox.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <WrapPanel Orientation="Vertical" Height="100" />
+                </ItemsPanelTemplate>
+            </ComboBox.ItemsPanel>
+            
+            <ComboBoxItem Content="Value 1" />
+            <ComboBoxItem Content="Value 2" />
+            <ComboBoxItem Content="Value 3" />
+            <ComboBoxItem Content="Value 4" />
+            <ComboBoxItem Content="Value 5" />
+            <ComboBoxItem Content="Value 6" />
+            <ComboBoxItem Content="Value 7" />
+            <ComboBoxItem Content="Value 8" />
+            <ComboBoxItem Content="Value 9" />
+            <ComboBoxItem Content="Value 10" />
+            <ComboBoxItem Content="Value 11" />
+            <ComboBoxItem Content="Value 12" />
+            <ComboBoxItem Content="Value 13" />
+            <ComboBoxItem Content="Value 14" />
+            <ComboBoxItem Content="Value 15" />
+            
+        </ComboBox>
+    </Grid>
+</Page>

+ 28 - 0
PartsWarehouse/СatalogPage.xaml.cs

@@ -0,0 +1,28 @@
+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 PartsWarehouse
+{
+    /// <summary>
+    /// Логика взаимодействия для СatalogPage.xaml
+    /// </summary>
+    public partial class СatalogPage : Page
+    {
+        public СatalogPage()
+        {
+            InitializeComponent();
+        }
+    }
+}