예제 #1
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            string filenameDB    = "";
            string filenameVoice = "";

            gridDienThoai.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            BaoCaoBieuMau3 objItem = null;

            if (gridDienThoai.SelectedItems.Count > 0)
            {
                objItem = (BaoCaoBieuMau3)(gridDienThoai.SelectedItems[0]).GetRow().DataRow;

                filenameDB    = (gridDienThoai.SelectedItems[0]).GetRow().Cells["FileVoicePath"].Text;
                filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDi(filenameDB);
            }

            if (filenameVoice.Length > 0)
            {
                player1.FileName = filenameVoice;
                if (player1.FileName != "")
                {
                    player1.Play();
                    btnPause.Text       = "Pause";
                    this.timer1.Enabled = true;
                }
                else
                {
                    new MessageBox.MessageBoxBA().Show(@"File không tồn tại.Bạn cần kiểm tra lại đường dẫn tới thư mục lưu file âm thanh.Thư mục này phải được lưu cùng với thư mục của hệ thống bắt số.Ví dụ : \\\maychu\GhiAm. Hoặc bạn có thể tìm ở file gốc.");
                }
            }
            else
            {
                if (new MessageBox.MessageBoxBA().Show(this, "Chọn file gốc để nghe.", "Thong bao", Taxi.MessageBox.MessageBoxButtonsBA.OKCancel, Taxi.MessageBox.MessageBoxIconBA.Question).ToString() == DialogResult.OK.ToString())
                {
                    string     FileNameWildcard = StringTools.GetFilenameWidlcard(KYTU_GOIDEN, objItem.PhoneNumber);
                    frmTimFile frmTim           = new frmTimFile(NgheLaiCuocGoi.GetFullDirectory(ThongTinCauHinh.ThuMucFileAmThanh, objItem.ThoiDiemGoi), FileNameWildcard);
                    frmTim.ShowDialog();
                    if (frmTim.DialogResult == DialogResult.OK)
                    {
                        player1.FileName      = frmTim.GetFilename();
                        this.lblFilename.Text = player1.FileName;
                        if (player1.FileName != "")
                        {
                            player1.Play();
                            btnPause.Text       = "Pause";
                            this.timer1.Enabled = true;
                        }
                        else
                        {
                            new MessageBox.MessageBoxBA().Show(@"File không tồn tại.Bạn cần kiểm tra lại đường dẫn tới thư mục lưu file âm thanh.");
                        }
                    }
                }
            }
        }
예제 #2
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            string filenameDB    = "";
            string filenameVoice = "";

            gridEX1.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            CSKHChiTiet objItem              = null;
            string      KyTuDaiDienCuocGoi   = "";
            DateTime    ThoiDiemCuocGoiDiDen = DateTime.MinValue;

            if (gridEX1.SelectedItems.Count > 0)
            {
                objItem = (CSKHChiTiet)(gridEX1.SelectedItems[0]).GetRow().DataRow;

                filenameDB       = GetFileOfCuocGoi(objItem, out KyTuDaiDienCuocGoi, out ThoiDiemCuocGoiDiDen);
                lblFilename.Text = filenameDB;

                if (filenameDB.Length > 0)
                {
                    filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDi(filenameDB);
                }
            }
            else
            {
                return;
            }
            // Xay dung Tools tìm kiếm file.

            //if (!FileTools.IsExsitFile(filenameVoice))
            //{
            //    filenameVoice = NgheLaiCuocGoi.GetFileVoiceCuaMotCuocGoi(objItem.Line, objItem.PhoneNumber, objItem.ThoiDiemGoi, Taxi.Utils.TypeCall.Incoming, ThongTinCauHinh.ThuMucFileAmThanh);
            //}

            if (filenameVoice.Length > 0)
            {
                player1.FileName = filenameVoice;
                if (player1.FileName != "")
                {
                    player1.Play();
                    btnPause.Text       = "Pause";
                    this.timer1.Enabled = true;
                }
                else
                {
                    new MessageBox.MessageBoxBA().Show(@"File không tồn tại.Bạn cần kiểm tra lại đường dẫn tới thư mục lưu file âm thanh.Thư mục này phải được lưu cùng với thư mục của hệ thống bắt số.Ví dụ : \\\maychu\GhiAm. Hoặc bạn có thể tìm ở file gốc.");
                }
            }
            else
            {
                if (objItem == null)
                {
                    return;
                }

                if (new MessageBox.MessageBoxBA().Show(this, "Chọn file gốc để nghe.", "Thong bao", Taxi.MessageBox.MessageBoxButtonsBA.OKCancel, Taxi.MessageBox.MessageBoxIconBA.Question).ToString() == DialogResult.OK.ToString())
                {
                    string     FileNameWildcard = StringTools.GetFilenameWidlcard(KyTuDaiDienCuocGoi, objItem.SoDienThoai);
                    frmTimFile frmTim           = new frmTimFile(NgheLaiCuocGoi.GetFullDirectory(ThongTinCauHinh.ThuMucFileAmThanh, ThoiDiemCuocGoiDiDen), FileNameWildcard);
                    frmTim.ShowDialog();
                    if (frmTim.DialogResult == DialogResult.OK)
                    {
                        player1.FileName      = frmTim.GetFilename();
                        this.lblFilename.Text = player1.FileName;
                        if (player1.FileName != "")
                        {
                            player1.Play();
                            btnPause.Text       = "Pause";
                            this.timer1.Enabled = true;
                        }
                        else
                        {
                            new MessageBox.MessageBoxBA().Show(@"File không tồn tại.Bạn cần kiểm tra lại đường dẫn tới thư mục lưu file âm thanh.");
                        }
                    }
                }
            }
        }