Пример #1
0
        private void Voice_Click(object sender, EventArgs e)
        {
            //ThreadPool.QueueUserWorkItem((p) =>
            //{
            var voiceUrl = string.Empty;
            var ph       = string.Empty;

            if (!string.IsNullOrEmpty(this.CurrentWordDomain.Voice))
            {
                voiceUrl = this.CurrentWordDomain.Voice;
            }
            else
            {
                var info = JinShanUtil.GetVoiceUrl(this.CurrentWordDomain.Trascation);
                if (info != null)
                {
                    voiceUrl = info.VoiceUrl;
                    ph       = info.PH;
                }
            }
            if (!string.IsNullOrEmpty(voiceUrl))
            {
                this.player.Open(new Uri(voiceUrl));
                this.player.Play();
                this.wordRepository.UpdateVoiceById(this.CurrentWordDomain.Id, voiceUrl, ph);
            }
            else
            {
                this.VoiceError.Content = "it has no voice";
            }
            //});
        }