/// <summary> /// Press stop video button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStopRecord_Click(object sender, EventArgs e) { if (NETPlay.NETStopDataRecord((int)nudPlayChannelNO.Value) == false) { MessageBox.Show("Stop data flow save failure!", "Prompt:"); } }
/// <summary> /// Quik play menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuFast_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.Fast, 0)) { MessageBox.Show("Quik play failure!", pMsgTitle); } }
/// <summary> /// Video brightness /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hsbBrightness_ValueChanged(object sender, EventArgs e) { mnuBrightnessUp.Enabled = (hsbBrightness.Value == hsbBrightness.Maximum ? false : true); mnuBrightnessDown.Enabled = (hsbBrightness.Value == 0 ? false : true); pColor.pBrightness = hsbBrightness.Value; NETPlay.NETPlayControl(PLAY_COMMAND.SetColor, 0, 0, ref pColor); }
/// <summary> /// Slow play menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuSlow_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.Slow, 0)) { MessageBox.Show("Single frame play failure!", pMsgTitle); } }
/// <summary> /// Video saturation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hsbSaturation_ValueChanged(object sender, EventArgs e) { mnuSaturationDown.Enabled = (hsbSaturation.Value == 0 ? false : true); mnuSaturationUp.Enabled = (hsbSaturation.Value == hsbSaturation.Maximum ? false : true); pColor.pSaturation = hsbSaturation.Value; NETPlay.NETPlayControl(PLAY_COMMAND.SetColor, 0, 0, ref pColor); }
/// <summary> /// Video tonal /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hsbHue_ValueChanged(object sender, EventArgs e) { mnuHueUp.Enabled = (hsbHue.Value == hsbHue.Maximum ? false : true); mnuHueDown.Enabled = (hsbHue.Value == 0 ? false : true); pColor.pHue = hsbHue.Value; NETPlay.NETPlayControl(PLAY_COMMAND.SetColor, 0, 0, ref pColor); }
private void btnStartRealPlay_Click(object sender, EventArgs e) { if (pLoginID != 0) { uRealHandle = NETClient.NETRealPlay(pLoginID, 0, IntPtr.Zero);//Only data, no play cbRealData = new fRealDataCallBack(cbRealDataFun); if (NETPlay.NETPlayControl(PLAY_COMMAND.OpenStream, 0, IntPtr.Zero, 0, (UInt32)(900 * 1024))) { // MessageBox.Show("Open stream play successfully!", pMsgTitle); } else { MessageBox.Show("Failed to open stream play!", pMsgTitle); btnStopRealPlay.Enabled = false; return; } if (NETPlay.NETSetStreamOpenMode(0, PLAY_MODE.STREAME_REALTIME))//Set stream play mode { //MessageBox.Show("Set stream play mode successfullly!", pMsgTitle); } else { MessageBox.Show("Failed to set stream mode!", pMsgTitle); btnStopRealPlay.Enabled = false; return; } if (NETPlay.NETPlayControl(PLAY_COMMAND.Start, 0, picPlayMain.Handle)) { // MessageBox.Show("Stream play start successfully!", pMsgTitle); } else { MessageBox.Show("Failed to stream play!", pMsgTitle); btnStopRealPlay.Enabled = false; return; } if (blnSetRealDataCallBack == true) { btnStopRealPlay.Enabled = true; btnStartRealPlay.Enabled = false; return; } if (NETClient.NETSetRealDataCallBack(uRealHandle, cbRealData, IntPtr.Zero))//Set data call process function { // MessageBox.Show("Set data call process function successfully!", pMsgTitle); blnSetRealDataCallBack = true; } else { MessageBox.Show("Failed to set data call process function!", pMsgTitle); btnStopRealPlay.Enabled = false; blnSetRealDataCallBack = false; return; } btnStopRealPlay.Enabled = true; btnStartRealPlay.Enabled = false; //picPlayMain.Refresh(); } }
private void btnStopRealPlay_Click(object sender, EventArgs e) { NETPlay.NETPlayControl(PLAY_COMMAND.Stop, 0); NETPlay.NETPlayControl(PLAY_COMMAND.CloseStream, 0); btnStartRealPlay.Enabled = true; btnStopRealPlay.Enabled = false; picPlayMain.Refresh(); }
/// <summary> /// The menu processing of continue to play /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuResum_Click(object sender, EventArgs e) { if (NETPlay.NETPlayControl(PLAY_COMMAND.ReSume, 0)) { SetPauseResumControl(0); } else { MessageBox.Show("Failed to continue playing!", pMsgTitle); } }
/// <summary> /// The processing of playing the pause menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuPause_Click(object sender, EventArgs e) { if (NETPlay.NETPlayControl(PLAY_COMMAND.Pause, 0)) { SetPauseResumControl(1); } else { MessageBox.Show("Failed to pause playback!", pMsgTitle); } }
/// <summary> /// Single frame play menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuStepBack_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.OneByOneBack, 0)) { MessageBox.Show("Single frame play failure!", pMsgTitle); } else { //Play/Stop button as paly state SetPlayStopControl(3); } }
/// <summary> /// Playing the video menu processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuStart_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.Start, 0, this.picPlayMain.Handle)) { MessageBox.Show("Failed to play file!", pMsgTitle); } else { SetPlayStopControl(1); chkEnableSound_CheckedChanged(sender, e);//Voice switch6 } }
/// <summary> /// Set the current broadcast properties /// </summary> /// <param name="playedFrameNum"></param> /// <param name="playedTime"></param> private void SetPlayCurrentInfo(UInt32 playedFrameNum, UInt32 playedTime) { stlCurrentFrame.Text = Convert.ToString(playedFrameNum + 1); stlCurrentTime.Text = NETPlay.NETConvertToTime(playedTime, 1, "HH:MM:SS"); trbPlayFrames.Value = (int)(playedFrameNum < trbPlayFrames.Maximum ? playedFrameNum : 0); if (trbPlayFrames.Maximum <= playedFrameNum + 1) { mnuStop_Click(null, null); if (blnLoop) { mnuStart_Click(null, null); } } }
/// <summary> /// Display the button press processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDisplay_Click(object sender, EventArgs e) { //Here need to figure out whether the text box input of pure integer numbers Rectangle pRectangle = new Rectangle((int)nudLeft.Value, (int)nudTop.Value, (int)(nudRight.Value - nudLeft.Value), (int)(nudBottom.Value - nudTop.Value)); IntPtr pBoxInfo = IntPtr.Zero; pBoxInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Rectangle)));//Allocate the fixed specified size of memory space if (pBoxInfo != IntPtr.Zero) { Marshal.StructureToPtr(pRectangle, pBoxInfo, true); } NETPlay.NETSetDisplayRegion(DisplayRegionPort, RegionSN, pBoxInfo, this.picDisplayMain.Handle, true); }
/// <summary> /// The processing of stopping playing the menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuStop_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.Stop, 0)) { MessageBox.Show("Failed to stop play!", pMsgTitle); } else { SetPlayStopControl(0); trbPlayFrames.Value = 0; stlCurrentFrame.Text = "0"; stlCurrentTime.Text = "00:00:00"; this.picPlayMain.Refresh();//Refresh the screen } }
/// <summary> /// To front frame play menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuToBegin_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.ToBegin, 0)) { MessageBox.Show("Location to front frame failure!", pMsgTitle); } else { if (mnuPause.Enabled) { mnuPause_Click(null, null); } trbPlayFrames.Value = 0; stlCurrentFrame.Text = "1"; } }
/// <summary> /// To last frame play menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuToEnd_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.ToEnd, 0)) { MessageBox.Show("Location to last frame failure!", pMsgTitle); } else { if (mnuPause.Enabled) { mnuPause_Click(null, null); } trbPlayFrames.Value = (trbPlayFrames.Maximum - 1 > 0?trbPlayFrames.Maximum - 1:0); stlCurrentFrame.Text = Convert.ToString((uint.Parse(stlTotalFrames.Text) - 1)); } }
/// <summary> /// Close the file menu processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuCloseFile_Click(object sender, EventArgs e) { if (!NETPlay.NETPlayControl(PLAY_COMMAND.CloseFile, 0)) { MessageBox.Show("Failed to close file!", pMsgTitle); } else { this.picPlayMain.Refresh();//Refresh the screen if (mnuStop.Enabled) { mnuStop_Click(sender, e); } SetOpenCloseFileControl(0); } }
/// <summary> /// Audio allowed settings /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkEnableSound_CheckedChanged(object sender, EventArgs e) { if (chkEnableSound.Checked) { chkEnableSound.Image = imlMain.Images["AUDIO_ENABLE"]; NETPlay.NETPlayControl(PLAY_COMMAND.PlaySound, 0); } else { chkEnableSound.Image = imlMain.Images["AUDIO_DISABLE"]; NETPlay.NETPlayControl(PLAY_COMMAND.StopSound); } trbSound.Enabled = chkEnableSound.Checked; mnuSoundUp.Enabled = trbSound.Enabled; mnuSoundDown.Enabled = trbSound.Enabled; mnuSoundSwitch.Checked = chkEnableSound.Checked; mnuSoundSwitch.Image = chkEnableSound.Image; }
/// <summary> /// Picture clock dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timerGetPlayInfo_Tick(object sender, EventArgs e) { if (pPlayVideoSizeMode != 9) { FRAME_INFO pFrameInfo = new FRAME_INFO(); uint totalFrames = NETPlay.NETPlayControl(PLAY_COMMAND.GetFileTotalFrames, 0, true); NETPlay.NETPlayControl(PLAY_COMMAND.GetPictureSize, 0, ref pFrameInfo); stlTotalFrames.Text = Convert.ToString(totalFrames); trbPlayFrames.Maximum = (int)(totalFrames > 0?totalFrames:0); int pParentHeight; int pParentWidth; if (palMain.Visible) { pParentWidth = palMain.Width; pParentHeight = palMain.Height; } else { pParentWidth = this.Width; pParentHeight = this.Height; } switch (pPlayVideoSizeMode) { case 0: //Original size picPlayMain.Width = pFrameInfo.nWidth; picPlayMain.Height = pFrameInfo.nHeight; picPlayMain.Top = (pParentHeight - picPlayMain.Height) / 2; picPlayMain.Left = (pParentWidth - picPlayMain.Width) / 2; break; case 1: //Zoom picPlayMain.Top = 0; picPlayMain.Height = pParentHeight; picPlayMain.Width = Convert.ToInt32(pFrameInfo.nWidth * ((float)pParentHeight / (float)pFrameInfo.nHeight)); picPlayMain.Left = (pParentWidth - picPlayMain.Width) / 2; break; } } SetPlayCurrentInfo(NETPlay.NETPlayControl(PLAY_COMMAND.GetCurrentFrameNum, 0, true), NETPlay.NETPlayControl(PLAY_COMMAND.GetPlayedTime, 0, true)); }
private void frm_Main_Load(object sender, EventArgs e) { chkEnableSound.Checked = true;//Judge whether it is the allowed sound //The initial value of the character superposition pShowTime = true; pTextPointSet = new PointF(100, 10); pTimePointSet = new PointF(200, 30); pFontSet = this.Font; pBrushSet = new SolidBrush(Color.Red); pDisplayText = ""; //Setting screen controls available properties SetOpenCloseFileControl(0); //Play data callback settings playCBFun = new DecCBFun(pDecCBFun); SetCallBackTypeCheck(stmType); mnuSizeTrue_Click(null, null); //Character superposition settings dFun = new DrawFun(DrawFun); NETPlay.NETRigisterDrawFun(0, dFun, 0);//Character overlay function demonstration StringUtil.InitControlText(this); }
/// <summary> /// Press start video button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStartRecord_Click(object sender, EventArgs e) { string strtemp = txtDirPath.Text.ToString() + @"\" + txtFileName.Text.ToString(); strtemp = strtemp.Replace(@"\\", @"\"); if (strtemp.Length > 0) { //To start recording if (NETPlay.NETStartDataRecord((int)nudPlayChannelNO.Value, strtemp, cmbDataType.SelectedIndex)) { //MessageBox.Show("Start data flow save success!", "Prompt:"); MessageBox.Show(strtemp, "Prompt:"); } else { MessageBox.Show("Start data flow save failure!", "Prompt:"); }; } else { MessageBox.Show("Please choose the save path and equipment save file name !", "Prompt:"); } }
/// <summary> /// Screenshots menu dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuCatchPic_Click(object sender, EventArgs e) { //None select image save path, then it should choose save path if (strSavePicPath.Length == 0) { if (fbdMain.ShowDialog() == DialogResult.OK) { strSavePicPath = fbdMain.SelectedPath; } else { return; } } //Screenshot dispose code bool blnSavePic = false; string saveFilePath = strSavePicPath + @"\" + (DateTime.Now.ToString("yyyyMMdd_HHmmss")) + ".bmp"; blnSavePic = NETPlay.NETPlayControl(PLAY_COMMAND.CatchPic, 0, saveFilePath); if (!blnSavePic) { MessageBox.Show("Single frame play failure!\n" + saveFilePath, pMsgTitle); } }
/// <summary> /// Open video file menu processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuOpenFile_Click(object sender, EventArgs e) { if (ofdMain.ShowDialog() == DialogResult.OK) { if (NETPlay.NETPlayControl(PLAY_COMMAND.OpenFile, 0, ofdMain.FileName)) { SetOpenCloseFileControl(1); stlTotalTime.Text = NETPlay.NETConvertToTime(NETPlay.NETPlayControl(PLAY_COMMAND.GetFileTotalTime, 0, true), 1, "HH:mm:ss"); bool blnReturn = NETPlay.NETPlayControl(PLAY_COMMAND.GetColor, 0, (uint)picPlayMain.Handle, ref pColor); if (blnReturn) { hsbBrightness.Value = pColor.pBrightness; hsbContrast.Value = pColor.pContrast; hsbHue.Value = pColor.pHue; hsbSaturation.Value = pColor.pSaturation; } trbSound.Value = (int)NETPlay.NETPlayControl(PLAY_COMMAND.GetVolume, 0, true); } else { MessageBox.Show("Failed to open the file!", pMsgTitle); } } }
/// <summary> /// Refresh /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRefresh_Click(object sender, EventArgs e) { NETPlay.NETRefreshPlayEx(DisplayRegionPort, RegionSN); }
/// <summary> /// Progress to close the window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmDisplayRegion_FormClosing(object sender, FormClosingEventArgs e) { //The picture can not display correctly without this operetion next time NETPlay.NETSetDisplayRegion(DisplayRegionPort, RegionSN, IntPtr.Zero, this.picDisplayMain.Handle, false); }
/// <summary> /// Playback progress bar /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void trbPlayFrames_MouseUp(object sender, MouseEventArgs e) { mnuResum_Click(sender, e); //float playPos = ((float)trbPlayFrames.Value / (float)trbPlayFrames.Maximum); NETPlay.NETPlayControl(PLAY_COMMAND.SetCurrentFrameNum, 0, (uint)trbPlayFrames.Value); }
/// <summary> /// Real-time monitor data call process /// </summary> /// <param name="lRealHandle"></param> /// <param name="dwDataType"></param> /// <param name="pBuffer"></param> /// <param name="dwBufSize"></param> /// <param name="dwUser"></param> private void cbRealDataFun(int lRealHandle, UInt32 dwDataType, IntPtr pBuffer, UInt32 dwBufSize, IntPtr dwUser) { NETPlay.NETPlayControl(PLAY_COMMAND.InputData, 0, pBuffer, dwBufSize);//Here second parameter nPort parameter corresponds to network monitor data RealHandle }
/// <summary> /// Sound control slider dispose /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void trbSound_ValueChanged(object sender, EventArgs e) { mnuSoundUp.Enabled = (trbSound.Value == trbSound.Maximum ? false : true); mnuSoundDown.Enabled = (trbSound.Value == 0 ? false : true); NETPlay.NETPlayControl(PLAY_COMMAND.SetVolume, 0, (uint)trbSound.Value); }