Example #1
0
        /// <summary>
        /// 時刻更新イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Timer_Tick(object sender, EventArgs e)
        {
            DateTime nowDateTime = DateTime.Now;

            clockTextBlock.Text = nowDateTime.ToString(settings.TimeFormat);
            if (nowDateTime.Hour != currentHour)
            {
                SCTools.playVoice("time-" + nowDateTime.Hour + ".wav");
                currentHour = nowDateTime.Hour;
            }
        }
Example #2
0
        /// <summary>
        /// 起動時ボイス
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void MainWindow_ContentRendered(object sender, EventArgs e)
        {
            // 再生を遅延させないと音声の頭が再生されない
            await System.Threading.Tasks.Task.Delay(1900);

            DateTime time = DateTime.Now;

            // 起動時のボイス
            if (time.Hour >= 4 && time.Hour <= 10)
            {
                SCTools.playVoice("luanch-0.wav");
            }
            else if (time.Hour >= 11 && time.Hour <= 17)
            {
                SCTools.playVoice("luanch-1.wav");
            }
            else
            {
                SCTools.playVoice("luanch-2.wav");
            }
        }
 /// <summary>
 /// 音量テスト
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void voiceTestButton_Click(object sender, RoutedEventArgs e)
 {
     settings.VoiceVolume = (int)voiceVolumeSlider.Value;
     settings.Save();
     SCTools.playVoice("time-" + DateTime.Now.Hour + ".wav");
 }