From 6b9bbe43ad9b969022e4f87a7e6d307fe57f10eb Mon Sep 17 00:00:00 2001 From: Alex Bloom Date: Tue, 19 Feb 2019 12:47:56 -0500 Subject: [PATCH] Add project files. --- Numeric_MemoryRecall.sln | 25 +++ Numeric_MemoryRecall/App.config | 6 + Numeric_MemoryRecall/Form1.Designer.cs | 161 +++++++++++++++++ Numeric_MemoryRecall/Form1.cs | 168 ++++++++++++++++++ Numeric_MemoryRecall/Form1.resx | 120 +++++++++++++ .../Numeric_MemoryRecall.csproj | 85 +++++++++ Numeric_MemoryRecall/Program.cs | 22 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Properties/Resources.Designer.cs | 63 +++++++ .../Properties/Resources.resx | 117 ++++++++++++ .../Properties/Settings.Designer.cs | 26 +++ .../Properties/Settings.settings | 7 + 12 files changed, 836 insertions(+) create mode 100644 Numeric_MemoryRecall.sln create mode 100644 Numeric_MemoryRecall/App.config create mode 100644 Numeric_MemoryRecall/Form1.Designer.cs create mode 100644 Numeric_MemoryRecall/Form1.cs create mode 100644 Numeric_MemoryRecall/Form1.resx create mode 100644 Numeric_MemoryRecall/Numeric_MemoryRecall.csproj create mode 100644 Numeric_MemoryRecall/Program.cs create mode 100644 Numeric_MemoryRecall/Properties/AssemblyInfo.cs create mode 100644 Numeric_MemoryRecall/Properties/Resources.Designer.cs create mode 100644 Numeric_MemoryRecall/Properties/Resources.resx create mode 100644 Numeric_MemoryRecall/Properties/Settings.Designer.cs create mode 100644 Numeric_MemoryRecall/Properties/Settings.settings diff --git a/Numeric_MemoryRecall.sln b/Numeric_MemoryRecall.sln new file mode 100644 index 0000000..b192adb --- /dev/null +++ b/Numeric_MemoryRecall.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numeric_MemoryRecall", "Numeric_MemoryRecall\Numeric_MemoryRecall.csproj", "{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DEBE45B5-9091-43A2-8A7C-7B1DBC892E65} + EndGlobalSection +EndGlobal diff --git a/Numeric_MemoryRecall/App.config b/Numeric_MemoryRecall/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/Numeric_MemoryRecall/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Numeric_MemoryRecall/Form1.Designer.cs b/Numeric_MemoryRecall/Form1.Designer.cs new file mode 100644 index 0000000..e1bafa3 --- /dev/null +++ b/Numeric_MemoryRecall/Form1.Designer.cs @@ -0,0 +1,161 @@ +namespace CritiCall_MemoryRecall +{ + partial class Form1 + { + /// + /// 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.txtPhone = new System.Windows.Forms.TextBox(); + this.btnVerify = new System.Windows.Forms.Button(); + this.btnBegin = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.lblCorrect = new System.Windows.Forms.Label(); + this.lblWrong = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.lblNumber = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txtPhone + // + this.txtPhone.Location = new System.Drawing.Point(89, 128); + this.txtPhone.MaxLength = 7; + this.txtPhone.Name = "txtPhone"; + this.txtPhone.Size = new System.Drawing.Size(156, 20); + this.txtPhone.TabIndex = 1; + // + // btnVerify + // + this.btnVerify.Location = new System.Drawing.Point(127, 154); + this.btnVerify.Name = "btnVerify"; + this.btnVerify.Size = new System.Drawing.Size(75, 23); + this.btnVerify.TabIndex = 2; + this.btnVerify.Text = "Verify"; + this.btnVerify.UseVisualStyleBackColor = true; + this.btnVerify.Click += new System.EventHandler(this.btnVerify_Click); + // + // btnBegin + // + this.btnBegin.Location = new System.Drawing.Point(12, 12); + this.btnBegin.Name = "btnBegin"; + this.btnBegin.Size = new System.Drawing.Size(75, 23); + this.btnBegin.TabIndex = 0; + this.btnBegin.Text = "Begin"; + this.btnBegin.UseVisualStyleBackColor = true; + this.btnBegin.Click += new System.EventHandler(this.btnBegin_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(104, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Correct"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(96, 25); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(49, 13); + this.label2.TabIndex = 5; + this.label2.Text = "Incorrect"; + this.label2.Click += new System.EventHandler(this.label2_Click); + // + // lblCorrect + // + this.lblCorrect.AutoSize = true; + this.lblCorrect.Location = new System.Drawing.Point(143, 12); + this.lblCorrect.Name = "lblCorrect"; + this.lblCorrect.Size = new System.Drawing.Size(13, 13); + this.lblCorrect.TabIndex = 6; + this.lblCorrect.Text = "0"; + // + // lblWrong + // + this.lblWrong.AutoSize = true; + this.lblWrong.Location = new System.Drawing.Point(143, 25); + this.lblWrong.Name = "lblWrong"; + this.lblWrong.Size = new System.Drawing.Size(13, 13); + this.lblWrong.TabIndex = 7; + this.lblWrong.Text = "0"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(86, 84); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(44, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Number"; + // + // lblNumber + // + this.lblNumber.AutoSize = true; + this.lblNumber.Location = new System.Drawing.Point(136, 84); + this.lblNumber.Name = "lblNumber"; + this.lblNumber.Size = new System.Drawing.Size(0, 13); + this.lblNumber.TabIndex = 9; + // + // Form1 + // + this.AcceptButton = this.btnVerify; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(326, 189); + this.Controls.Add(this.lblNumber); + this.Controls.Add(this.label3); + this.Controls.Add(this.lblWrong); + this.Controls.Add(this.lblCorrect); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnBegin); + this.Controls.Add(this.btnVerify); + this.Controls.Add(this.txtPhone); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Numeric Memory Recall Test"; + this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtPhone; + private System.Windows.Forms.Button btnVerify; + private System.Windows.Forms.Button btnBegin; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblCorrect; + private System.Windows.Forms.Label lblWrong; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lblNumber; + } +} + diff --git a/Numeric_MemoryRecall/Form1.cs b/Numeric_MemoryRecall/Form1.cs new file mode 100644 index 0000000..b64a186 --- /dev/null +++ b/Numeric_MemoryRecall/Form1.cs @@ -0,0 +1,168 @@ +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; +using System.Speech.Synthesis; +namespace CritiCall_MemoryRecall +{ + public partial class Form1 : Form + { + public string phoneNumber; + public int correct = 0; + public int wrong = 0; + public int tryCounter = 0; + + SpeechSynthesizer reader = new SpeechSynthesizer(); + + + public Form1() + { + InitializeComponent(); + btnVerify.Enabled = false; + txtPhone.Enabled = false; + + lblCorrect.Text = correct.ToString(); + lblWrong.Text = wrong.ToString(); + lblNumber.Text = ""; + } + + private void btnBegin_Click(object sender, EventArgs e) + { + if(btnBegin.Text == "Reset") + { + lblCorrect.Text = "0"; + lblWrong.Text = "0"; + correct = 0; + wrong = 0; + tryCounter = 0; + lblNumber.Text = ""; + txtPhone.Text = ""; + btnBegin.Text = "Begin"; + } + else + { + btnBegin.Enabled = false; + btnBegin.Text = "Reset"; + RunTest(); + btnBegin.Enabled = true; + } + } + public void RunTest() + { + + phoneNumber = GenerateNumber(); + + reader.Rate = -2; + lblNumber.Text = ""; + reader.Speak(phoneNumber); + btnVerify.Enabled = true; + txtPhone.Enabled = true; + txtPhone.Focus(); + btnVerify.Text = "Verify"; + } + public string GenerateNumber() + { + Random random = new Random(); + string r = ""; + int i; + for (i = 1; i < 8; i++) + { + r += random.Next(0, 9).ToString(); + } + return r; + } + + public char LetterGradeFromNumber(double marks) + { + if (marks >= 90) + return 'A'; + else if (marks >= 80) + return 'B'; + else if (marks >= 70) + return 'C'; + else if (marks >= 60) + return 'D'; + else if (marks >= 0) + return 'F'; + else + return 'U'; // unclassified + } + + private void btnVerify_Click(object sender, EventArgs e) + { + if (tryCounter == 10) + { + txtPhone.Text = ""; + txtPhone.Enabled = false; + btnVerify.Enabled = false; + txtPhone.Enabled = false; + + double avg = (double)correct / (double)10; + + double finalscore = avg * (double)100; + char score = LetterGradeFromNumber(finalscore); + + string message = "Your Score is: " + finalscore.ToString() +"%\nYour grade is: " + score + "\nYou had " + wrong.ToString() + " incorrect"; + + MessageBox.Show(message,"Final Results", MessageBoxButtons.OK,MessageBoxIcon.Information); + + + } + else + { + if (btnVerify.Text == "Next") + { + txtPhone.Text = ""; + txtPhone.Enabled = false; + btnVerify.Enabled = false; + RunTest(); + } + else + { + if (txtPhone.Text == phoneNumber) + { + + + lblNumber.Text = phoneNumber; + correct += 1; + tryCounter += 1; + System.Media.SystemSounds.Question.Play(); + MessageBox.Show("Correct"); + + lblCorrect.Text = correct.ToString(); + lblWrong.Text = wrong.ToString(); + txtPhone.Enabled = false; + btnVerify.Text = "Next"; + } + else + { + lblNumber.Text = phoneNumber; + wrong += 1; + tryCounter += 1; + System.Media.SystemSounds.Exclamation.Play(); + MessageBox.Show("Incorrect"); + lblCorrect.Text = correct.ToString(); + lblWrong.Text = wrong.ToString(); + txtPhone.Enabled = false; + btnVerify.Text = "Next"; + } + } + } + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + + private void label2_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Numeric_MemoryRecall/Form1.resx b/Numeric_MemoryRecall/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Numeric_MemoryRecall/Form1.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 diff --git a/Numeric_MemoryRecall/Numeric_MemoryRecall.csproj b/Numeric_MemoryRecall/Numeric_MemoryRecall.csproj new file mode 100644 index 0000000..09c8546 --- /dev/null +++ b/Numeric_MemoryRecall/Numeric_MemoryRecall.csproj @@ -0,0 +1,85 @@ + + + + + Debug + AnyCPU + {E1CDBA7B-E63E-4066-BFE2-CE76166DC774} + WinExe + Numeric_MemoryRecall + Numeric_MemoryRecall + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Numeric_MemoryRecall/Program.cs b/Numeric_MemoryRecall/Program.cs new file mode 100644 index 0000000..e7cfeff --- /dev/null +++ b/Numeric_MemoryRecall/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CritiCall_MemoryRecall +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Numeric_MemoryRecall/Properties/AssemblyInfo.cs b/Numeric_MemoryRecall/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e92715d --- /dev/null +++ b/Numeric_MemoryRecall/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CritiCall_MemoryRecall")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CritiCall_MemoryRecall")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e1cdba7b-e63e-4066-bfe2-ce76166dc774")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Numeric_MemoryRecall/Properties/Resources.Designer.cs b/Numeric_MemoryRecall/Properties/Resources.Designer.cs new file mode 100644 index 0000000..52d13ec --- /dev/null +++ b/Numeric_MemoryRecall/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Numeric_MemoryRecall.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Numeric_MemoryRecall.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Numeric_MemoryRecall/Properties/Resources.resx b/Numeric_MemoryRecall/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Numeric_MemoryRecall/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Numeric_MemoryRecall/Properties/Settings.Designer.cs b/Numeric_MemoryRecall/Properties/Settings.Designer.cs new file mode 100644 index 0000000..ddcf327 --- /dev/null +++ b/Numeric_MemoryRecall/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Numeric_MemoryRecall.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Numeric_MemoryRecall/Properties/Settings.settings b/Numeric_MemoryRecall/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Numeric_MemoryRecall/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +