Просмотр исходного кода

Сделан профиль
Подготовлен проект под начало создания задумки

Imagara 2 лет назад
Родитель
Сommit
54f11d7b2e

+ 6 - 0
MyTests.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.31911.196
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyTests", "MyTests\MyTests.csproj", "{ECFA6225-9D0E-4041-91F6-12C6BF32BD70}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{76E7D484-BAC1-4C25-A186-E219BFE27518}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{ECFA6225-9D0E-4041-91F6-12C6BF32BD70}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{ECFA6225-9D0E-4041-91F6-12C6BF32BD70}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{ECFA6225-9D0E-4041-91F6-12C6BF32BD70}.Release|Any CPU.Build.0 = Release|Any CPU
+		{76E7D484-BAC1-4C25-A186-E219BFE27518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{76E7D484-BAC1-4C25-A186-E219BFE27518}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{76E7D484-BAC1-4C25-A186-E219BFE27518}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{76E7D484-BAC1-4C25-A186-E219BFE27518}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 14 - 4
MyTests/App.config

@@ -1,6 +1,16 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
-    </startup>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+  </startup>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
 </configuration>

+ 1 - 1
MyTests/App.xaml

@@ -4,6 +4,6 @@
              xmlns:local="clr-namespace:MyTests"
              StartupUri="MainWindow.xaml">
     <Application.Resources>
-         
+        <ResourceDictionary Source="Styles/Style.xaml"/>
     </Application.Resources>
 </Application>

+ 50 - 0
MyTests/ConfirmationWindow.xaml

@@ -0,0 +1,50 @@
+<Window x:Class="MyTests.ConfirmationWindow"
+        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:MyTests"
+        mc:Ignorable="d"
+        Title="ConfirmationWindow" 
+        MinHeight="120" 
+        Height="120"
+        Width="300" 
+        WindowStartupLocation="CenterScreen" 
+        WindowStyle="None" 
+        ResizeMode="NoResize">
+    <Grid Background="#FF2D2D2D">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="27*"/>
+            <RowDefinition Height="13*"/>
+        </Grid.RowDefinitions>
+        <TextBlock Name="ErrorLabel" 
+               Text="Вы действительно хотите это сделать?" 
+               TextWrapping="Wrap"
+               HorizontalAlignment="Center" 
+               Margin="19,10,19,0" 
+               VerticalAlignment="Top" 
+               Width="262"
+                   Background="{x:Null}">
+        </TextBlock>
+        <Grid Grid.Row="1">
+            <StackPanel Orientation="Horizontal"
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center">
+                <Button Content="Да" 
+                VerticalAlignment="Bottom" 
+                HorizontalAlignment="Center" 
+                Height="30" 
+                Width="130" 
+                        Margin="0,0,5,0"
+                Click="YesButton"/>
+                <Button Content="Нет" 
+                VerticalAlignment="Bottom" 
+                HorizontalAlignment="Center" 
+                Height="30" 
+                Width="130"
+                        Margin="5,0,0,0"
+                Click="NoButton"/>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</Window>

+ 24 - 0
MyTests/ConfirmationWindow.xaml.cs

@@ -0,0 +1,24 @@
+using System.Windows;
+
+namespace MyTests
+{
+    public partial class ConfirmationWindow : Window
+    {
+        public bool answer;
+        public ConfirmationWindow(bool _answer = false)
+        {
+            InitializeComponent();
+            answer = _answer;
+        }
+        private void YesButton(object sender, RoutedEventArgs e)
+        {
+            answer = true;
+            this.Close();
+        }
+        private void NoButton(object sender, RoutedEventArgs e)
+        {
+            answer = false;
+            this.Close();
+        }
+    }
+}

+ 10 - 0
MyTests/EDM.Designer.cs

@@ -0,0 +1,10 @@
+// Создание кода T4 для модели "C:\Users\milic\source\repos\MyTests\MyTests\EDM.edmx" включено. 
+// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
+// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
+// открыта в конструкторе.
+
+// Если не сформированы контекст и классы сущности, возможная причина в том, что вы создали пустую модель, но
+// еще не выбрали версию Entity Framework для использования. Чтобы сформировать класс контекста и классы сущностей
+// для своей модели, откройте модель в конструкторе, щелкните правой кнопкой область конструктора и
+// выберите "Обновить модель из базы данных", "Сформировать базу данных из модели" или "Добавить элемент формирования
+// кода...".

+ 47 - 0
MyTests/EDM.edmx

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+  <!-- EF Runtime content -->
+  <edmx:Runtime>
+    <!-- SSDL content -->
+    <edmx:StorageModels>
+      <Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl" Namespace="EDM.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">
+        <EntityContainer Name="EDMTargetContainer" >
+        </EntityContainer>
+      </Schema>
+    </edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="EDM" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false">
+        <EntityContainer Name="EDMContainer" annotation:LazyLoadingEnabled="true">
+        </EntityContainer>
+      </Schema>
+    </edmx:ConceptualModels>
+    <!-- C-S mapping content -->
+    <edmx:Mappings>
+      <Mapping xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs" Space="C-S">
+        <Alias Key="Model" Value="EDM" />
+        <Alias Key="Target" Value="EDM.Store" />
+        <EntityContainerMapping CdmEntityContainer="EDMContainer" StorageEntityContainer="EDMTargetContainer">
+        </EntityContainerMapping>
+      </Mapping>
+    </edmx:Mappings>
+  </edmx:Runtime>
+  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <edmx:Connection>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
+      </DesignerInfoPropertySet>
+    </edmx:Connection>
+    <edmx:Options>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
+        <DesignerProperty Name="EnablePluralization" Value="False" />
+        <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
+      </DesignerInfoPropertySet>
+    </edmx:Options>
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 10 - 0
MyTests/EDM.edmx.diagram

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+ <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+      <Diagram DiagramId="39fb947a236f4bdf81ea2290c6276f47" Name="Diagram1" />
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 32 - 0
MyTests/ErrorWindow.xaml

@@ -0,0 +1,32 @@
+<Window x:Class="MyTests.ErrorWindow"
+        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:MyTests"
+        mc:Ignorable="d"
+        Title="ErrorWindow" 
+        MinHeight="120" 
+        Height="120"
+        Width="300" 
+        WindowStartupLocation="CenterScreen" 
+        WindowStyle="None" 
+        ResizeMode="NoResize">
+    <Grid Background="#FF2D2D2D">
+        <TextBlock Name="ErrorLabel" 
+               Text="Ошибка." 
+               TextWrapping="Wrap"
+               HorizontalAlignment="Center" 
+               Margin="19,10,19,0" 
+               VerticalAlignment="Top" 
+               Width="262">
+        </TextBlock>
+        <Button Content="Закрыть" 
+                VerticalAlignment="Bottom" 
+                HorizontalAlignment="Center" 
+                Height="30" 
+                Width="130" 
+                Margin="0,0,0,15" 
+                Click="BackClick"/>
+    </Grid>
+</Window>

+ 18 - 0
MyTests/ErrorWindow.xaml.cs

@@ -0,0 +1,18 @@
+using System.Windows;
+
+namespace MyTests
+{
+    public partial class ErrorWindow : Window
+    {
+        public ErrorWindow(string error)
+        {
+            InitializeComponent();
+            ErrorLabel.Text = error;
+        }
+        private void BackClick(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}
+

+ 43 - 0
MyTests/Functions.cs

@@ -0,0 +1,43 @@
+namespace MyTests
+{
+    public class Functions
+    {
+        // Валидация логина и пароля при входе
+        public static bool IsValidLogAndPass(string login, string password)
+        {
+            if (login == "" || password == "")
+                return false;
+            else
+                return true;
+        }
+        // Валидация логина и пароля
+        public static bool IsLogEqualPass(string login, string password)
+        {
+            if (login == password)
+                return false;
+            else
+                return true;
+        }
+        // Валидация логина и пароля
+        public static bool IsValidLength(string str)
+        {
+            if (str.Length < 5)
+                return false;
+            else
+                return true;
+        }
+        //// Проверка на правильность введеных данных при входе
+        //public static bool LoginCheck(string login, string password)
+        //{
+        //    if (cnt.db.User.Select(item => item.Login + item.Password).Contains(login + Encrypt.GetHash(password)))
+        //        return true;
+        //    else
+        //        return false;
+        //}
+        //// Проверка на уникальность логина
+        //public static bool IsLoginAlreadyTaken(string login)
+        //{
+        //    return cnt.db.User.Select(item => item.Login).Contains(login);
+        //}
+    }
+}

+ 50 - 0
MyTests/ImagesManip.cs

@@ -0,0 +1,50 @@
+using Microsoft.Win32;
+using System;
+using System.IO;
+using System.Windows.Media.Imaging;
+
+namespace MyTests
+{
+    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(Parts part)
+        //{
+        //    MemoryStream ms = new MemoryStream(part.Image);
+        //    BitmapImage image = new BitmapImage();
+        //    image.BeginInit();
+        //    image.StreamSource = ms;
+        //    image.EndInit();
+        //    return image;
+        //}
+    }
+}

+ 76 - 3
MyTests/MainWindow.xaml

@@ -5,11 +5,84 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:MyTests"
         mc:Ignorable="d"
-        Title="MainWindow" 
+        WindowStartupLocation="CenterScreen"
+        WindowStyle="None"
         ResizeMode="NoResize"
         Height="450" 
         Width="800">
-    <Grid>
-        
+    <Grid Background="{StaticResource color1}">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="25"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Border Background="#252525"
+                MouseDown="Border_MouseDown" 
+                Grid.Row="0">
+            <Grid HorizontalAlignment="Stretch">
+                <Label Content="PartsWarehouse"
+                       Foreground="Gray"
+                       FontWeight="SemiBold"/>
+
+                <StackPanel HorizontalAlignment="Right"
+                            Orientation="Horizontal">
+
+                    <Button Width="20" 
+                            Height="20"
+                            Content="—"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold" 
+                            Click="ButtonMininize_Click"/>
+
+                    <Button Visibility="Collapsed"
+                            Width="20" Height="20"
+                            Content="☐"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold"
+                            Click="WindowStateButton_Click"/>
+
+
+                    <Button Width="20" Height="20"
+                            Content="X"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Foreground="Gray"
+                            FontWeight="Bold"
+                            Click="CloseButton_Click"/>
+                </StackPanel>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="31*"/>
+                <ColumnDefinition Width="169*"/>
+            </Grid.ColumnDefinitions>
+
+            <StackPanel Background="{StaticResource color2}" 
+                    Grid.Column="0">
+                <Button Height="30"
+                    Margin="5"
+                    Content="Создать тест"
+                    Click="CreateTestClick">
+                </Button>
+                <Button Height="30"
+                    Margin="5"
+                    Content="Тесты"
+                    Click="TestsCatalogClick">
+
+                </Button>
+                <Button Height="30"
+                    Margin="5"
+                    Content="Профиль"
+                    Click="ProfileClick">
+                </Button>
+            </StackPanel>
+            <Frame Name="MainFrame" 
+                   Grid.Column="1">
+            </Frame>
+        </Grid>
     </Grid>
 </Window>

+ 40 - 1
MyTests/MainWindow.xaml.cs

@@ -23,6 +23,45 @@ namespace MyTests
         public MainWindow()
         {
             InitializeComponent();
+            MainFrame.Content = new Pages.ProfilePage();
+        }
+
+        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();
+        }
+
+        private void ProfileClick(object sender, RoutedEventArgs e)
+        {
+            MainFrame.Content = new Pages.ProfilePage();
+        }
+
+        private void TestsCatalogClick(object sender, RoutedEventArgs e)
+        {
+            //MainFrame.Content = new СatalogPage();
+        }
+        private void CreateTestClick(object sender, RoutedEventArgs e)
+        {
+            //MainFrame.Content = new СatalogPage();
         }
     }
-}
+}

+ 54 - 0
MyTests/MyTests.csproj

@@ -35,8 +35,17 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Core" />
@@ -55,6 +64,23 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="EDM.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>EDM.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\ProfilePage.xaml.cs">
+      <DependentUpon>ProfilePage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Styles\Style.cs" />
+    <Page Include="ConfirmationWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="ErrorWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -63,10 +89,27 @@
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="cnt.cs" />
+    <Compile Include="ConfirmationWindow.xaml.cs">
+      <DependentUpon>ConfirmationWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="ErrorWindow.xaml.cs">
+      <DependentUpon>ErrorWindow.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Functions.cs" />
+    <Compile Include="ImagesManip.cs" />
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Pages\ProfilePage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Styles\Style.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs">
@@ -86,6 +129,14 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EntityDeploy Include="EDM.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>EDM.Designer.cs</LastGenOutput>
+    </EntityDeploy>
+    <None Include="EDM.edmx.diagram">
+      <DependentUpon>EDM.edmx</DependentUpon>
+    </None>
+    <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -94,5 +145,8 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Resources\StandartImage.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 70 - 0
MyTests/Pages/ProfilePage.xaml

@@ -0,0 +1,70 @@
+<Page x:Class="MyTests.Pages.ProfilePage"
+      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:MyTests.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="419"
+      d:DesignWidth="692"
+      Title="ProfilePage"
+      Background="{StaticResource color1}">
+    <Grid Margin="25"
+          Background="{StaticResource color2}">
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="55*"/>
+            <ColumnDefinition Width="159*"/>
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <StackPanel Orientation="Vertical" 
+                        Grid.Column="0"
+                        VerticalAlignment="Top"
+                        Margin="5">
+                <TextBlock Text="Name"
+                           HorizontalAlignment="Center"
+                           FontSize="20">
+                </TextBlock>
+                <Image 
+                    Name="ProfileImg"
+                    Height="auto"
+                    Width="auto"
+                    VerticalAlignment="Top"
+                    HorizontalAlignment="Center"
+                    Margin="0,0,0,15"
+                    Source="/MyTests;component/Resources/StandartImage.png"/>
+                <Button Content="Изменить"
+                        HorizontalAlignment="Center" 
+                        Height="30"
+                        Width="150"
+                        VerticalAlignment="Top"
+                        Click="EditImageButton_Click"/>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Column="1">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="95*"/>
+                <RowDefinition Height="274*"/>
+            </Grid.RowDefinitions>
+            <StackPanel Orientation="Vertical"
+                        Margin="10,10,10,0"
+                        Background="{StaticResource color3}"
+                        VerticalAlignment="Top" Height="74">
+                <Label Name="EmailBox"
+                       Content="Markus Bodhi"
+                       FontSize="20"/>
+                <Label Name="InfoBox"
+                       Content="Info:"
+                       FontSize="20"/>
+            </StackPanel>
+            <ListBox Grid.Row="1"
+                     Name="TestsListBox"
+                     Margin="10"
+                     Background="{StaticResource color3}"
+                     BorderBrush="{StaticResource color3}">
+                <ScrollViewer Name="scroll"
+                              VerticalScrollBarVisibility="Visible">
+                </ScrollViewer>
+            </ListBox>
+        </Grid>
+    </Grid>
+</Page>

+ 51 - 0
MyTests/Pages/ProfilePage.xaml.cs

@@ -0,0 +1,51 @@
+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 MyTests.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для ProfilePage.xaml
+    /// </summary>
+    public partial class ProfilePage : Page
+    {
+        public ProfilePage()
+        {
+            InitializeComponent();
+            //if (cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.ProfileImgSource).FirstOrDefault() != null)
+            //    ProfileImg.Source = new BitmapImage(new Uri(cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.ProfileImgSource).FirstOrDefault()));
+            //NameSurnameBox.Content = cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.Name + " " + item.Surname).FirstOrDefault();
+            //DateTime Birthday = cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.Birthday).FirstOrDefault();
+            //BirthdayBox.Content = Birthday.ToLongDateString();
+            //string phone = cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.PhoneNumber).FirstOrDefault();
+            //PhoneNumBox.Content = "+7(" + phone.Substring(0, 3) + ")" + phone.Substring(3, 3) + "-" + phone.Substring(6, 2) + "-" + phone.Substring(8, 2);
+            //EmailBox.Content = cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).Select(item => item.Email).FirstOrDefault();
+        }
+        private void EditImageButton_Click(object sender, RoutedEventArgs e)
+        {
+            //OpenFileDialog ofd = new OpenFileDialog();
+            //ofd.DefaultExt = ".png";
+            //ofd.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg";
+            //Nullable<bool> result = ofd.ShowDialog();
+            //if (result == true)
+            //{
+            //    string filename = ofd.FileName;
+            //    ProfileImg.Source = new BitmapImage(new Uri(filename));
+            //    Dispatcher dispatcher = cnt.db.Dispatcher.Where(item => item.IdDispatcher == profile.DispatcherId).FirstOrDefault();
+            //    dispatcher.ProfileImgSource = filename;
+            //    cnt.db.SaveChanges();
+            //}
+        }
+    }
+}

BIN
MyTests/Resources/StandartImage.png


+ 20 - 0
MyTests/Styles/Style.cs

@@ -0,0 +1,20 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Input;
+
+namespace MyTests
+{
+    public partial class Style : ResourceDictionary
+    {
+        private void MouseEnter(object sender, MouseEventArgs e)
+        {
+            ((Border)sender).Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x2F, 0x31, 0x36));
+        }
+
+        private void MouseLeave(object sender, MouseEventArgs e)
+        {
+            ((Border)sender).Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x36, 0x3C));
+        }
+    }
+}

+ 143 - 0
MyTests/Styles/Style.xaml

@@ -0,0 +1,143 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    x:Class="MyTests.Style">
+
+    <SolidColorBrush x:Key="TextColor" 
+                     Color="White">
+    </SolidColorBrush>
+    
+    <SolidColorBrush x:Key="color1" 
+                     Color="#32353B">
+    </SolidColorBrush>
+    
+    <SolidColorBrush x:Key="color2" 
+                     Color="#2F3136">
+    </SolidColorBrush>
+
+    <SolidColorBrush x:Key="color3" 
+                     Color="#FF44464D">
+    </SolidColorBrush>
+
+    <Style TargetType="Label">
+        <Setter Property="Foreground" Value="White"/>
+    </Style>
+
+    <Style TargetType="TextBox">
+        <Setter Property="Foreground" Value="White"/>
+        <Setter Property="BorderBrush" Value="Black"/>
+        <Setter Property="Background" Value="#33363C"/>
+    </Style>
+    
+    <Style TargetType="TextBlock">
+        <Setter Property="Foreground" Value="White"/>
+        <Setter Property="Background" Value="{x:Null}"/>
+    </Style>
+
+    <Style TargetType="ComboBox">
+        <Setter Property="Foreground" Value="White"/>
+        <Setter Property="BorderBrush" Value="Black"/>
+        <Setter Property="Background" Value="#33363C"/>
+    </Style>
+
+
+    <Style TargetType="ComboBoxItem">
+        <Setter Property="Background" Value="#33363C"/>
+        <Setter Property="BorderBrush" Value="Black"/>
+    </Style>
+
+
+    <Style TargetType="Button">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="Button">
+                    <Border Name="Border" 
+                            CornerRadius="15"
+                            Background="#33363C"
+                            BorderBrush="White" 
+                            MouseEnter="MouseEnter" 
+                            MouseLeave="MouseLeave">
+                        <ContentPresenter HorizontalAlignment="Center" 
+                                          VerticalAlignment="Center"/>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+        <Setter Property="Foreground" 
+                Value="White"/>
+    </Style>
+
+    <Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate>
+                    <Grid x:Name="Grid">
+                        <Border x:Name="Rectangle1" 
+                                CornerRadius="10 0 0 10" 
+                                HorizontalAlignment="Stretch" 
+                                VerticalAlignment="Stretch" 
+                                Width="Auto" 
+                                Height="Auto" 
+                                Background="{TemplateBinding Background}"/>
+                    </Grid>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+    <!--SCROLLBARS-->
+    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
+        <Setter Property="Foreground" Value="#FF2D2D30"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type ScrollBar}">
+                    <Grid x:Name="GridRoot" Width="12" Background="{x:Null}">
+                        <Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true" Focusable="False">
+                            <Track.Thumb>
+                                <Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" 
+                                               Style="{DynamicResource ScrollThumbs}"/>
+                            </Track.Thumb>
+                            <Track.IncreaseRepeatButton>
+                                <RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="False"/>
+                            </Track.IncreaseRepeatButton>
+                            <Track.DecreaseRepeatButton>
+                                <RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="False"/>
+                            </Track.DecreaseRepeatButton>
+                        </Track>
+                    </Grid>
+
+                    <ControlTemplate.Triggers>
+                        <Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
+                            <Setter Value="{DynamicResource ButtonSelectBrush}" 
+                                            TargetName="Thumb" Property="Background"/>
+                        </Trigger>
+                        <Trigger SourceName="Thumb" Property="IsDragging" Value="true">
+                            <Setter Value="{DynamicResource DarkBrush}" TargetName="Thumb" Property="Background"/>
+                        </Trigger>
+
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="Thumb" Property="Visibility" Value="Collapsed"/>
+                        </Trigger>
+                        <Trigger Property="Orientation" Value="Horizontal">
+                            <Setter TargetName="GridRoot" Property="LayoutTransform">
+                                <Setter.Value>
+                                    <RotateTransform Angle="-90"/>
+                                </Setter.Value>
+                            </Setter>
+                            <Setter TargetName="PART_Track" Property="LayoutTransform">
+                                <Setter.Value>
+                                    <RotateTransform Angle="-90"/>
+                                </Setter.Value>
+                            </Setter>
+                            <Setter Property="Width" Value="Auto"/>
+                            <Setter Property="Height" Value="12"/>
+                            <Setter TargetName="Thumb" Property="Tag" Value="Horizontal"/>
+                            <Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand"/>
+                            <Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+</ResourceDictionary>

+ 13 - 0
MyTests/cnt.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MyTests
+{
+    class cnt
+    {
+
+    }
+}

+ 5 - 0
MyTests/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.2.0" targetFramework="net472" />
+  <package id="EntityFramework.ru" version="6.2.0" targetFramework="net472" />
+</packages>

+ 20 - 0
UnitTestProject/Properties/AssemblyInfo.cs

@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("UnitTestProject")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UnitTestProject")]
+[assembly: AssemblyCopyright("Copyright ©  2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("76e7d484-bac1-4c25-a186-e219bfe27518")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 15 - 0
UnitTestProject/UnitTest1.cs

@@ -0,0 +1,15 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+
+namespace UnitTestProject
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+
+        }
+    }
+}

+ 68 - 0
UnitTestProject/UnitTestProject.csproj

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{76E7D484-BAC1-4C25-A186-E219BFE27518}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>UnitTestProject</RootNamespace>
+    <AssemblyName>UnitTestProject</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="UnitTest1.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
+  </Target>
+  <Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
+</Project>

+ 5 - 0
UnitTestProject/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
+  <package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
+</packages>