瀏覽代碼

Результат + переделка вопросов

Imagara 2 年之前
父節點
當前提交
9ac91b85f1

+ 1 - 1
MyTests/EDM.Designer.cs

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

+ 105 - 106
MyTests/EDM.edmx

@@ -4,74 +4,74 @@
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-    <Schema Namespace="Хранилище MyTestsDataBaseModel" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
-        <EntityType Name="Questions">
-          <Key>
-            <PropertyRef Name="IdQuestion" />
-          </Key>
-          <Property Name="IdQuestion" Type="int" Nullable="false" />
-          <Property Name="IdTest" Type="int" Nullable="false" />
-          <Property Name="Content" Type="nvarchar" MaxLength="150" Nullable="false" />
-          <Property Name="Answer" Type="nvarchar" MaxLength="150" Nullable="false" />
-        </EntityType>
-        <EntityType Name="Tests">
-          <Key>
-            <PropertyRef Name="IdTest" />
-          </Key>
-          <Property Name="IdTest" Type="int" Nullable="false" />
-          <Property Name="IdUser" Type="int" Nullable="false" />
-          <Property Name="Name" Type="nvarchar" MaxLength="150" Nullable="false" />
-          <Property Name="Image" Type="varbinary(max)" />
-        </EntityType>
-        <EntityType Name="Users">
-          <Key>
-            <PropertyRef Name="IdUser" />
-          </Key>
-          <Property Name="IdUser" Type="int" Nullable="false" />
-          <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Email" Type="nvarchar" MaxLength="50" Nullable="false" />
-          <Property Name="Info" Type="nvarchar" MaxLength="50" />
-          <Property Name="Image" Type="varbinary(max)" />
-        </EntityType>
-        <Association Name="FK_Questions_Tests">
-          <End Role="Tests" Type="Self.Tests" Multiplicity="1" />
-          <End Role="Questions" Type="Self.Questions" Multiplicity="*" />
-          <ReferentialConstraint>
-            <Principal Role="Tests">
-              <PropertyRef Name="IdTest" />
-            </Principal>
-            <Dependent Role="Questions">
-              <PropertyRef Name="IdTest" />
-            </Dependent>
-          </ReferentialConstraint>
-        </Association>
-        <Association Name="FK_Tests_Users">
-          <End Role="Users" Type="Self.Users" Multiplicity="1" />
-          <End Role="Tests" Type="Self.Tests" Multiplicity="*" />
-          <ReferentialConstraint>
-            <Principal Role="Users">
-              <PropertyRef Name="IdUser" />
-            </Principal>
-            <Dependent Role="Tests">
-              <PropertyRef Name="IdUser" />
-            </Dependent>
-          </ReferentialConstraint>
-        </Association>
-        <EntityContainer Name="Хранилище MyTestsDataBaseModelContainer">
-          <EntitySet Name="Questions" EntityType="Self.Questions" Schema="dbo" store:Type="Tables" />
-          <EntitySet Name="Tests" EntityType="Self.Tests" Schema="dbo" store:Type="Tables" />
-          <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
-          <AssociationSet Name="FK_Questions_Tests" Association="Self.FK_Questions_Tests">
-            <End Role="Tests" EntitySet="Tests" />
-            <End Role="Questions" EntitySet="Questions" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Tests_Users" Association="Self.FK_Tests_Users">
-            <End Role="Users" EntitySet="Users" />
-            <End Role="Tests" EntitySet="Tests" />
-          </AssociationSet>
-        </EntityContainer>
-      </Schema></edmx:StorageModels>
+    <Schema Namespace="MyTestsDataBaseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2012" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+  <EntityContainer Name="MyTestsDataBaseModelStoreContainer">
+    <EntitySet Name="Questions" EntityType="MyTestsDataBaseModel.Store.Questions" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Tests" EntityType="MyTestsDataBaseModel.Store.Tests" store:Type="Tables" Schema="dbo" />
+    <EntitySet Name="Users" EntityType="MyTestsDataBaseModel.Store.Users" store:Type="Tables" Schema="dbo" />
+    <AssociationSet Name="FK_Questions_Tests" Association="MyTestsDataBaseModel.Store.FK_Questions_Tests">
+      <End Role="Tests" EntitySet="Tests" />
+      <End Role="Questions" EntitySet="Questions" />
+    </AssociationSet>
+    <AssociationSet Name="FK_Tests_Users" Association="MyTestsDataBaseModel.Store.FK_Tests_Users">
+      <End Role="Users" EntitySet="Users" />
+      <End Role="Tests" EntitySet="Tests" />
+    </AssociationSet>
+  </EntityContainer>
+  <EntityType Name="Questions">
+    <Key>
+      <PropertyRef Name="IdQuestion" />
+    </Key>
+    <Property Name="IdQuestion" Type="int" Nullable="false" />
+    <Property Name="IdTest" Type="int" Nullable="false" />
+    <Property Name="Content" Type="nvarchar" Nullable="false" MaxLength="150" />
+    <Property Name="Answer" Type="nvarchar" Nullable="false" MaxLength="150" />
+  </EntityType>
+  <EntityType Name="Tests">
+    <Key>
+      <PropertyRef Name="IdTest" />
+    </Key>
+    <Property Name="IdTest" Type="int" Nullable="false" />
+    <Property Name="IdUser" Type="int" Nullable="false" />
+    <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="150" />
+    <Property Name="Image" Type="varbinary(max)" Nullable="true" />
+  </EntityType>
+  <EntityType Name="Users">
+    <Key>
+      <PropertyRef Name="IdUser" />
+    </Key>
+    <Property Name="IdUser" Type="int" Nullable="false" />
+    <Property Name="Login" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Password" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Email" Type="nvarchar" Nullable="false" MaxLength="50" />
+    <Property Name="Info" Type="nvarchar" Nullable="true" MaxLength="50" />
+    <Property Name="Image" Type="varbinary(max)" Nullable="true" />
+  </EntityType>
+  <Association Name="FK_Questions_Tests">
+    <End Role="Tests" Type="MyTestsDataBaseModel.Store.Tests" Multiplicity="1" />
+    <End Role="Questions" Type="MyTestsDataBaseModel.Store.Questions" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Tests">
+        <PropertyRef Name="IdTest" />
+      </Principal>
+      <Dependent Role="Questions">
+        <PropertyRef Name="IdTest" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+  <Association Name="FK_Tests_Users">
+    <End Role="Users" Type="MyTestsDataBaseModel.Store.Users" Multiplicity="1" />
+    <End Role="Tests" Type="MyTestsDataBaseModel.Store.Tests" Multiplicity="*" />
+    <ReferentialConstraint>
+      <Principal Role="Users">
+        <PropertyRef Name="IdUser" />
+      </Principal>
+      <Dependent Role="Tests">
+        <PropertyRef Name="IdUser" />
+      </Dependent>
+    </ReferentialConstraint>
+  </Association>
+</Schema></edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="MyTestsDataBaseModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
@@ -149,43 +149,42 @@
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
     <edmx:Mappings>
-      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
-        <EntityContainerMapping StorageEntityContainer="Хранилище MyTestsDataBaseModelContainer" CdmEntityContainer="MyTestsDataBaseEntities">
-          <EntitySetMapping Name="Questions">
-            <EntityTypeMapping TypeName="MyTestsDataBaseModel.Questions">
-              <MappingFragment StoreEntitySet="Questions">
-                <ScalarProperty Name="Answer" ColumnName="Answer" />
-                <ScalarProperty Name="IdQuestion" ColumnName="IdQuestion" />
-                <ScalarProperty Name="IdTest" ColumnName="IdTest" />
-                <ScalarProperty Name="Content" ColumnName="Content" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
-          <EntitySetMapping Name="Tests">
-            <EntityTypeMapping TypeName="MyTestsDataBaseModel.Tests">
-              <MappingFragment StoreEntitySet="Tests">
-                <ScalarProperty Name="IdTest" ColumnName="IdTest" />
-                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
-                <ScalarProperty Name="Name" ColumnName="Name" />
-                <ScalarProperty Name="Image" ColumnName="Image" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
-          <EntitySetMapping Name="Users">
-            <EntityTypeMapping TypeName="MyTestsDataBaseModel.Users">
-              <MappingFragment StoreEntitySet="Users">
-                <ScalarProperty Name="IdUser" ColumnName="IdUser" />
-                <ScalarProperty Name="Login" ColumnName="Login" />
-                <ScalarProperty Name="Password" ColumnName="Password" />
-                <ScalarProperty Name="Email" ColumnName="Email" />
-                <ScalarProperty Name="Info" ColumnName="Info" />
-                <ScalarProperty Name="Image" ColumnName="Image" />
-              </MappingFragment>
-            </EntityTypeMapping>
-          </EntitySetMapping>
-        </EntityContainerMapping>
-      </Mapping>
-    </edmx:Mappings>
+    <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
+  <EntityContainerMapping StorageEntityContainer="MyTestsDataBaseModelStoreContainer" CdmEntityContainer="MyTestsDataBaseEntities">
+    <EntitySetMapping Name="Questions">
+      <EntityTypeMapping TypeName="IsTypeOf(MyTestsDataBaseModel.Questions)">
+        <MappingFragment StoreEntitySet="Questions">
+          <ScalarProperty Name="IdQuestion" ColumnName="IdQuestion" />
+          <ScalarProperty Name="IdTest" ColumnName="IdTest" />
+          <ScalarProperty Name="Content" ColumnName="Content" />
+          <ScalarProperty Name="Answer" ColumnName="Answer" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Tests">
+      <EntityTypeMapping TypeName="IsTypeOf(MyTestsDataBaseModel.Tests)">
+        <MappingFragment StoreEntitySet="Tests">
+          <ScalarProperty Name="IdTest" ColumnName="IdTest" />
+          <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+          <ScalarProperty Name="Name" ColumnName="Name" />
+          <ScalarProperty Name="Image" ColumnName="Image" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+    <EntitySetMapping Name="Users">
+      <EntityTypeMapping TypeName="IsTypeOf(MyTestsDataBaseModel.Users)">
+        <MappingFragment StoreEntitySet="Users">
+          <ScalarProperty Name="IdUser" ColumnName="IdUser" />
+          <ScalarProperty Name="Login" ColumnName="Login" />
+          <ScalarProperty Name="Password" ColumnName="Password" />
+          <ScalarProperty Name="Email" ColumnName="Email" />
+          <ScalarProperty Name="Info" ColumnName="Info" />
+          <ScalarProperty Name="Image" ColumnName="Image" />
+        </MappingFragment>
+      </EntityTypeMapping>
+    </EntitySetMapping>
+  </EntityContainerMapping>
+</Mapping></edmx:Mappings>
   </edmx:Runtime>
   <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
   <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
@@ -199,7 +198,7 @@
         <DesignerProperty Name="ValidateOnBuild" Value="true" />
         <DesignerProperty Name="EnablePluralization" Value="false" />
         <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
-        <DesignerProperty Name="UseLegacyProvider" Value="false" />
+        <DesignerProperty Name="UseLegacyProvider" Value="False" />
         <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
       </DesignerInfoPropertySet>
     </Options>

+ 1 - 1
MyTests/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="a3a420bb96024b0f95a0dd865890e046" Name="Diagram1">
+      <Diagram DiagramId="a3a420bb96024b0f95a0dd865890e046" Name="Diagram1" ZoomLevel="132">
         <EntityTypeShape EntityType="MyTestsDataBaseModel.Questions" Width="1.5" PointX="5.25" PointY="1" IsExpanded="true" />
         <EntityTypeShape EntityType="MyTestsDataBaseModel.Tests" Width="1.5" PointX="3" PointY="1" IsExpanded="true" />
         <EntityTypeShape EntityType="MyTestsDataBaseModel.Users" Width="1.5" PointX="0.75" PointY="1" IsExpanded="true" />

+ 132 - 0
MyTests/EDM.edmx.sql

@@ -0,0 +1,132 @@
+
+-- --------------------------------------------------
+-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
+-- --------------------------------------------------
+-- Date Created: 06/14/2022 12:14:13
+-- Generated from EDMX file: C:\Users\gr692_gav\source\repos\MyTests\MyTests\EDM.edmx
+-- --------------------------------------------------
+
+SET QUOTED_IDENTIFIER OFF;
+GO
+USE [MyTestsDataBase];
+GO
+IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
+GO
+
+-- --------------------------------------------------
+-- Dropping existing FOREIGN KEY constraints
+-- --------------------------------------------------
+
+IF OBJECT_ID(N'[dbo].[FK_Questions_Tests]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Questions] DROP CONSTRAINT [FK_Questions_Tests];
+GO
+IF OBJECT_ID(N'[dbo].[FK_Tests_Users]', 'F') IS NOT NULL
+    ALTER TABLE [dbo].[Tests] DROP CONSTRAINT [FK_Tests_Users];
+GO
+
+-- --------------------------------------------------
+-- Dropping existing tables
+-- --------------------------------------------------
+
+IF OBJECT_ID(N'[dbo].[Questions]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Questions];
+GO
+IF OBJECT_ID(N'[dbo].[Tests]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Tests];
+GO
+IF OBJECT_ID(N'[dbo].[Users]', 'U') IS NOT NULL
+    DROP TABLE [dbo].[Users];
+GO
+
+-- --------------------------------------------------
+-- Creating all tables
+-- --------------------------------------------------
+
+-- Creating table 'Questions'
+CREATE TABLE [dbo].[Questions] (
+    [IdQuestion] int  NOT NULL,
+    [IdTest] int  NOT NULL,
+    [Content] nvarchar(150)  NOT NULL,
+    [Answer] nvarchar(150)  NOT NULL
+);
+GO
+
+-- Creating table 'Tests'
+CREATE TABLE [dbo].[Tests] (
+    [IdTest] int  NOT NULL,
+    [IdUser] int  NOT NULL,
+    [Name] nvarchar(150)  NOT NULL,
+    [Image] varbinary(max)  NULL
+);
+GO
+
+-- Creating table 'Users'
+CREATE TABLE [dbo].[Users] (
+    [IdUser] int  NOT NULL,
+    [Login] nvarchar(50)  NOT NULL,
+    [Password] nvarchar(50)  NOT NULL,
+    [Email] nvarchar(50)  NOT NULL,
+    [Info] nvarchar(50)  NULL,
+    [Image] varbinary(max)  NULL
+);
+GO
+
+-- --------------------------------------------------
+-- Creating all PRIMARY KEY constraints
+-- --------------------------------------------------
+
+-- Creating primary key on [IdQuestion] in table 'Questions'
+ALTER TABLE [dbo].[Questions]
+ADD CONSTRAINT [PK_Questions]
+    PRIMARY KEY CLUSTERED ([IdQuestion] ASC);
+GO
+
+-- Creating primary key on [IdTest] in table 'Tests'
+ALTER TABLE [dbo].[Tests]
+ADD CONSTRAINT [PK_Tests]
+    PRIMARY KEY CLUSTERED ([IdTest] ASC);
+GO
+
+-- Creating primary key on [IdUser] in table 'Users'
+ALTER TABLE [dbo].[Users]
+ADD CONSTRAINT [PK_Users]
+    PRIMARY KEY CLUSTERED ([IdUser] ASC);
+GO
+
+-- --------------------------------------------------
+-- Creating all FOREIGN KEY constraints
+-- --------------------------------------------------
+
+-- Creating foreign key on [IdTest] in table 'Questions'
+ALTER TABLE [dbo].[Questions]
+ADD CONSTRAINT [FK_Questions_Tests]
+    FOREIGN KEY ([IdTest])
+    REFERENCES [dbo].[Tests]
+        ([IdTest])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK_Questions_Tests'
+CREATE INDEX [IX_FK_Questions_Tests]
+ON [dbo].[Questions]
+    ([IdTest]);
+GO
+
+-- Creating foreign key on [IdUser] in table 'Tests'
+ALTER TABLE [dbo].[Tests]
+ADD CONSTRAINT [FK_Tests_Users]
+    FOREIGN KEY ([IdUser])
+    REFERENCES [dbo].[Users]
+        ([IdUser])
+    ON DELETE NO ACTION ON UPDATE NO ACTION;
+GO
+
+-- Creating non-clustered index for FOREIGN KEY 'FK_Tests_Users'
+CREATE INDEX [IX_FK_Tests_Users]
+ON [dbo].[Tests]
+    ([IdUser]);
+GO
+
+-- --------------------------------------------------
+-- Script has ended
+-- --------------------------------------------------

+ 5 - 4
MyTests/MainWindow.xaml

@@ -35,7 +35,7 @@
                             FontWeight="Bold" 
                             Click="ButtonMininize_Click"/>
 
-                    <Button Visibility="Collapsed"
+                    <Button Visibility="Visible"
                             Width="20" Height="20"
                             Content="☐"
                             Background="Transparent"
@@ -45,7 +45,8 @@
                             Click="WindowStateButton_Click"/>
 
 
-                    <Button Width="20" Height="20"
+                    <Button Width="20" 
+                            Height="20"
                             Content="X"
                             Background="Transparent"
                             BorderThickness="0"
@@ -57,8 +58,8 @@
         </Border>
         <Grid Grid.Row="1">
             <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="31*"/>
-                <ColumnDefinition Width="169*"/>
+                <ColumnDefinition Width="124"/>
+                <ColumnDefinition/>
             </Grid.ColumnDefinitions>
 
             <StackPanel Background="{StaticResource color2}" 

+ 15 - 0
MyTests/MyTests.csproj

@@ -79,9 +79,15 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EDM.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Pages\CurTestPage.xaml.cs">
+      <DependentUpon>CurTestPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\ProfilePage.xaml.cs">
       <DependentUpon>ProfilePage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\ResultTestPage.xaml.cs">
+      <DependentUpon>ResultTestPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\TestPage.xaml.cs">
       <DependentUpon>TestPage.xaml</DependentUpon>
     </Compile>
@@ -128,10 +134,18 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Pages\CurTestPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\ProfilePage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\ResultTestPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\TestPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -191,6 +205,7 @@
       <DependentUpon>EDM.edmx</DependentUpon>
       <LastGenOutput>EDM.Context.cs</LastGenOutput>
     </Content>
+    <Content Include="EDM.edmx.sql" />
     <Content Include="EDM.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
       <DependentUpon>EDM.edmx</DependentUpon>

+ 44 - 0
MyTests/Pages/CurTestPage.xaml

@@ -0,0 +1,44 @@
+<Page x:Class="MyTests.Pages.CurTestPage"
+      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="450" d:DesignWidth="800"
+      Title="CurTestPage"
+      Background="{StaticResource color1}">
+
+    <Grid Margin="20" 
+          Background="{StaticResource color2}">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="321*"/>
+            <RowDefinition Height="89*"/>
+        </Grid.RowDefinitions>
+        <TextBlock Name="QuestionBox"
+                   Text="{Binding Content}"
+                   VerticalAlignment="Center"
+                   HorizontalAlignment="Center"
+                   FontSize="40"
+                   TextWrapping="Wrap" Height="54" Width="0">
+        </TextBlock>
+        <StackPanel Grid.Row="1"
+                    Orientation="Horizontal"
+                    VerticalAlignment="Center"
+                    HorizontalAlignment="Center"
+                    Height="40">
+            <TextBox Name="AnswerBox"
+                     Width="250" 
+                     Margin="0,0,10,0"/>
+
+            <Button Name="NextButton"
+                    Content="Далее"
+                    Width="120"
+                    Margin="10,0,0,0"
+                    Click="NextButton_Click">
+
+            </Button>
+
+        </StackPanel>
+    </Grid>
+</Page>

+ 35 - 0
MyTests/Pages/CurTestPage.xaml.cs

@@ -0,0 +1,35 @@
+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
+{
+    public partial class CurTestPage : Page
+    {
+        public CurTestPage()
+        {
+            InitializeComponent();
+            QuestionBox.Text = Session.Quest.Content[Session.CurQuestion];
+        }
+
+        private void NextButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (AnswerBox.Text == Session.Quest.Answer[Session.CurQuestion])
+                Session.Points++;
+            //if(Session.CurQuestion-1 == Session.Quest.Answer.Length)
+                
+
+        }
+    }
+}

+ 2 - 2
MyTests/Pages/ProfilePage.xaml.cs

@@ -41,13 +41,13 @@ namespace MyTests.Pages
         }
         private void TestsLoading()
         {
-            foreach (Tests test in cnt.db.Tests.Where(item => item.IdUser == Session.userId).ToList())
+            foreach (Tests test in cnt.db.Tests.Where(item => item.IdUser == Session.UserId).ToList())
             {
                 try
                 {
                     BitmapImage img = test.Image == null ?
                         new BitmapImage(new Uri("../Resources/StandartProfile.png", UriKind.RelativeOrAbsolute)) :
-                        ImagesManip.NewImage(cnt.db.Users.Where(item => item.IdUser == Session.userId).FirstOrDefault());
+                        ImagesManip.NewImage(cnt.db.Users.Where(item => item.IdUser == Session.UserId).FirstOrDefault());
                     AddTest(test.Name, img, cnt.db.Questions.Where(item => item.IdTest == test.IdTest).Count());
                 }
                 catch (Exception ex)

+ 51 - 0
MyTests/Pages/ResultTestPage.xaml

@@ -0,0 +1,51 @@
+<Page x:Class="MyTests.Pages.ResultTestPage"
+      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="450" d:DesignWidth="800"
+      Title="ResultTestPage"
+      Background="{StaticResource color1}">
+
+    <Grid Margin="20" 
+          Background="{StaticResource color2}">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="321*"/>
+            <RowDefinition Height="89*"/>
+        </Grid.RowDefinitions>
+
+        <StackPanel Orientation="Vertical"
+                    HorizontalAlignment="Center"
+                    VerticalAlignment="Center">
+            <TextBlock FontSize="50">
+                <Run Text="Вы прошли тест"/>
+                <LineBreak/>
+                <Run Text="Ваш результат"/>
+            </TextBlock>
+            <TextBlock Name="ResultTB"
+                       Text="0/20"
+                       FontSize="50"
+                       HorizontalAlignment="Center">
+            </TextBlock>
+        </StackPanel>
+
+        <StackPanel Grid.Row="1"
+                    Orientation="Horizontal"
+                    VerticalAlignment="Center"
+                    HorizontalAlignment="Center"
+                    Height="40">
+            <Button Content="Посмотреть мои ответы"
+                    Width="150"
+                    Margin="10,0,0,0"
+                    Click="Button_Click"/>
+            <Button 
+                    Content="Выход"
+                    Width="150"
+                    Margin="10,0,0,0"
+                    Click="NextButton_Click"/>
+
+        </StackPanel>
+    </Grid>
+</Page>

+ 31 - 0
MyTests/Pages/ResultTestPage.xaml.cs

@@ -0,0 +1,31 @@
+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
+{
+    public partial class ResultTestPage : Page
+    {
+        public ResultTestPage()
+        {
+            InitializeComponent();
+            ResultTB.Text = $"{Session.Points}/{Session.OpenedTest.Questions.Count}";
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+    }
+}

+ 1 - 0
MyTests/Pages/TestsCatalog.xaml

@@ -56,6 +56,7 @@
             <ListBox.ItemTemplate>
                 <DataTemplate>
                     <Border Width="{Binding Path=ActualWidth, ElementName=TestsListBox}"
+                            Margin="-10,0,0,0"
                             Height="45"
                             CornerRadius="10"
                             Background="{StaticResource color2}"

+ 62 - 2
MyTests/Pages/TestsCatalog.xaml.cs

@@ -51,8 +51,12 @@ namespace MyTests.Pages
             {
                 if (((Tests)TestsListBox.SelectedItem) != null)
                 {
-                    NavigationService.Navigate(new Pages.TestPage(((Tests)TestsListBox.SelectedItem).IdTest));
-                    Session.openedTest = ((Tests)TestsListBox.SelectedItem).IdTest;
+                    Session.OpenedTest = cnt.db.Tests.Where(item => item.IdTest == ((Tests)TestsListBox.SelectedItem).IdTest).FirstOrDefault();
+                    NavigationService.Navigate(new Pages.TestPage(Session.OpenedTest.IdTest));
+                    Session.Points = 0;
+                    Session.CurQuestion = 0;
+                    Session.Quest.Answer = cnt.db.Questions.Where(item => item.IdTest == Session.OpenedTest.IdTest).Select(item => item.Answer).ToArray();
+                    Session.Quest.Content = cnt.db.Questions.Where(item => item.IdTest == Session.OpenedTest.IdTest).Select(item => item.Content).ToArray();
                 }
             }
             catch
@@ -62,3 +66,59 @@ namespace MyTests.Pages
         }
     }
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//拯救我们被关在地下室

+ 9 - 4
MyTests/Session.cs

@@ -8,9 +8,14 @@ namespace MyTests
 {
     class Session
     {
-        public static int userId = 1; //{ get; set; }
-        public static int openedTest { get; set; }
-        public static int points = 0;
-        public static int question = 1;
+        public static int UserId = 1; //{ get; set; }
+        public static Tests OpenedTest { get; set; }
+        public static int Points = 0;
+        public static int CurQuestion = 1;
+        public class Quest
+        {
+            public static string[] Content = new string[OpenedTest.Questions.Count];
+            public static string[] Answer = new string[OpenedTest.Questions.Count];
+        }
     }
 }