From 445b7525a2f8e8bcd66a135064dda1b31daa7802 Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:06:56 +0330 Subject: [PATCH 1/6] feat-design: select language form designed --- SelectLanguage.Designer.cs | 87 +++++++++++++++++++++++++++ SelectLanguage.cs | 20 +++++++ SelectLanguage.resx | 120 +++++++++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 SelectLanguage.Designer.cs create mode 100644 SelectLanguage.cs create mode 100644 SelectLanguage.resx diff --git a/SelectLanguage.Designer.cs b/SelectLanguage.Designer.cs new file mode 100644 index 0000000..e934cd8 --- /dev/null +++ b/SelectLanguage.Designer.cs @@ -0,0 +1,87 @@ +namespace Typist.App +{ + partial class SelectLanguage + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.cbmLanguage = new System.Windows.Forms.ComboBox(); + this.btnStart = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(193, 32); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(69, 16); + this.label1.TabIndex = 0; + this.label1.Text = "زبان برنامه:"; + // + // cbmLanguage + // + this.cbmLanguage.FormattingEnabled = true; + this.cbmLanguage.Location = new System.Drawing.Point(12, 29); + this.cbmLanguage.Name = "cbmLanguage"; + this.cbmLanguage.Size = new System.Drawing.Size(175, 24); + this.cbmLanguage.TabIndex = 1; + // + // btnStart + // + this.btnStart.Location = new System.Drawing.Point(12, 59); + this.btnStart.Name = "btnStart"; + this.btnStart.Size = new System.Drawing.Size(75, 28); + this.btnStart.TabIndex = 2; + this.btnStart.Text = "اجرا"; + this.btnStart.UseVisualStyleBackColor = true; + // + // SelectLanguage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(290, 101); + this.Controls.Add(this.btnStart); + this.Controls.Add(this.cbmLanguage); + this.Controls.Add(this.label1); + this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "SelectLanguage"; + this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "انتخاب زبان"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox cbmLanguage; + private System.Windows.Forms.Button btnStart; + } +} \ No newline at end of file diff --git a/SelectLanguage.cs b/SelectLanguage.cs new file mode 100644 index 0000000..debfa25 --- /dev/null +++ b/SelectLanguage.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Typist.App +{ + public partial class SelectLanguage : Form + { + public SelectLanguage() + { + InitializeComponent(); + } + } +} diff --git a/SelectLanguage.resx b/SelectLanguage.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SelectLanguage.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file From 25b9dd0be23f14a5a589636574b80120134f8009 Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:07:18 +0330 Subject: [PATCH 2/6] feat-resource: register language resource generated --- Resources/Register.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Resources/Register.json diff --git a/Resources/Register.json b/Resources/Register.json new file mode 100644 index 0000000..07eb8a8 --- /dev/null +++ b/Resources/Register.json @@ -0,0 +1,8 @@ +{ + "Language": [ + { + "Name": "فارسی", + "Directory": "Fa" + } + ] +} \ No newline at end of file From 45dc1a7570a0eb6b29b8e92804816ca301854200 Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:18:43 +0330 Subject: [PATCH 3/6] feat-form: selecte language form programed --- Program.cs | 2 +- SelectLanguage.Designer.cs | 3 +++ SelectLanguage.cs | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 77597db..6b79285 100644 --- a/Program.cs +++ b/Program.cs @@ -16,7 +16,7 @@ static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new SelectLanguage()); } } } diff --git a/SelectLanguage.Designer.cs b/SelectLanguage.Designer.cs index e934cd8..9667455 100644 --- a/SelectLanguage.Designer.cs +++ b/SelectLanguage.Designer.cs @@ -44,6 +44,7 @@ private void InitializeComponent() // // cbmLanguage // + this.cbmLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbmLanguage.FormattingEnabled = true; this.cbmLanguage.Location = new System.Drawing.Point(12, 29); this.cbmLanguage.Name = "cbmLanguage"; @@ -58,6 +59,7 @@ private void InitializeComponent() this.btnStart.TabIndex = 2; this.btnStart.Text = "اجرا"; this.btnStart.UseVisualStyleBackColor = true; + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); // // SelectLanguage // @@ -73,6 +75,7 @@ private void InitializeComponent() this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "انتخاب زبان"; + this.Load += new System.EventHandler(this.SelectLanguage_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/SelectLanguage.cs b/SelectLanguage.cs index debfa25..259b488 100644 --- a/SelectLanguage.cs +++ b/SelectLanguage.cs @@ -5,6 +5,9 @@ using System.Drawing; using System.Linq; using System.Text; +using System.Text.Json; +using System.IO; +using System.Text.Json.Serialization; using System.Threading.Tasks; using System.Windows.Forms; @@ -12,9 +15,30 @@ namespace Typist.App { public partial class SelectLanguage : Form { + protected string register_language_resource = "Register.json"; + Models.RegisterLanguage registeredLanguage { get; } public SelectLanguage() { InitializeComponent(); + + string resource = File.ReadAllText($"{Application.StartupPath}/Resources/{register_language_resource}"); + registeredLanguage = + JsonSerializer.Deserialize(resource); + + cbmLanguage.Items.AddRange(registeredLanguage.Languages.Select(l => l.Name).ToArray()); + } + + private void SelectLanguage_Load(object sender, EventArgs e) + { + cbmLanguage.SelectedIndex = 0; + } + + private void btnStart_Click(object sender, EventArgs e) + { + string name = cbmLanguage.SelectedItem.ToString(); + string directory = registeredLanguage.Languages.FirstOrDefault(l => l.Name == name).Directory; + + new Form1(directory).ShowDialog(); } } } From 1c604d9ca3bad898cf97cc55c4896e7541b0d0cc Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:23:49 +0330 Subject: [PATCH 4/6] feat-form: game form programmed to set score --- Game.Designer.cs | 78 +++++++++++++++++++--------------- Game.cs | 108 +++++++++++++++++++++++++++++++++++++++++++---- Game.resx | 3 ++ 3 files changed, 147 insertions(+), 42 deletions(-) diff --git a/Game.Designer.cs b/Game.Designer.cs index 902b547..7bd7607 100644 --- a/Game.Designer.cs +++ b/Game.Designer.cs @@ -28,25 +28,27 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.components = new System.ComponentModel.Container(); + this.lblMinute = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); + this.lblSecound = new System.Windows.Forms.Label(); + this.lblScoreValue = new System.Windows.Forms.Label(); this.lblScore = new System.Windows.Forms.Label(); this.txtTest = new System.Windows.Forms.TextBox(); this.txtAnswer = new System.Windows.Forms.TextBox(); this.btnNext = new System.Windows.Forms.Button(); + this.timer1 = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); // - // label1 + // lblMinute // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(29, 33); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(24, 17); - this.label1.TabIndex = 1; - this.label1.Text = "00"; + this.lblMinute.AutoSize = true; + this.lblMinute.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblMinute.Location = new System.Drawing.Point(29, 33); + this.lblMinute.Name = "lblMinute"; + this.lblMinute.Size = new System.Drawing.Size(24, 17); + this.lblMinute.TabIndex = 1; + this.lblMinute.Text = "01"; // // label2 // @@ -58,25 +60,25 @@ private void InitializeComponent() this.label2.TabIndex = 1; this.label2.Text = ":"; // - // label3 + // lblSecound // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.Location = new System.Drawing.Point(78, 33); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(24, 17); - this.label3.TabIndex = 1; - this.label3.Text = "00"; + this.lblSecound.AutoSize = true; + this.lblSecound.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblSecound.Location = new System.Drawing.Point(78, 33); + this.lblSecound.Name = "lblSecound"; + this.lblSecound.Size = new System.Drawing.Size(24, 17); + this.lblSecound.TabIndex = 1; + this.lblSecound.Text = "00"; // - // label4 + // lblScoreValue // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point(192, 33); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(24, 17); - this.label4.TabIndex = 1; - this.label4.Text = "00"; + this.lblScoreValue.AutoSize = true; + this.lblScoreValue.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblScoreValue.Location = new System.Drawing.Point(192, 33); + this.lblScoreValue.Name = "lblScoreValue"; + this.lblScoreValue.Size = new System.Drawing.Size(24, 17); + this.lblScoreValue.TabIndex = 1; + this.lblScoreValue.Text = "00"; // // lblScore // @@ -90,7 +92,6 @@ private void InitializeComponent() // // txtTest // - this.txtTest.Enabled = false; this.txtTest.Location = new System.Drawing.Point(29, 71); this.txtTest.Name = "txtTest"; this.txtTest.ReadOnly = true; @@ -114,6 +115,13 @@ private void InitializeComponent() this.btnNext.TabIndex = 1; this.btnNext.Text = "بعدی"; this.btnNext.UseVisualStyleBackColor = true; + this.btnNext.Click += new System.EventHandler(this.btnNext_Click); + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // Game // @@ -125,28 +133,30 @@ private void InitializeComponent() this.Controls.Add(this.txtAnswer); this.Controls.Add(this.txtTest); this.Controls.Add(this.lblScore); - this.Controls.Add(this.label3); - this.Controls.Add(this.label4); + this.Controls.Add(this.lblSecound); + this.Controls.Add(this.lblScoreValue); this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.Controls.Add(this.lblMinute); this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Game"; this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Load += new System.EventHandler(this.Game_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lblMinute; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label lblSecound; + private System.Windows.Forms.Label lblScoreValue; private System.Windows.Forms.Label lblScore; private System.Windows.Forms.TextBox txtTest; private System.Windows.Forms.TextBox txtAnswer; private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Timer timer1; } } \ No newline at end of file diff --git a/Game.cs b/Game.cs index 9085cf1..23782f1 100644 --- a/Game.cs +++ b/Game.cs @@ -17,27 +17,119 @@ namespace Typist.App public partial class Game : Form { protected string ResourceFile = "Forms/Game.json"; + protected string WordResource = "Words.txt"; + protected string Lang{ get; set; } + protected List Words { get; set; } + protected int count_word; + protected int score = 0; + protected int minute = 1; + protected int second = 0; + protected int gift = 0; + protected List SelectedWords { get; set; } public Game() + { + Lang = "Fa"; + DataSet(Lang); + } + public Game(string lang) + { + Lang = lang; + DataSet(Lang); + } + + protected void DataSet(string Lang) { InitializeComponent(); - string resource = File.ReadAllText($"{Application.StartupPath}/Resources/Fa/{ResourceFile}"); + string resource = File.ReadAllText($"{Application.StartupPath}/Resources/{Lang}/{ResourceFile}"); _FormModel model = JsonSerializer.Deserialize<_FormModel>(resource); + Words = File.ReadAllLines($"{Application.StartupPath}/Resources/{Lang}/{WordResource}").ToList(); + + count_word = Words.Count; + this.Text = model.Text; lblScore.Text = model.Labels.Score.Text; btnNext.Text = model.Buttons.Next.Text; + + SelectedWords = new List(); } - public Game(string Lang) + + private void Game_Load(object sender, EventArgs e) { - InitializeComponent(); + ChangeText(); + } - string resource = File.ReadAllText($"{Application.StartupPath}/Resources/{Lang}/{ResourceFile}"); - _FormModel model = JsonSerializer.Deserialize<_FormModel>(resource); + private void timer1_Tick(object sender, EventArgs e) + { + time_set(); + } - this.Text = model.Text; - lblScore.Text = model.Labels.Score.Text; - btnNext.Text = model.Buttons.Next.Text; + private void time_set() + { + if (second == 0) + { + if (minute == 0) + { + timer1.Enabled = false; + string resource = File.ReadAllText($"{Application.StartupPath}/Resources/{Lang}/MessageBoxes.json"); + Models.MessageBox.MessageBoxes mbx = JsonSerializer.Deserialize(resource); + + mbx.FinishGame.Message = mbx.FinishGame.Message.Replace("{score}", score.ToString("00")); + mbx.FinishGame.Show(); + + txtAnswer.Enabled = txtTest.Enabled = btnNext.Enabled = false; + return; + } + + second = 60; + minute--; + } + + second--; + + lblMinute.Text = minute.ToString("00"); + lblSecound.Text = second.ToString("00"); + + } + + private void btnNext_Click(object sender, EventArgs e) + { + // Your text is correct + if (txtAnswer.Text.ToUpper() == txtTest.Text.ToUpper()) + { + score++; + /* + gift++; + if (gift % 3 == 0) + { + second++; + } + */ + lblScoreValue.Text = score.ToString("00"); + ChangeText(); + } + txtAnswer.Text = String.Empty; + txtAnswer.Focus(); + } + + private void ChangeText() + { + int index = 0; + Random random = new Random(); + do + { + index = random.Next(0, count_word - 1); + } while (selectedBefore(index)); + + SelectedWords.Add(index); + + txtTest.Text = Words[index]; + } + + private bool selectedBefore(int index) + { + return SelectedWords.Contains(index); } } } diff --git a/Game.resx b/Game.resx index 1af7de1..1f666f2 100644 --- a/Game.resx +++ b/Game.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file From 4001e54c4bc5ac836d84b2319e2e9bf296527a88 Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:24:08 +0330 Subject: [PATCH 5/6] feat-form: main form description added --- Form1.Designer.cs | 15 +++++++++++++-- Form1.cs | 15 +++++++++++++-- Models/Main/_FormModel.cs | 1 + Models/RegisterLanguage.cs | 19 +++++++++++++++++++ Resources/Fa/Forms/Main.json | 1 + Resources/Register.json | 2 +- Typist.App.csproj | 13 +++++++++++++ 7 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 Models/RegisterLanguage.cs diff --git a/Form1.Designer.cs b/Form1.Designer.cs index c5196cf..b1a7a5a 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -29,11 +29,12 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.btnStart = new System.Windows.Forms.Button(); + this.rchTextDescription = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // btnStart // - this.btnStart.Location = new System.Drawing.Point(12, 152); + this.btnStart.Location = new System.Drawing.Point(12, 120); this.btnStart.Name = "btnStart"; this.btnStart.Size = new System.Drawing.Size(75, 28); this.btnStart.TabIndex = 0; @@ -41,11 +42,20 @@ private void InitializeComponent() this.btnStart.UseVisualStyleBackColor = true; this.btnStart.Click += new System.EventHandler(this.btnStart_Click); // + // rchTextDescription + // + this.rchTextDescription.Location = new System.Drawing.Point(12, 12); + this.rchTextDescription.Name = "rchTextDescription"; + this.rchTextDescription.Size = new System.Drawing.Size(348, 102); + this.rchTextDescription.TabIndex = 1; + this.rchTextDescription.Text = ""; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(372, 192); + this.ClientSize = new System.Drawing.Size(372, 157); + this.Controls.Add(this.rchTextDescription); this.Controls.Add(this.btnStart); this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4); @@ -60,6 +70,7 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button btnStart; + private System.Windows.Forms.RichTextBox rchTextDescription; } } diff --git a/Form1.cs b/Form1.cs index 5a348c2..f56ff64 100644 --- a/Form1.cs +++ b/Form1.cs @@ -19,19 +19,30 @@ public partial class Form1 : Form protected string ResourceFile = "Forms/Main.json"; public string Lang { get; set; } public Form1() + { + DataSet("Fa"); + } + + public Form1(string lang) + { + DataSet(lang); + } + + protected void DataSet(string lang) { InitializeComponent(); - if (Lang == null || Lang == String.Empty) - Lang = "Fa"; + Lang = lang; string resource = File.ReadAllText($"{Application.StartupPath}/Resources/{Lang}/{ResourceFile}"); _FormModel model = JsonSerializer.Deserialize<_FormModel>(resource); this.Text = model.Text; + rchTextDescription.Text = model.Description; btnStart.Text = model.Buttons.Start.Text; } + private void btnStart_Click(object sender, EventArgs e) { new Game(this.Lang).ShowDialog(); diff --git a/Models/Main/_FormModel.cs b/Models/Main/_FormModel.cs index 6c55170..0babbca 100644 --- a/Models/Main/_FormModel.cs +++ b/Models/Main/_FormModel.cs @@ -9,6 +9,7 @@ namespace Typist.App.Models.Main public class _FormModel { public string Text { get; set; } + public string Description { get; set; } public Button Buttons { get; set; } } diff --git a/Models/RegisterLanguage.cs b/Models/RegisterLanguage.cs new file mode 100644 index 0000000..5284d39 --- /dev/null +++ b/Models/RegisterLanguage.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Typist.App.Models +{ + public class RegisterLanguage + { + public List Languages { get; set;} + } + + public class Language + { + public string Name { get; set; } + public string Directory { get; set; } + } +} diff --git a/Resources/Fa/Forms/Main.json b/Resources/Fa/Forms/Main.json index a7a54af..e92c0a4 100644 --- a/Resources/Fa/Forms/Main.json +++ b/Resources/Fa/Forms/Main.json @@ -1,5 +1,6 @@ { "Text": "صفحه اصلی", + "Description": "بازی این جوری هست که، دوتا کادر متن توی صفحه داری\nتوی اولی کلمه ای که باید تایپ بشه وجود داره\nدومی هم چیزی هست که تایپ میکنی. باید سعی کنی توی زمان 1 دقیقه بیشترین کلمه رو تایپ کنی", "Buttons": { "Start": { "Text": "شروع" diff --git a/Resources/Register.json b/Resources/Register.json index 07eb8a8..e792fd8 100644 --- a/Resources/Register.json +++ b/Resources/Register.json @@ -1,5 +1,5 @@ { - "Language": [ + "Languages": [ { "Name": "فارسی", "Directory": "Fa" diff --git a/Typist.App.csproj b/Typist.App.csproj index 1426a07..0aadedb 100644 --- a/Typist.App.csproj +++ b/Typist.App.csproj @@ -74,8 +74,16 @@ + + + + Form + + + SelectLanguage.cs + Form1.cs @@ -92,6 +100,9 @@ Resources.resx True + + SelectLanguage.cs + SettingsSingleFileGenerator @@ -105,6 +116,7 @@ + @@ -112,5 +124,6 @@ + \ No newline at end of file From 094f0c2d493653af84393a19cd60c4d10f20021c Mon Sep 17 00:00:00 2001 From: matio Date: Thu, 29 Dec 2022 16:26:58 +0330 Subject: [PATCH 6/6] feat-form: game form modified and imporve --- Game.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Game.cs b/Game.cs index 23782f1..2950cd6 100644 --- a/Game.cs +++ b/Game.cs @@ -96,7 +96,7 @@ private void time_set() private void btnNext_Click(object sender, EventArgs e) { // Your text is correct - if (txtAnswer.Text.ToUpper() == txtTest.Text.ToUpper()) + if (txtAnswer.Text.Trim().ToUpper() == txtTest.Text.ToUpper()) { score++; /* @@ -108,8 +108,10 @@ private void btnNext_Click(object sender, EventArgs e) */ lblScoreValue.Text = score.ToString("00"); ChangeText(); + txtAnswer.Text = String.Empty; + txtAnswer.Focus(); } - txtAnswer.Text = String.Empty; + txtAnswer.SelectAll(); txtAnswer.Focus(); }