Skip to content

Commit

Permalink
Merge pull request #2 from VFansss/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
VFansss authored Jan 10, 2021
2 parents 63e825a + 2e5a6e8 commit 92ad441
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 45 deletions.
4 changes: 4 additions & 0 deletions comquiz/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@

<sys:Double x:Key="FontSizeSmall">12</sys:Double>
<sys:Double x:Key="FontSizeNormal">14</sys:Double>
<sys:Double x:Key="FontSizeNormalPlus">15</sys:Double>
<sys:Double x:Key="FontSizeLarge">18</sys:Double>
<sys:Double x:Key="FontSizeLarger">20</sys:Double>
<sys:Double x:Key="FontSizeEnormous">30</sys:Double>
<sys:Double x:Key="FontSizeIntrusive">50</sys:Double>

<sys:Double x:Key="ScrollBarThickness">20</sys:Double>

Expand Down
2 changes: 1 addition & 1 deletion comquiz/Models/QuizSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static List<QuestionSheet> SplitTheQuiz(List<QuestionSheet> originalList,
// Sixth
equalPieces = 6;

if (quizPart == QUIZPARTIAL.Fifth)
if (quizPart == QUIZPARTIAL.Sixth)
{
wantTheLastPiece = true;
}
Expand Down
2 changes: 1 addition & 1 deletion comquiz/Properties/strings.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<value>Errore durante la lettura del QUIZ</value>
</data>
<data name="quizScreen_notEnoughSelectedAnswers" xml:space="preserve">
<value>Hai selezionato meno risposte di quanto dovresti. Mettici una pezza.</value>
<value>Hai selezionato meno risposte del dovuto. Selezionane altre dalla lista</value>
</data>
<data name="quizScreen_quizCompleted_1" xml:space="preserve">
<value>QUIZ completato. Risultato</value>
Expand Down
7 changes: 7 additions & 0 deletions comquiz/ViewModels/ControlsViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace comquiz.ViewModels
{
class ControlsViewModel : ViewModelBase
{

}
}
2 changes: 1 addition & 1 deletion comquiz/ViewModels/MainMenuViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MainMenuViewModel : ViewModelBase
{
readonly public MainWindowViewModel MainDatacontext;

public string _version = "v200410";
public string _version = "v210110";
public string Version
{
get => _version;
Expand Down
5 changes: 5 additions & 0 deletions comquiz/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@ public void DisplayAboutScreen()
MainWindowContent = new AboutScreenViewModel();
}

public void DisplayControlsScreen()
{
MainWindowContent = new ControlsViewModel();
}

}
}
37 changes: 24 additions & 13 deletions comquiz/ViewModels/QuizScreenViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public QuizSheet CurrentQuiz
public QuestionSheet CurrentQuestion
{
get => _currentQuestion;
set => this.RaiseAndSetIfChanged(ref _currentQuestion, value);
set
{
this.RaiseAndSetIfChanged(ref _currentQuestion, value);

WarningForNotEnoughAnswer = false;

}
}

short _currentQuestionNumber;
Expand Down Expand Up @@ -53,9 +59,14 @@ public bool SpoilRightAnswer
set => this.RaiseAndSetIfChanged(ref _spoilRightAnswer, value);
}

bool _warningForNotEnoughAnswer = false;
public bool WarningForNotEnoughAnswer
{
get => _warningForNotEnoughAnswer;
set => this.RaiseAndSetIfChanged(ref _warningForNotEnoughAnswer, value);
}



bool QuizIsOver = false;

public QuizScreenViewModel(MainWindowViewModel parentDataContext)
{
Expand Down Expand Up @@ -97,7 +108,11 @@ public void ShowAnswers()

public void NextQuestion()
{
MarkChoosedAnswers();

if (CurrentQuestion.NumberOfRightAnswers == SelectedAnswers?.Count)
{
MarkChoosedAnswers();
}

ANSWERED questionStatus = CurrentQuestion.GetQuestionStatus();

Expand All @@ -115,7 +130,9 @@ public void NextQuestion()
{
// QUIZ FINISHED!

DisplayQuizResult();
if(!QuizIsOver) DisplayQuizResult();

QuizIsOver = true;

}
else
Expand Down Expand Up @@ -175,15 +192,9 @@ public void DisplayQuizResult()
AnsweringEnabled = false;
}

public static void ShowNotEnoughAnswersAlert()
public void ShowNotEnoughAnswersAlert()
{
var messageBoxStandardWindow = MessageBox.Avalonia.MessageBoxManager.GetMessageBoxStandardWindow(
"( ⚆ _ ⚆ )",
Properties.strings.quizScreen_notEnoughSelectedAnswers,
MessageBox.Avalonia.Enums.ButtonEnum.Ok,
MessageBox.Avalonia.Enums.Icon.Info);

messageBoxStandardWindow.Show();
WarningForNotEnoughAnswer = true;
}


Expand Down
6 changes: 3 additions & 3 deletions comquiz/Views/AboutScreenView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<UserControl.Styles>

<Style Selector="TextBlock.personal">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormalPlus}"/>
</Style>

</UserControl.Styles>
Expand All @@ -37,11 +37,11 @@

</DockPanel.Styles>

<Button FontSize="14" Command="{Binding $parent[Window].DataContext.DisplayMainMenu}">
<Button Command="{Binding $parent[Window].DataContext.DisplayMainMenu}">
Return to Main Menu
</Button>

<TextBlock FontSize="52" Text="Thanks &amp; Legal"/>
<TextBlock FontSize="{DynamicResource FontSizeIntrusive}" Text="Thanks &amp; Legal"/>

<TextBlock Classes="personal">
A huge thanks to the Avalonia UI community for the tremendous help and understanding they gave me during my learning
Expand Down
75 changes: 75 additions & 0 deletions comquiz/Views/ControlsView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<UserControl xmlns="https://github.com/avaloniaui"
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"
mc:Ignorable="d"
x:Class="comquiz.Views.ControlsView">

<UserControl.Styles>

<Style Selector="TextBlock.personal">
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormalPlus}"/>
</Style>

</UserControl.Styles>

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">

<DockPanel Margin="50" VerticalAlignment="Center" HorizontalAlignment="Center">

<DockPanel.Styles>

<Style Selector="Button">
<Setter Property="Margin" Value="0 10"/>
<Setter Property="DockPanel.Dock" Value="Top"/>
</Style>

<Style Selector="DockPanel > TextBlock">
<Setter Property="Margin" Value="0 10"/>
<Setter Property="Foreground" Value="{DynamicResource HighlightBrush}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="DockPanel.Dock" Value="Top"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>

</DockPanel.Styles>

<Button Command="{Binding $parent[Window].DataContext.DisplayMainMenu}">
Return to Main Menu
</Button>

<TextBlock FontSize="{DynamicResource FontSizeIntrusive}" Text="Mouse &amp; KB Shortcuts"/>

<TextBlock FontSize="{DynamicResource FontSizeLarger}" Text="While you are on the quiz screen, you can use these shortcuts:"/>

<TextBlock FontSize="{DynamicResource FontSizeLarge}" Text="(Mouse)"/>

<TextBlock>
Mouse central button (Wheel button) - SHOW RIGHT ANSWERS
</TextBlock>

<TextBlock FontSize="{DynamicResource FontSizeLarge}" Text="(Keyboard)"/>

<TextBlock>
1-9 Number buttons, 1-9 Numpad Buttons - SELECT ANSWERS
</TextBlock>

<TextBlock>
Right arrow, Enter, Enter (Numpad) - NEXT QUESTION
</TextBlock>

<TextBlock>
Spacebar, 0 on Numpad - SHOW RIGHT ANSWERS
</TextBlock>

<TextBlock>
Esc - END THE QUIZ
</TextBlock>


</DockPanel>

</ScrollViewer>

</UserControl>
20 changes: 20 additions & 0 deletions comquiz/Views/ControlsView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace comquiz.Views
{
public class ControlsView : UserControl
{
public ControlsView()
{
this.InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);

}

}
}
49 changes: 40 additions & 9 deletions comquiz/Views/MainMenuView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:localization="clr-namespace:comquiz.Properties"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="600"
d:DesignWidth="1024"
d:DesignHeight="768"
x:Class="comquiz.Views.MainMenuView"
xmlns:local="clr-namespace:comquiz">

Expand All @@ -25,15 +25,15 @@

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1">

<TextBlock TextAlignment="Center" FontSize="20" Margin="0 0 0 10" Text="{x:Static localization:strings.mainMenu_toStartMessage}"/>
<TextBlock TextAlignment="Center" FontSize="{DynamicResource FontSizeLarger}" Margin="0 0 0 10" Text="{x:Static localization:strings.mainMenu_toStartMessage}"/>

<Button Background="Transparent" HorizontalAlignment="Center" Grid.Row="1" Command="{Binding PickQuizFromFile}" CommandParameter="{Binding $parent[Window]}" Content="{x:Static localization:strings.mainMenu_chooseFileButtonLabel}" />

<StackPanel IsVisible="{Binding $parent[Window].DataContext.CurrentQuiz, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" HorizontalAlignment="Center" Margin="0 10">

<TextBlock Text="{x:Static localization:strings.mainMenu_quizLoadedLabel}" HorizontalAlignment="Center"/>

<TextBlock Foreground="{DynamicResource ThemeBorderMidBrush}" Margin="10 0" FontSize="30" Text="{Binding $parent[Window].DataContext.CurrentQuiz.Title}" HorizontalAlignment="Center"/>
<TextBlock Foreground="{DynamicResource ThemeBorderMidBrush}" Margin="10 0" FontSize="{DynamicResource FontSizeEnormous}" Text="{Binding $parent[Window].DataContext.CurrentQuiz.Title}" HorizontalAlignment="Center"/>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

Expand Down Expand Up @@ -216,7 +216,7 @@

</StackPanel>

<Button FontSize="18" Grid.Row="1" Margin="0 25 0 0" HorizontalAlignment="Center" Command="{Binding $parent[Window].DataContext.DisplayQuizScreen}" Content="{x:Static localization:strings.mainMenu_displayQuizScreen}"/>
<Button FontSize="{DynamicResource FontSizeLarge}" Grid.Row="1" Margin="0 25 0 0" HorizontalAlignment="Center" Command="{Binding $parent[Window].DataContext.DisplayQuizScreen}" Content="{x:Static localization:strings.mainMenu_displayQuizScreen}"/>

</StackPanel>

Expand All @@ -230,21 +230,52 @@
<Setter Property="Foreground" Value="{DynamicResource HighlightBrush}"/>
<Setter Property="Margin" Value="5"/>
</Style>

<Style Selector="Border">
<Setter Property="BorderBrush" Value="{DynamicResource HighlightBrush}"/>
<Setter Property="BorderThickness" Value="0 0 0 4"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0 0 0 4"/>
<Setter Property="Cursor" Value="Hand"/>
</Style>

</StackPanel.Styles>

<Border BorderBrush="{DynamicResource HighlightBrush}" Cursor="Hand" BorderThickness="0 0 0 4" Padding="0" Margin="0 0 0 4">
<Border>
<TextBlock x:Name="txt_font" Text="Change font"/>
</Border>

<TextBlock Text="-"/>
<TextBlock Text="{Binding Version}"/>
<TextBlock Text="-"/>

<Border BorderBrush="{DynamicResource HighlightBrush}" Cursor="Hand" BorderThickness="0 0 0 4" Padding="0" Margin="0 0 0 4">
<Border>
<TextBlock x:Name="txt_controls" Text="Mouse &amp; KB Shortcuts"/>
</Border>

<TextBlock Text="-"/>

<Border>
<TextBlock x:Name="txt_about" Text="Thanks &amp; Legal"/>
</Border>

<TextBlock Text="-"/>

<TextBlock Text="{Binding Version}"/>

<TextBlock Text="-"/>

<Border Cursor="Arrow" BorderThickness="0">
<TextBlock Text="Font size "/>
</Border>

<Border>
<TextBlock x:Name="txt_fontsizeDown" Text="Decrease"/>
</Border>

<TextBlock Text=" "/>

<Border>
<TextBlock x:Name="txt_fontsizeUp" Text="Increase"/>
</Border>

</StackPanel>

Expand Down
Loading

0 comments on commit 92ad441

Please sign in to comment.