private void InitLang() { label1.Text = LangPack.GetStoredMsg(); btnAdd.Text = LangPack.GetAdd(); btnEdit.Text = LangPack.GetEdit(); btnDel.Text = LangPack.GetDelete(); btnClose.Text = LangPack.GetClose(); button1.Text = LangPack.GetPlay(); lbTime.Text = "[0 " + LangPack.GetSec() + "]"; if (LangPack.IsEng) { lbNumText.Text = "▶ Stored Message Number : "; } else { lbNumText.Text = "▶ Хадгалагдсан мессежийн дугаар : "; } }
/// <summary> /// 저장메시지 Play 버튼 클릭 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (this.button1.Text == LangPack.GetPlay()) { try { ListView.SelectedIndexCollection selText = lvMsg.SelectedIndices; if (selText.Count <= 0) { MessageBox.Show(LangPack.GetMongolian("Please choose the stored message to play."), LangPack.GetMongolian("Sound Play"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!(System.IO.File.Exists(Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav"))) { MessageBox.Show(LangPack.GetMongolian("Sorry! can not play sound because file don't exists."), LangPack.GetMongolian("Sound Play"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.sp == null) { this.sp = new SoundPlayer(Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav"); } else { this.sp.SoundLocation = Util.file_StoMsgPlay + (lvMsg.Items[selText[0]].Tag as MsgInfo).msgNum + ".wav"; } this.sp.Play(); this.playTD = new Thread(new ParameterizedThreadStart(playMethod)); this.playTD.Start((lvMsg.Items[selText[0]].Tag as MsgInfo).msgTime); this.button1.Text = LangPack.GetStop(); } catch (Exception ex) { this.button1.Text = LangPack.GetPlay(); } } else { try { this.sp.Stop(); this.button1.Text = LangPack.GetPlay(); if (this.playTD != null) { this.playTD.Abort(); this.playTD = null; } } catch (Exception ex) { this.sp = null; this.button1.Text = LangPack.GetPlay(); if (this.playTD != null) { this.playTD.Abort(); this.playTD = null; } } } }