Задание
Создание приложения для проверки знаний учеников.
Функционал программы
- Создание и обновление тестов.
- Сохранение тестов в json.
- Удаление тестов.
- Прохождение теста.
Использованные технологии:
- C# + WPF(MVVM);
Фрагмент программного кода(страница прохождения теста)
<Window x:Class="TestProgram.Views.QuizPage" 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:TestProgram.Views" mc:Ignorable="d" Title="QuizPage" Height="500" Width="800" xmlns:viewmodels ="clr-namespace:TestProgram.ViewModels" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" Background="#e6e6e6" d:DataContext="{d:DesignInstance Type=viewmodels:QuizViewModel}" WindowStyle="None" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" MouseDown="Window_MouseDown" > <Window.Resources> <ResourceDictionary> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> </ResourceDictionary> </Window.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="10*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="10*"/> </Grid.RowDefinitions> <Button Grid.Row="0" Grid.Column="1" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Background="{x:Null}" BorderBrush="{x:Null}" HorizontalAlignment="Right" Width="30" Height="30" Margin="5" Command="{Binding CloseWindowCommand}"> <materialDesign:PackIcon Kind="Close" VerticalAlignment="Center" Width="20" Height="20" Foreground="#FF673AB7" /> </Button> <StackPanel Grid.Row="1" Grid.Column="1" Visibility="{Binding IsChooseQuizButtonVisible, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="300"> <ComboBox materialDesign:HintAssist.Hint="Выберите тест" ItemsSource="{Binding Quizes, UpdateSourceTrigger=PropertyChanged}" SelectedValue="{Binding SelectedQuiz}" DisplayMemberPath="Title" Margin="5" /> <StackPanel Orientation="Vertical" Margin="5"> <TextBlock Text="{Binding SelectedQuiz.Category, UpdateSourceTrigger=PropertyChanged, StringFormat=Категория: {0}}" Margin="5"/> <TextBlock Text="{Binding SelectedQuiz.QuestionsCount, UpdateSourceTrigger=PropertyChanged, StringFormat=Вопросов в тесте: {0}}" Margin="5"/> <TextBlock Text="{Binding SelectedQuiz.Description, UpdateSourceTrigger=PropertyChanged, StringFormat=Описание: {0}}" Margin="5"/> </StackPanel> <Button Content="Начать тест" Command="{Binding StartQuizCommand}" Margin="5" /> </StackPanel> <StackPanel Grid.Row="1" Grid.Column="1" Visibility="{Binding IsShowQuestionsEnabled, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="300"> <TextBlock Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="15"> <TextBlock.Text> <MultiBinding StringFormat="{}Вопрос: {0}/{1}"> <Binding Path="NumberOfCurrentQuestion"/> <Binding Path="SelectedQuiz.QuestionsCount"/> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBlock FontSize="15" Text="{Binding SelectedQuestion.QuestionName, UpdateSourceTrigger=PropertyChanged}" Margin="5" FontWeight="Bold"/> <ComboBox FontSize="15" materialDesign:HintAssist.Hint="Правильный ответ" ItemsSource="{Binding SelectedQuestion.Answers, UpdateSourceTrigger=PropertyChanged}" SelectedValue="{Binding SelectedAnswer, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="AnswerTitle" /> <Button Content="Следующий вопрос" Command="{Binding NextQuestionCommand}" Margin="10" Visibility="{Binding IsNextQuestionVisible, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}" /> <Button Content="Закончить тест" Command="{Binding EndQuizCommand}" Margin="10" Visibility="{Binding IsLastQuestionVisible, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}" /> </StackPanel> </Grid> </Window>
Содержание архива
- исходный код программы
FootballLife