private void FormMain_Load(object sender, EventArgs e) { progressBar1.Maximum = maxProgress * mulProgress; progressBar1.Visible = false; StopButtionShow(false); textNext.Text = strClear; BtnStop.Left = BtnEasy.Left; BtnStop.Top = BtnEasy.Top; BtnStop.Width = BtnHard.Right - BtnEasy.Left; BtnStop.Height = progressBar1.Top - BtnEasy.Top; // write file WriteFile(); // speak try { BouyomiChan.Speak(strSpeakBegin); } catch { // no care } }
private void timerTick_Tick(object sender, EventArgs e) { if ((DateTime.Now - timeTarget).TotalSeconds > 0) { timerTick.Stop(); StopButtionShow(false); progressBar1.Visible = false; textNext.Text = strTimeup; radioTick1.Checked = false; radioTick2.Checked = false; progressBar1.Value = 0; // write file WriteFile(); } else { StopButtionShow(true); TimeSpan spanRemain = timeTarget - DateTime.Now; // progress if (spanRemain.TotalSeconds < maxProgress) { int msRemain = maxProgress * 1000 - ((int)spanRemain.TotalSeconds * 1000 + spanRemain.Milliseconds); if (msRemain < 0) { progressBar1.Value = 0; } else if (msRemain > maxProgress * 1000) { progressBar1.Value = progressBar1.Maximum; } else { progressBar1.Value = msRemain * mulProgress / 1000; } progressBar1.Visible = true; } else { progressBar1.Visible = false; } if (radioTick1.Checked) { radioTick2.Checked = true; } else { radioTick1.Checked = true; } // speak if (bDoneSpeak10 == false) { if (spanRemain.TotalSeconds < iSpeak10) { bDoneSpeak10 = true; // speak try { BouyomiChan.Speak(strSpeak10); } catch { // no care } } } } }