public TrueFalseForm(string title, TrueFalse data) { InitializeComponent(); label.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top; label.Resize += new EventHandler(label_Resize); this.KeyPreview = true; this.Text = title; if (Settings.Default.ShowTimer) { labelTimer.Show(); } if (Settings.Default.Autosave) { this.data = RestoreData(); } if (this.data == null) { this.data = data; if (Settings.Default.ShowRandom) { this.data.Shuffle(); } } UpdateUI(); }
private TrueFalse RestoreData() { TrueFalse data = null; var path = @"Saved\" + this.Text; if (Directory.Exists("Saved") && File.Exists(path)) { data = DataSerializer.DeSerializeObject <TrueFalse>(path); } return(data); }
private void ChangeStateMistakes() { state = TrueFalseFormState.Mistakes; // Change Data data = data.GetMistakes(); // Change UI Appearance label.TextAlign = ContentAlignment.MiddleCenter; panelIndex.Show(); btnRight.Dock = DockStyle.Right; btnRight.Width = 75; btnRight.Text = "Next"; btnLeft.Text = "Previous"; btnLeft.Enabled = true; btnLeft.Show(); labelAnswer.Show(); UpdateUI(); }