/// <summary> /// Updates the textbox with the appropriate value /// </summary> private void UpdateTextBox() { var Plans = CostCtrl.GetPlans(); var percent = Percent.Checked; var maxPay = MaxPay.Checked; bool percentValid = false; if (PlanList.SelectedItem != null) { var plan = CostCtrl.GetPlan(PlanList.SelectedItem.ToString()); if (PlanQueries.SelectedItem != null) { percentValid = (CostCtrl.GetNum(PlanQueries.SelectedItem.ToString(), plan.Type, percent, maxPay) <= 1); } if (percent && percentValid) { Cost.Text = (100 * CostCtrl.GetNum(PlanQueries.SelectedItem.ToString(), plan.Type, percent, maxPay)).ToString(); DollarLabel.Hide(); PercentLabel.Show(); } else { if (PlanQueries.SelectedItem != null) { Cost.Text = CostCtrl.GetNum(PlanQueries.SelectedItem.ToString(), plan.Type, percent, maxPay).ToString(); } DollarLabel.Show(); PercentLabel.Hide(); } } }
public Test_passing() { InitializeComponent(); Progress.Hide(); PercentLabel.Hide(); hiding += BackButton.Hide; hiding += NextButton.Hide; hiding += AnswersSingle.Hide; hiding += AnswersMultiple.Hide; }
public ChangeCosts(CougarCostsController CoCtrl) { this.CostCtrl = CoCtrl; InitializeComponent(); PercentLabel.Hide(); Error.Hide(); Copay.Checked = true; var Plans = CostCtrl.GetPlans(); foreach (var plan in Plans) { PlanList.Items.Add(plan.Type.ToString()); } }
public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2)) { if (texture != null) { if (visible) { // Footer Vector2 footer_loc = new Vector2( Config.WINDOW_WIDTH - 104, Config.WINDOW_HEIGHT - 16 - draw_offset.Y); sprite_batch.Draw(texture, (footer_loc + draw_vector()), new Rectangle(0, 80, 104, 16), tint, angle, offset, scale, mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z); SuccessLabel.draw(sprite_batch, -footer_loc); PercentLabel.draw(sprite_batch, -footer_loc); SuccessCount.draw(sprite_batch, -footer_loc); } } }
void NextButton_Click(object sender, EventArgs e) { List <int> ids = new List <int>(); for (int i = 0; i < questions.Count; i++) { if (questions[Count].Answers[i].Correct) { ids.Add(i); if (questions[Count].Single_type) { break; } } } if (questions[Count].Single_type) { CorrectAnswers.Add(AnswersSingle.SelectedIndex == ids[0]); NextButton.Text = Count == questions.Count - 1 ? "Завершить" : "Далее"; } else { bool fail = false; foreach (int id in ids) { if (!AnswersMultiple.CheckedIndices.Contains(id)) { CorrectAnswers.Add(false); fail = true; } } if (!fail) { CorrectAnswers.Add(true); } } if (Count >= questions.Count - 1) { hiding.Invoke(); BackColor = Color.Bisque; QuestionTextBox.BackColor = BackColor; Progress.Show(); int count = 0; foreach (bool q in CorrectAnswers) { if (q) { count++; } } double percent = 100 / questions.Count * count; Progress.Value = (int)percent; QuestionTextBox.Text = "Тест завершён, вот ваш результат:"; PercentLabel.Text = percent + "%"; PercentLabel.Show(); } else { QuestionTextBox.Text = questions[++Count].Text; } Refreshing(); ShowingElements(); }