Skip to content

Commit

Permalink
fix: First letter bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
eymenefealtun committed Aug 5, 2023
1 parent b864d95 commit 5e71e10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 54 deletions.
47 changes: 2 additions & 45 deletions TarotType.Main/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Style="{StaticResource ChangeThemeToggleButtonTheme}">

</ToggleButton>

<StackPanel VerticalAlignment="Center"
HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal"
Expand All @@ -39,51 +40,7 @@
Value="10,0,0,0" />
</Style>
</StackPanel.Resources>
<!--#region trial -->
<!--<TextBlock
FontFamily="/Fonts/#Poppins"
FontSize="20"
VerticalAlignment="Center"
Text="dasdas asdasd dasdas asdasd dasdas"/>-->
<!--<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="yyyy"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />
<TextBlock Height="50"
Text="hello"
FontFamily="/Fonts/#Poppins"
FontSize="20" />-->


<!--#endregion-->


</StackPanel>

Expand Down
11 changes: 5 additions & 6 deletions TarotType.Main/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private void tboxWrite_Loaded(object sender, RoutedEventArgs e)
RefreshGame();
SetThemeAccordingtoStorage();
}

private void btnRefresh_Click(object sender, RoutedEventArgs e)
{
RefreshGame();
Expand Down Expand Up @@ -99,9 +100,7 @@ private void tboxWrite_TextChanged(object sender, TextChangedEventArgs e)
{
_isStartedBefore = true;
_dispatcherTimer.Start();
return;
}

else if (tboxWrite.Text != string.Empty && !_isTextBoxChangedCanFire || tboxWrite.Text == " ")
{
tboxWrite.Text = String.Empty;
Expand Down Expand Up @@ -142,17 +141,14 @@ private void tboxWrite_PreviewKeyDown(object sender, KeyEventArgs e) //when text
if (_currentWord1Index == lastIndex - 1)
{
_currentWord1Index = 0;

GetAnotherStack(_words2);

return;
}

_isTextBoxChangedCanFire = false;

if (_currentTextOfTextBox == _targetText)
TextDoneTrue(_words1[_currentWord1Index], _words1[_currentWord1Index + 1]);

else
TextDoneWrong(_words1[_currentWord1Index], _words1[_currentWord1Index + 1]);
}
Expand Down Expand Up @@ -225,6 +221,7 @@ private void RefreshGame()
_numberOfKeyStroke = 0;
_numberOfTrueKeyStroke = 0;
_numberOfFalseKeyStroke = 0;

_isTextBoxChangedCanFire = true;
_isStartedBefore = false;

Expand All @@ -248,11 +245,12 @@ private void RefreshStack(StackPanel panel, List<Label> labels)

int currentLength = 0;



for (int i = 0; i < array.Length; i++)
{

Label lbl = new Label();

lbl.Background = i == 0 && labels == _words1 ? Brushes.LightGray : Brushes.Transparent; //First word set to Light Gray
lbl.Content = array[i];
lbl.Style = (Style)FindResource("MainTextBlockTheme");
Expand All @@ -261,6 +259,7 @@ private void RefreshStack(StackPanel panel, List<Label> labels)

lbl.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
lbl.Arrange(new Rect(lbl.DesiredSize));

currentLength += (Convert.ToInt32(lbl.ActualWidth) + (int)lbl.Margin.Left);

//If total length of the words exceeds the limit we break.
Expand Down
6 changes: 3 additions & 3 deletions TarotType.Main/View/ResultWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Border Background="#6aa3b1"
CornerRadius="20">
<Grid>

<StackPanel Orientation="Horizontal"
Width="450">

Expand Down Expand Up @@ -120,8 +120,8 @@
HorizontalAlignment="Left"
FontSize="20"
Foreground="Black"
FontFamily="/Fonts/#Poppins"
Margin="10,10,0,0"/>
FontFamily="/Fonts/#Poppins"
Margin="10,10,0,0" />
</StackPanel>


Expand Down

0 comments on commit 5e71e10

Please sign in to comment.