




已阅读5页,还剩16页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
智能家居视频监控系统简介:本系统采用了360度无死角摄像头,可全方位监控自己的住所,并且可以锁定监控,例如门外。监控系统可在pc端查看记录,并且可以设定场景锁定,若场景发生变化,便会触发报警系统,给设定的邮箱或手机发送邮件及短信提醒,实时告知用户紧急状况。此系统可以进行远程监控,即用户可以不在家里的pc端进行监控,只要用户可以上网,就可通过与被控端连接的计算机外网ip地址监控住所的一切动向。这让监控变得简洁化及随身化。代码:1.Login.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;/添加的命名空间using System.Data.OleDb;using VWMS.CommonClass;namespace VWMS public partial class frmLogin : Form public frmLogin() InitializeComponent(); DataCon datacon = new DataCon(); DataOperate dataoperate = new DataOperate(); private void btnLogin_Click(object sender, EventArgs e) if (txtName.Text = ) errorProName.SetError(txtName, 用户名不能为空!); else errorProName.Clear(); string strSql = select * from tb_admin where name= + txtName.Text + and pwd= + txtPwd.Text + ; DataSet ds = dataoperate.getDs(strSql, tb_admin); if (ds.Tables0.Rows.Count 0) this.Hide(); frmMain frmmain = new frmMain(); frmmain.Show(); else MessageBox.Show(用户名或密码错误!, 警告, MessageBoxButtons.OK, MessageBoxIcon.Warning); private void btnExit_Click(object sender, EventArgs e) Application.Exit(); private void txtName_KeyPress(object sender, KeyPressEventArgs e) if (e.KeyChar = 13) txtPwd.Focus(); e.Handled = true; private void txtPwd_KeyPress(object sender, KeyPressEventArgs e) if (e.KeyChar = 13) btnLogin.Focus(); e.Handled = true; private void frmLogin_Load(object sender, EventArgs e) 2. SetMonitor.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;using VWMS.CommonClass;namespace VWMS public partial class frmSetMonitor : Form public frmSetMonitor() InitializeComponent(); DataOperate dataoperate = new DataOperate(); DataSet ds; private void frmSetMonitor_Load(object sender, EventArgs e) lviewBind(); private void btnAdd_Click(object sender, EventArgs e) if (txtName.Text = string.Empty) MessageBox.Show(用户名不能为空!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else ds = dataoperate.getDs(select * from tb_admin where name= + txtName.Text + , tb_admin); if (ds.Tables0.Rows.Count 0) MessageBox.Show(该用户已经存在!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else dataoperate.getCom(insert into tb_admin (name,pwd) values( + txtName.Text + , + txtPwd.Text + ); lviewBind(); txtName.Text = txtPwd.Text = string.Empty; private void btnEdit_Click(object sender, EventArgs e) if (txtName.Text = string.Empty & txtPwd.Text = string.Empty) MessageBox.Show(用户名或密码不能为空!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else dataoperate.getCom(update tb_admin set pwd = + txtPwd.Text + where name= + txtName.Text + ); lviewBind(); txtName.Text = txtPwd.Text = string.Empty; private void btnDel_Click(object sender, EventArgs e) if (txtName.Text.ToLower() = tsoft) MessageBox.Show(该用户是超级用户,不能删除!, 警告, MessageBoxButtons.OK, MessageBoxIcon.Warning); else dataoperate.getCom(delete from tb_admin where name= + txtName.Text + ); lviewBind(); txtName.Text = lview.Items0.Text; private void lview_Click(object sender, EventArgs e) txtName.Text = lview.SelectedItems0.Text; txtPwd.Text = string.Empty; public void lviewBind() lview.Items.Clear(); ds = dataoperate.getDs(select name from tb_admin, tb_admin); foreach (DataRow dr in ds.Tables0.Rows) ListViewItem lvItem = new ListViewItem(dr0.ToString(), 0); lvItem.SubItems.Add(dr0.ToString(); lview.Items.Add(lvItem); 3. Register.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using VWMS.CommonClass;using Microsoft.Win32;namespace VWMS public partial class frmRegister : Form public frmRegister() InitializeComponent(); SoftReg softreg = new SoftReg(); private void frmRegister_Load(object sender, EventArgs e) txtMNum.Text = softreg.getMNum(); private void btnReg_Click(object sender, EventArgs e) if (txtRNum.Text.Equals(softreg.getRNum() RegistryKey retkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(software, true).CreateSubKey(wxk).CreateSubKey(wxk.INI).CreateSubKey(txtRNum.Text); retkey.SetValue(UserName, tsoft); MessageBox.Show(注册成功!, 信息, MessageBoxButtons.OK, MessageBoxIcon.Information); showMain(); else MessageBox.Show(注册码输入错误!, 错误, MessageBoxButtons.OK, MessageBoxIcon.Error); private void btnClose_Click(object sender, EventArgs e) showMain(); /隐藏注册窗体,显示主窗体 public void showMain() this.Hide(); frmMain frmmain = new frmMain(); frmmain.Show(); 4. Play.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace VWMS public partial class frmPlay : Form public frmPlay() InitializeComponent(); private void btnPlay_Click(object sender, EventArgs e) ofDialog.Filter = *.avi|*.avi; ofDialog.Title = 选择视频文件; ofDialog.InitialDirectory = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().LastIndexOf() + Video; if (ofDialog.ShowDialog() = DialogResult.OK) this.axWindowsMediaPlayer1.URL = ofDialog.FileName; private void btnClose_Click(object sender, EventArgs e) this.Close(); private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e) 5. Main.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;/添加的命名空间using VWMS.CommonClass;using System.IO.Ports;using Microsoft.Win32;using System.Threading;namespace VWMS public partial class frmMain : Form public frmMain() InitializeComponent(); PelcoD pelcod = new PelcoD(); SoftReg softreg = new SoftReg(); SerialPort serialPort = new SerialPort(COM1, 2400, Parity.None, 8); int m_dwDevNum = 0; byte addressin = Byte.Parse(Convert.ToString(0x01); byte speedin = Byte.Parse(Convert.ToString(0xff); byte messagesend; private void frmMain_Load(object sender, EventArgs e) plVideo1.BackgroundImage = null; RegistryKey retkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(software, true).CreateSubKey(wxk).CreateSubKey(wxk.INI); foreach (string strRNum in retkey.GetSubKeyNames() if (strRNum = softreg.getRNum() this.Text = 智能视频监控系统; btnReg.Enabled = false; startMonitor(); return; this.Text = 智能视频监控系统; btnReg.Enabled = true; btnSetMonitor.Enabled = btnAutoMonitor.Enabled = false; startMonitor(); MessageBox.Show(您现在使用的是试用版,该软件可以免费试用30次!,提示, MessageBoxButtons.OK, MessageBoxIcon.Information); Int32 tLong; try tLong = (Int32)Registry.GetValue(HKEY_LOCAL_MACHINESOFTWAREangel, UseTimes, 0); MessageBox.Show(感谢您已使用了 + tLong + 次, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); catch Registry.SetValue(HKEY_LOCAL_MACHINESOFTWAREangel, UseTimes, 0, RegistryValueKind.DWord); MessageBox.Show(欢迎新用户使用本软件, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); tLong = (Int32)Registry.GetValue(HKEY_LOCAL_MACHINESOFTWAREangel, UseTimes, 0); if (tLong 30) int Times = tLong + 1; Registry.SetValue(HKEY_LOCAL_MACHINESOFTWAREangel, UseTimes, Times); else MessageBox.Show(试用次数已到, 警告, MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.Exit(); private void frmMain_Move(object sender, EventArgs e) for (int i = 0; i m_dwDevNum; i+) plVideo1.Invalidate(); VideoOperate.VCAUpdateOverlayWnd(this.Handle); VideoOperate.VCAUpdateVideoPreview(i, plVideo1.Handle); private void btnSetMonitor_Click(object sender, EventArgs e) frmSetMonitor frmsetmonitor = new frmSetMonitor(); frmsetmonitor.ShowDialog(); private void btnVideo_Click(object sender, EventArgs e) if (btnVideo.Text = 录像) sfDialog.Filter = *.avi|*.avi; sfDialog.Title = 保存视频文件; sfDialog.InitialDirectory = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().LastIndexOf() + Video; if (sfDialog.ShowDialog() = DialogResult.OK) btnVideo.Text = 停止录像; VideoOperate.VCASetKeyFrmInterval(0, 250); VideoOperate.VCASetBitRate(0, 256); VideoOperate.VCASetVidCapFrameRate(0, 25, false); VideoOperate.VCASetVidCapSize(0, 320, 240); VideoOperate.VCASetXVIDQuality(0, 10, 3); VideoOperate.VCASetXVIDCompressMode(0, VideoOperate.COMPRESSMODE.XVID_VBR_MODE); VideoOperate.VCAStartVideoCapture(0, VideoOperate.CAPMODEL.CAP_MPEG4_STREAM, VideoOperate.MP4MODEL.MPEG4_AVIFILE_CALLBACK, sfDialog.FileName); else if (btnVideo.Text = 停止录像) btnVideo.Text = 录像; VideoOperate.VCAStopVideoCapture(0); /回放 private void btnPlay_Click(object sender, EventArgs e) frmPlay frmpaly = new frmPlay(); frmpaly.ShowDialog(); /快照 private void btnSnapShots_Click(object sender, EventArgs e) if (rbtnBMP.Checked) VideoOperate.VCASaveAsBmpFile(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().LastIndexOf() + Photo + DateTime.Now.ToFileTime() + .bmp); else VideoOperate.VCASaveAsJpegFile(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf().LastIndexOf() + Photo + DateTime.Now.ToFileTime() + .jpg, 100); /开始自动监控 private void btnAutoMonitor_Click(object sender, EventArgs e) if (btnAutoMonitor.Text = 开始) if (rbtnWideWatch.Checked) messagesend = pelcod.CameraTilt(addressin, PelcoD.Tilt.Up, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); Thread.Sleep(2000); messagesend = pelcod.CameraPan(addressin, PelcoD.Pan.Left, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); Thread.Sleep(2000); messagesend = pelcod.CameraTilt(addressin, PelcoD.Tilt.Down, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); Thread.Sleep(2000); messagesend = pelcod.CameraPan(addressin, PelcoD.Pan.Right, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); else if (rbtnVerticalWatch.Checked) messagesend = pelcod.CameraTilt(addressin, PelcoD.Tilt.Up, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); Thread.Sleep(2000); messagesend = pelcod.CameraTilt(addressin, PelcoD.Tilt.Down, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); else messagesend = pelcod.CameraPan(addressin, PelcoD.Pan.Left, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); Thread.Sleep(2000); messagesend = pelcod.CameraPan(addressin, PelcoD.Pan.Right, speedin); serialPort.Open(); serialPort.Write(messagesend, 0, 7); serialPort.Close(); btnAutoMonitor.Text = 停止; else stopMove(); btnAutoMonitor.Text = 开始; /停止监控 private void btnStop_Click(object sender, EventArgs e) if (btnStop.Text = 停止) string strDPath = Application.StartupPath; string strPath = strDPath.Substring(0, strDPath.LastIndexOf().Substring(0, strDPath.Substring(0, strDPath.LastIndexOf().LastIndexOf() + Image主页面主界面图片.bmp; plVideo1.BackgroundImage = System.Drawing.Image.FromFile(strPath); VideoOperate.VCAUnInitSdk(); btnStop.Text = 开始; else if (btnStop.Text = 开始) plVideo1.BackgroundImage = null; startMonitor(); btnStop.Text = 停止; /打开软件注册窗体 private void btnReg_Click(object sender, EventArgs e) frmRegister frmregister = new frmRegister(); frmregister.Show(); this.Hide(); #region 释放鼠标时,视频监控停止移动 private void btnUp_MouseUp(object sender, MouseEventArgs e) stopMove(); private void btnDown_MouseUp(object sender, MouseEventArgs e) stopMove(); private void btnLe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 内蒙古医科大学《临床检验仪器学》2023-2024学年第一学期期末试卷
- 成都文理学院《邮轮服务与管理》2023-2024学年第一学期期末试卷
- 黑龙江艺术职业学院《人文社会科学基础》2023-2024学年第一学期期末试卷
- 电子面试试题及答案
- 2015高考试题及答案
- 13道测试题及答案解析
- 江西科技师范大学《合唱指挥(二)》2023-2024学年第一学期期末试卷
- 北京卫生职业学院《康复机能评定》2023-2024学年第一学期期末试卷
- 邯郸职业技术学院《非木材植物人造板》2023-2024学年第一学期期末试卷
- 昆明艺术职业学院《世纪欧美文学》2023-2024学年第一学期期末试卷
- 护理事业十五五发展规划(2026-2030)
- 人教版(2024)七年级下册英语全册教案(8个单元整体教学设计)
- 铝压延加工材项目评估报告
- (环境管理)环境保护与水土保持监理实施细则
- 云南省昆明市官渡区2022-2023学年七年级下学期期末语文试题(含答案)
- 管道护理业务学习课件
- 新求精德语强化教程初级1(第四版)
- GB/T 18601-2001天然花岗石建筑板材
- 汽封加热器 说明书
- 07劳动力及资源配备计划
- 精馏-化工分离工程课件
评论
0/150
提交评论