private void buttonStop_Click(object sender, EventArgs e) { if (0 == m_nLoginID) { return; } //Fill in stop request. SNAP_PARAMS snapparams = new SNAP_PARAMS(); snapparams.mode = -1; snapparams.Channel = (UInt32)this.comboBoxChannel.SelectedIndex; snapparams.CmdSerial = UInt32.Parse(this.textBoxSerial.Text.ToString()); bool b = NETClient.NETSnapPicture(m_nLoginID, snapparams); if (!b) { MessageBox.Show("Snap Stop failed"); } else { MessageBox.Show("Snap stop successfully"); } }
private void buttonStart_Click(object sender, EventArgs e) { if (0 != m_nLoginID) { if (m_snapmode == -1) { //MessageBox(ConvertString("please select snap mode!"), ConvertString("prompt")); return; } //Fill in request structure SNAP_PARAMS snapparams = new SNAP_PARAMS(); snapparams.Channel = (UInt32)this.comboBoxChannel.SelectedIndex; snapparams.mode = this.radioButtonOne.Checked?0:1;//m_snapmode>0?0:1; snapparams.CmdSerial = UInt32.Parse(this.textBoxSerial.Text.ToString()); if (snapparams.mode == 1) { //Time interval for scheduled snapshot. Use snapshot setup to configure. snapparams.InterSnap = (UInt32)m_dicSnapSpace[this.comboBoxSnapSpace.Text.ToString()]; } bool bRet = NETClient.NETSnapPicture(m_nLoginID, snapparams); if (!bRet) { MessageBox.Show("Snap Start-up failed"); } else { MessageBox.Show("Snap Start-up successfully"); } } }
public string GetImage() { SNAP_PARAMS snapparams = new SNAP_PARAMS(); snapparams.Channel = 0; snapparams.mode = 0; snapparams.CmdSerial = 1; bool bRet = NETClient.NETSnapPicture(m_nLoginID, snapparams); if (bRet) { return("抓拍成功"); } else { return("抓拍失败"); } }
}//Method public void capture(string path1, string path2, string path3, string path4) { camPath1 = path1; camPath2 = path2; camPath3 = path3; camPath4 = path4; if (0 != m_nLoginID) { if (m_snapmode == -1) { //MessageBox(ConvertString("please select snap mode!"), ConvertString("prompt")); return; } //Fill in request structure SNAP_PARAMS snapparams = new SNAP_PARAMS(); snapparams.Channel = (UInt32)0; snapparams.mode = 0;//m_snapmode>0?0:1; snapparams.CmdSerial = UInt32.Parse("1"); if (snapparams.mode == 1) { //Time interval for scheduled snapshot. Use snapshot setup to configure. snapparams.InterSnap = (UInt32)0; } if (path1 != "") { bool bRet = NETClient.NETSnapPicture(m_nLoginID, snapparams); if (!bRet) { // MessageBox.Show("Snap Start-up failed"); } else { // MessageBox.Show("Snap Start-up successfully"); } } if (path2 != "") { bool bRet2 = NETClient.NETSnapPicture(m_nLoginID2, snapparams); if (!bRet2) { // MessageBox.Show("Snap Start-up failed"); } else { // MessageBox.Show("Snap Start-up successfully"); } } if (path3 != "") { bool bRet3 = NETClient.NETSnapPicture(m_nLoginID3, snapparams); if (!bRet3) { // MessageBox.Show("Snap Start-up failed"); } else { // MessageBox.Show("Snap Start-up successfully"); } } if (path4 != "") { bool bRet4 = NETClient.NETSnapPicture(m_nLoginID4, snapparams); if (!bRet4) { // MessageBox.Show("Snap Start-up failed"); } else { // MessageBox.Show("Snap Start-up successfully"); } } } }
private static extern bool CLIENT_SnapPicture(Int32 lLoginID, SNAP_PARAMS par);
public static bool NETSnapPicture(Int32 lLoginID, SNAP_PARAMS par) { bool bReturn = false; try { bReturn = CLIENT_SnapPicture(lLoginID, par); VIDEOThrowLastError(bReturn); } catch (System.Exception) { VIDEOThrowLastError(bReturn); bReturn = false; } return bReturn; }