From c444f530907a58e53ee3ebd0d25afb9985d92e68 Mon Sep 17 00:00:00 2001 From: AConsolePeasant Date: Mon, 22 Aug 2016 20:20:26 +1000 Subject: [PATCH] Add Stats Added statistics page, changed menu around --- EO-Flashcards/EO-Flashcards/App.config | 6 + .../EO-Flashcards/EO-Flashcards.vbproj | 9 ++ .../My Project/Settings.Designer.vb | 24 ++++ .../My Project/Settings.settings | 6 + .../EO-Flashcards/frmAdmin.Designer.vb | 1 + EO-Flashcards/EO-Flashcards/frmAdmin.vb | 5 + EO-Flashcards/EO-Flashcards/frmArcade.vb | 2 + .../EO-Flashcards/frmMenu.Designer.vb | 18 ++- EO-Flashcards/EO-Flashcards/frmMenu.vb | 4 + .../EO-Flashcards/frmStats.Designer.vb | 91 +++++++++++++ EO-Flashcards/EO-Flashcards/frmStats.resx | 120 ++++++++++++++++++ EO-Flashcards/EO-Flashcards/frmStats.vb | 6 + 12 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 EO-Flashcards/EO-Flashcards/frmStats.Designer.vb create mode 100644 EO-Flashcards/EO-Flashcards/frmStats.resx create mode 100644 EO-Flashcards/EO-Flashcards/frmStats.vb diff --git a/EO-Flashcards/EO-Flashcards/App.config b/EO-Flashcards/EO-Flashcards/App.config index f322f26..7067910 100644 --- a/EO-Flashcards/EO-Flashcards/App.config +++ b/EO-Flashcards/EO-Flashcards/App.config @@ -14,6 +14,12 @@ milk + + 0 + + + 0 + \ No newline at end of file diff --git a/EO-Flashcards/EO-Flashcards/EO-Flashcards.vbproj b/EO-Flashcards/EO-Flashcards/EO-Flashcards.vbproj index 4440b99..55727b7 100644 --- a/EO-Flashcards/EO-Flashcards/EO-Flashcards.vbproj +++ b/EO-Flashcards/EO-Flashcards/EO-Flashcards.vbproj @@ -135,6 +135,12 @@ Form + + frmStats.vb + + + Form + True @@ -167,6 +173,9 @@ frmMenu.vb + + frmStats.vb + VbMyResourcesResXFileCodeGenerator Resources.Designer.vb diff --git a/EO-Flashcards/EO-Flashcards/My Project/Settings.Designer.vb b/EO-Flashcards/EO-Flashcards/My Project/Settings.Designer.vb index 4bb0c60..bc49124 100644 --- a/EO-Flashcards/EO-Flashcards/My Project/Settings.Designer.vb +++ b/EO-Flashcards/EO-Flashcards/My Project/Settings.Designer.vb @@ -65,6 +65,30 @@ Namespace My Me("AdminPassword") = value End Set End Property + + _ + Public Property TotalCorrect() As Integer + Get + Return CType(Me("TotalCorrect"),Integer) + End Get + Set + Me("TotalCorrect") = value + End Set + End Property + + _ + Public Property TotalIncorrect() As Integer + Get + Return CType(Me("TotalIncorrect"),Integer) + End Get + Set + Me("TotalIncorrect") = value + End Set + End Property End Class End Namespace diff --git a/EO-Flashcards/EO-Flashcards/My Project/Settings.settings b/EO-Flashcards/EO-Flashcards/My Project/Settings.settings index c5d8b97..aa94769 100644 --- a/EO-Flashcards/EO-Flashcards/My Project/Settings.settings +++ b/EO-Flashcards/EO-Flashcards/My Project/Settings.settings @@ -5,5 +5,11 @@ milk + + 0 + + + 0 + \ No newline at end of file diff --git a/EO-Flashcards/EO-Flashcards/frmAdmin.Designer.vb b/EO-Flashcards/EO-Flashcards/frmAdmin.Designer.vb index 44e36e2..f5b57db 100644 --- a/EO-Flashcards/EO-Flashcards/frmAdmin.Designer.vb +++ b/EO-Flashcards/EO-Flashcards/frmAdmin.Designer.vb @@ -29,6 +29,7 @@ Partial Class frmAdmin ' 'btnWipe ' + Me.btnWipe.Enabled = False Me.btnWipe.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btnWipe.ForeColor = System.Drawing.Color.Red Me.btnWipe.Location = New System.Drawing.Point(336, 12) diff --git a/EO-Flashcards/EO-Flashcards/frmAdmin.vb b/EO-Flashcards/EO-Flashcards/frmAdmin.vb index 9193def..75fd953 100644 --- a/EO-Flashcards/EO-Flashcards/frmAdmin.vb +++ b/EO-Flashcards/EO-Flashcards/frmAdmin.vb @@ -12,4 +12,9 @@ Public Class frmAdmin Private Sub frmAdmin_Closing(sender As Object, e As EventArgs) Handles MyBase.FormClosed frmMenu.Show() End Sub + + Private Sub btnClearUser_Click(sender As Object, e As EventArgs) Handles btnClearUser.Click + My.Settings.TotalCorrect = 0 + My.Settings.TotalIncorrect = 0 + End Sub End Class \ No newline at end of file diff --git a/EO-Flashcards/EO-Flashcards/frmArcade.vb b/EO-Flashcards/EO-Flashcards/frmArcade.vb index 2f204b1..80edb10 100644 --- a/EO-Flashcards/EO-Flashcards/frmArcade.vb +++ b/EO-Flashcards/EO-Flashcards/frmArcade.vb @@ -20,6 +20,7 @@ Public Class frmArcade Public Sub Arcade_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTranslated.KeyPress If e.KeyChar = ChrW(Keys.Enter) Then 'When enter pressed If LCase(english(lblLineNumber.Text() + 1)).Contains(txtTranslated.Text) Then 'Thanks to some fancy googling and tip top help form stackoverflow, we can know use parital answers. + My.Settings.TotalCorrect += 1 MsgBox("Correct") ' That above line allows for us to sometimes accidentally allow users to enter one letter, it looks impossible without rewriting a lot of it too fix. score += 1 'add one to score lblCorrect.Text = score @@ -29,6 +30,7 @@ Public Class frmArcade txtTranslated.Clear() 'If correct, find a new random number for comparison again. Else + My.Settings.TotalIncorrect += 1 Dim skip = MsgBox("Incorrect, Would you like to skip?", MsgBoxStyle.YesNo) If skip = MsgBoxResult.Yes Then Dim randomword As Integer = CInt(Int((63425 * Rnd()))) diff --git a/EO-Flashcards/EO-Flashcards/frmMenu.Designer.vb b/EO-Flashcards/EO-Flashcards/frmMenu.Designer.vb index 7735635..fd5bd89 100644 --- a/EO-Flashcards/EO-Flashcards/frmMenu.Designer.vb +++ b/EO-Flashcards/EO-Flashcards/frmMenu.Designer.vb @@ -26,6 +26,7 @@ Partial Class frmMenu Me.btnTimeTrial = New System.Windows.Forms.Button() Me.btnArcade = New System.Windows.Forms.Button() Me.btnAdminLogin = New System.Windows.Forms.Button() + Me.btnStats = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'btnAdvancement @@ -59,18 +60,28 @@ Partial Class frmMenu ' 'btnAdminLogin ' - Me.btnAdminLogin.Location = New System.Drawing.Point(130, 93) + Me.btnAdminLogin.Location = New System.Drawing.Point(211, 89) Me.btnAdminLogin.Name = "btnAdminLogin" - Me.btnAdminLogin.Size = New System.Drawing.Size(75, 75) + Me.btnAdminLogin.Size = New System.Drawing.Size(117, 75) Me.btnAdminLogin.TabIndex = 15 - Me.btnAdminLogin.Text = "Admin Login (Requires Admin Pass)" + Me.btnAdminLogin.Text = "Admin Login (Requires Admin Pass, Defaullt = milk)" Me.btnAdminLogin.UseVisualStyleBackColor = True ' + 'btnStats + ' + Me.btnStats.Location = New System.Drawing.Point(12, 89) + Me.btnStats.Name = "btnStats" + Me.btnStats.Size = New System.Drawing.Size(193, 75) + Me.btnStats.TabIndex = 16 + Me.btnStats.Text = "View User Statistics" + Me.btnStats.UseVisualStyleBackColor = True + ' 'frmMenu ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(340, 176) + Me.Controls.Add(Me.btnStats) Me.Controls.Add(Me.btnAdminLogin) Me.Controls.Add(Me.btnArcade) Me.Controls.Add(Me.btnTimeTrial) @@ -86,4 +97,5 @@ Partial Class frmMenu Friend WithEvents btnTimeTrial As Button Friend WithEvents btnArcade As Button Friend WithEvents btnAdminLogin As Button + Friend WithEvents btnStats As Button End Class diff --git a/EO-Flashcards/EO-Flashcards/frmMenu.vb b/EO-Flashcards/EO-Flashcards/frmMenu.vb index 361f92f..9ada8c1 100644 --- a/EO-Flashcards/EO-Flashcards/frmMenu.vb +++ b/EO-Flashcards/EO-Flashcards/frmMenu.vb @@ -12,4 +12,8 @@ Public Class frmMenu Private Sub btnArcade_Click(sender As Object, e As EventArgs) Handles btnArcade.Click frmArcade.Show() End Sub + + Private Sub btnStats_Click(sender As Object, e As EventArgs) Handles btnStats.Click + frmStats.Show() + End Sub End Class diff --git a/EO-Flashcards/EO-Flashcards/frmStats.Designer.vb b/EO-Flashcards/EO-Flashcards/frmStats.Designer.vb new file mode 100644 index 0000000..a2de6a9 --- /dev/null +++ b/EO-Flashcards/EO-Flashcards/frmStats.Designer.vb @@ -0,0 +1,91 @@ + _ +Partial Class frmStats + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.lblTTotalCorrect = New System.Windows.Forms.Label() + Me.lblTTotalIncorrect = New System.Windows.Forms.Label() + Me.lblTotalCorrect = New System.Windows.Forms.Label() + Me.lblTotalIncorrect = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'lblTTotalCorrect + ' + Me.lblTTotalCorrect.AutoSize = True + Me.lblTTotalCorrect.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTTotalCorrect.Location = New System.Drawing.Point(11, 9) + Me.lblTTotalCorrect.Name = "lblTTotalCorrect" + Me.lblTTotalCorrect.Size = New System.Drawing.Size(100, 20) + Me.lblTTotalCorrect.TabIndex = 0 + Me.lblTTotalCorrect.Text = "Total Correct" + ' + 'lblTTotalIncorrect + ' + Me.lblTTotalIncorrect.AutoSize = True + Me.lblTTotalIncorrect.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTTotalIncorrect.Location = New System.Drawing.Point(11, 39) + Me.lblTTotalIncorrect.Name = "lblTTotalIncorrect" + Me.lblTTotalIncorrect.Size = New System.Drawing.Size(111, 20) + Me.lblTTotalIncorrect.TabIndex = 1 + Me.lblTTotalIncorrect.Text = "Total Incorrect" + ' + 'lblTotalCorrect + ' + Me.lblTotalCorrect.AutoSize = True + Me.lblTotalCorrect.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTotalCorrect.Location = New System.Drawing.Point(120, 9) + Me.lblTotalCorrect.Name = "lblTotalCorrect" + Me.lblTotalCorrect.Size = New System.Drawing.Size(18, 20) + Me.lblTotalCorrect.TabIndex = 2 + Me.lblTotalCorrect.Text = "0" + ' + 'lblTotalIncorrect + ' + Me.lblTotalIncorrect.AutoSize = True + Me.lblTotalIncorrect.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTotalIncorrect.Location = New System.Drawing.Point(120, 39) + Me.lblTotalIncorrect.Name = "lblTotalIncorrect" + Me.lblTotalIncorrect.Size = New System.Drawing.Size(18, 20) + Me.lblTotalIncorrect.TabIndex = 3 + Me.lblTotalIncorrect.Text = "0" + ' + 'frmStats + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(292, 79) + Me.Controls.Add(Me.lblTotalIncorrect) + Me.Controls.Add(Me.lblTotalCorrect) + Me.Controls.Add(Me.lblTTotalIncorrect) + Me.Controls.Add(Me.lblTTotalCorrect) + Me.Name = "frmStats" + Me.Text = "frmStats" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblTTotalCorrect As Label + Friend WithEvents lblTTotalIncorrect As Label + Friend WithEvents lblTotalCorrect As Label + Friend WithEvents lblTotalIncorrect As Label +End Class diff --git a/EO-Flashcards/EO-Flashcards/frmStats.resx b/EO-Flashcards/EO-Flashcards/frmStats.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/EO-Flashcards/EO-Flashcards/frmStats.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/EO-Flashcards/EO-Flashcards/frmStats.vb b/EO-Flashcards/EO-Flashcards/frmStats.vb new file mode 100644 index 0000000..4425115 --- /dev/null +++ b/EO-Flashcards/EO-Flashcards/frmStats.vb @@ -0,0 +1,6 @@ +Public Class frmStats + Private Sub frmStats_Load(sender As Object, e As EventArgs) Handles MyBase.Load + lblTotalCorrect.Text = My.Settings.TotalCorrect + lblTotalIncorrect.Text = My.Settings.TotalIncorrect + End Sub +End Class \ No newline at end of file