Imagara 2 gadi atpakaļ
vecāks
revīzija
4b627515dd

+ 3 - 0
MyTests/EDM.edmx

@@ -32,6 +32,7 @@
           <Property Name="Name" Type="nvarchar" MaxLength="150" Nullable="false" />
           <Property Name="Image" Type="varbinary(max)" />
           <Property Name="IsAnswersVisible" Type="bit" Nullable="false" />
+          <Property Name="IsVisible" Type="bit" Nullable="false" />
         </EntityType>
         <EntityType Name="Users">
           <Key>
@@ -152,6 +153,7 @@
           <NavigationProperty Name="Questions" Relationship="Self.FK_Questions_Tests" FromRole="Tests" ToRole="Questions" />
           <NavigationProperty Name="Users" Relationship="Self.FK_Tests_Users" FromRole="Tests" ToRole="Users" />
           <Property Name="IsAnswersVisible" Type="Boolean" Nullable="false" />
+          <Property Name="IsVisible" Type="Boolean" Nullable="false" />
         </EntityType>
         <EntityType Name="Users">
           <Key>
@@ -266,6 +268,7 @@
           <EntitySetMapping Name="Tests">
             <EntityTypeMapping TypeName="MyTestsDataBaseModel.Tests">
               <MappingFragment StoreEntitySet="Tests">
+                <ScalarProperty Name="IsVisible" ColumnName="IsVisible" />
                 <ScalarProperty Name="IsAnswersVisible" ColumnName="IsAnswersVisible" />
                 <ScalarProperty Name="IdTest" ColumnName="IdTest" />
                 <ScalarProperty Name="IdUser" ColumnName="IdUser" />

+ 14 - 0
MyTests/MyTests.csproj

@@ -82,6 +82,12 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EDM.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Pages\CheckTestResults.xaml.cs">
+      <DependentUpon>CheckTestResults.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\CheckTestResultsCatalog.xaml.cs">
+      <DependentUpon>CheckTestResultsCatalog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\CurTestPage.xaml.cs">
       <DependentUpon>CurTestPage.xaml</DependentUpon>
     </Compile>
@@ -146,6 +152,14 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="Pages\CheckTestResults.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Pages\CheckTestResultsCatalog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\CurTestPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 14 - 0
MyTests/Pages/CheckTestResults.xaml

@@ -0,0 +1,14 @@
+<Page x:Class="MyTests.Pages.CheckTestResults"
+      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="CheckTestResults">
+
+    <Grid>
+        
+    </Grid>
+</Page>

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

+ 53 - 0
MyTests/Pages/CheckTestResultsCatalog.xaml

@@ -0,0 +1,53 @@
+<Page x:Class="MyTests.Pages.CheckTestResultsCatalog"
+      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="CheckTestResultsCatalog">
+
+    <Grid Background="{StaticResource color1}">
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="50"/>
+        </Grid.RowDefinitions>
+
+        <ListBox Name="TestsListBox"
+                 Background="{StaticResource color1}"
+                 BorderBrush="{x:Null}">
+            <ScrollViewer VerticalScrollBarVisibility="Visible"/>
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <Border Width="{Binding Path=ActualWidth, ElementName=TestsListBox}"
+                            Margin="-10,0,0,0"
+                            Height="45"
+                            CornerRadius="10"
+                            Background="{StaticResource color2}"
+                            MouseDown="TestsListBox_Selected">
+                        <StackPanel Orientation="Horizontal">
+                            <Image Width="30"
+                               Height="30"
+                               Margin="10,5,5,5"
+                               HorizontalAlignment="Left"
+                               Source="/MyTests;component/Resources/approval.png">
+                            </Image>
+                            <StackPanel>
+                                <StackPanel Orientation="Horizontal">
+                                    <Label Content="{Binding Name}"/>
+                                    <Label Content="{Binding Users.Login}"/>
+                                </StackPanel>
+                                <TextBlock Margin="0,-7,0,0">
+                                    <Run Text="Вопросов: " Foreground="White"/>
+                                    <Run Text="{Binding Questions.Count, Mode=OneTime}" />
+                                </TextBlock>
+                            </StackPanel>
+                        </StackPanel>
+                    </Border>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
+
+    </Grid>
+</Page>

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

+ 1 - 1
MyTests/Pages/TestsCatalog.xaml.cs

@@ -32,7 +32,7 @@ namespace MyTests.Pages
         }
         void LoadingTests()
         {            
-            var list = cnt.db.Tests.ToList();
+            List<Tests> list = cnt.db.Tests.ToList();
             if (TestNameBox.Text != "Название теста")
                 list = list.Where(item => item.Name.StartsWith(TestNameBox.Text)).ToList();
             if (AuthorTestBox.Text != "Автор")