private void btnPlay_Click(object sender, EventArgs e)
        {
            string filenameDB    = "";
            string filenameVoice = "";

            gridBaoCaoBieuMau1.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (gridBaoCaoBieuMau1.SelectedItems.Count > 0)
            {
                string line = (gridBaoCaoBieuMau1.SelectedItems[0]).GetRow().Cells["src"].Text;
                filenameDB = (gridBaoCaoBieuMau1.SelectedItems[0]).GetRow().Cells["fileVoicePath"].Text;
                if (!DieuHanhTaxi.IsPBXIP(line))
                {
                    filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDi(filenameDB);
                }
                else
                {
                    filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDiFromPBXIP(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");
                }
            }
            else
            {
                new MessageBox.MessageBoxBA().Show("File không tồn tại !");
            }
        }
Beispiel #2
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            try
            {
                string filenameDB    = "";
                string filenameVoice = "";
                if (gridViewChiTietGoiDi.RowCount > 0)
                {
                    filenameDB    = gridViewChiTietGoiDi.GetFocusedDataRow()["VoiceFilePath"].ToString();
                    filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDi(filenameDB);
                }

                if (filenameVoice.Length > 0)
                {
                    player.FileName = filenameVoice;
                    if (player.FileName != "")
                    {
                        player.Play();
                        btnPause.Text      = "Pause";
                        this.timer.Enabled = true;
                    }
                    else
                    {
                        new MessageBoxBA().Show("File không tồn tại");
                    }
                }
                else
                {
                    new MessageBoxBA().Show("File ghi âm không tồn tại!");
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("btnPlay_Click: ", ex);
            }
        }
Beispiel #3
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     try
     {
         string _line = string.Empty;
         string filenameVoice;
         bool   isPlay = false;
         if (string.IsNullOrEmpty(_fileVoicePath))
         {
             var dr = gridView1.GetFocusedDataRow();
             if (dr != null && dr.Table.Columns.Contains("FileVoicePath"))
             {
                 isPlay         = true;
                 _fileVoicePath = dr["FileVoicePath"].ToString();
                 _line          = dr["Line"].ToString();
             }
         }
         if (string.IsNullOrEmpty(_fileVoicePath))
         {
             new Taxi.MessageBox.MessageBoxBA().Show("Không tìm thấy tệp ghi âm");
             return;
         }
         btnPause.Enabled = true;
         btnStop.Enabled  = true;
         btnPlay.Enabled  = false;
         if (!string.IsNullOrEmpty(_line) && !DieuHanhTaxi.IsPBXIP(_line)) // binh thuong nhu cu
         {
             filenameVoice = NgheLaiCuocGoi.GetFileNameCuocDi(_fileVoicePath);
         }
         else
         {
             filenameVoice = Config_Common.PBXIPVoicePath + "\\" + _fileVoicePath;
         }
         //filenameVoice = @"C:\Users\haunv.HN-BINHANH\AppData\Roaming\Skype\My Skype Received Files\03--A-0313741098---20141028153714.wav";
         //if (player_Play.FileName == "")
         //    isPlay = true;
         if (filenameVoice.Length > 0)
         {
             if (isPlay)
             {
                 player_Play.FileName = filenameVoice;
                 if (player_Play.FileName != "")
                 {
                     player_Play.Play();
                     lblAudio.Text       = player_Play.FileName;
                     btnPause.Text       = "Pause";
                     this.timer1.Enabled = true;
                 }
                 else
                 {
                     new Taxi.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 (player_Play.Status == "stopped")
                 {
                     int pos = (TrackBarFileVoicePath.Value * player_Play.DurationInMS) / this.TrackBarFileVoicePath.Properties.Maximum;
                     player_Play.Play();
                     player_Play.ChangePosition(pos);
                 }
                 else
                 {
                     player_Play.Resume();
                 }
                 this.timer1.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("btnPlay_Click: ", ex);
     }
 }
Beispiel #4
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.");
                        }
                    }
                }
            }
        }