智能家居视频监控系统讲课教案.docx
- 文档编号:12785785
- 上传时间:2023-04-22
- 格式:DOCX
- 页数:34
- 大小:82.13KB
智能家居视频监控系统讲课教案.docx
《智能家居视频监控系统讲课教案.docx》由会员分享,可在线阅读,更多相关《智能家居视频监控系统讲课教案.docx(34页珍藏版)》请在冰豆网上搜索。
智能家居视频监控系统讲课教案
智能家居视频监控系统
简介:
本系统采用了360度无死角摄像头,可全方位监控自己的住所,并且可以锁定监控,
例如门外。
监控系统可在pc端查看记录,并且可以设定场景锁定,若场景发生变化,便会触发报
警系统,给设定的邮箱或手机发送邮件及短信提醒,实时告知用户紧急状况。
此系统可以进行远程监控,即用户可以不在家里的pc端进行监控,只要用户可以上网,
就可通过与被控端连接的计算机外网ip地址监控住所的一切动向。
这让监控变得简洁化及随身化。
代码:
I.Login.cs
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
//添加的命名空间
usingSystem.Data.OleDb;
usingVWMS.CommonClass;
namespaceVWMS
{
publicpartialclassfrmLogin:
Form
{
publicfrmLogin()
{
InitializeComponent();
}
DataCondatacon=newDataCon();
DataOperatedataoperate=newDataOperate();
privatevoidbtnLogin_Click(objectsender,EventArgse)
{一
if(txtName.Text=="")
{1errorProName.SetError(txtName,"用户名不能为空!
");
}
else
{
errorProName.Clear();
stringstrSql="select*fromtb_adminwherename='"+txtName.Text+"'
andpwd='"+txtPwd.Text+;
DataSetds=dataoperate.getDs(strSql,"tb_admin");
if(ds.Tables[0].Rows.Count>0)
{
this.Hide();|
frmMainfrmmain=newfrmMain();
frmmain.Show();
}_J
else
{
MessageBoxShow("用户名或密码错误!
",”警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
}
privatevoidbtnExit_Click(objectsender,EventArgse)
{
Application.Exit();
}
privatevoidtxtName_KeyPress(objectsender,KeyPressEventArgse)
{
if(e.KeyChar==13)|
{
txtPwd.Focus();
e.Handled=true;
}
}
privatevoidtxtPwd_KeyPress(objectsender,KeyPressEventArgse)
{
if(e.KeyChar==13)
{
btnLogin.Focus();
e.Handled=true;
}
}
privatevoidfrmLogin_Load(objectsender.EventArgse)
{
}
}
}
2.SetMonitor.cs
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.OleDb;
usingVWMS.CommonClass;
namespaceVWMS
{
publicpartialclassfrmSetMonitor:
Form
{
publicfrmSetMonitor()
{
InitializeComponent();
}
DataOperatedataoperate=newDataOperate();
DataSetds;
privatevoidfrmSetMonitor_Load(objectsender,EventArgse)
{
lviewBind();
}
privatevoidbtnAdd_Click(objectsender,EventArgse)
{
if(txtName.Text==string.Empty)
{
MessageBoxShow("用户名不能为空!
","提示",MessageBoxButtons.OK,
MessageBoxIcon.lnformation);
else
{
ds=dataoperate.getDs("select*fromtb_adminwherename='"+txtName.Text
+""',"tb_admin");
if(ds.Tables[0].Rows.Count>0)
{n
MessageBoxShow("该用户已经存在!
","提示",MessageBoxButtons.OK,
MessageBoxIcon.lnformation);
}
else
{n
dataoperate.getCom("insertintotb_admin(name,pwd)values('"+
txtName.Text+"','"+txtPwd.Text+"')");
lviewBind();
txtName.Text=txtPwd.Text=string.Empty;
}I
}
}
privatevoidbtnEditClick(objectsender,EventArgse)
{
if(txtName.Text==string.Empty&&txtPwd.Text==string.Empty)
{
MessageBoxShow("用户名或密码不能为空!
","提示",MessageBoxButtons.OK,
MessageBoxIcon.lnformation);
}
else
{
dataoperate.getCom("updatetb_adminsetpwd='"+txtPwd.Text+"'where
name='"+txtName.Text+""');
lviewBind();
txtName.Text=txtPwd.Text=string.Empty;
}
}
privatevoidbtnDel_Click(objectsender,EventArgse)
—{
if(txtName.Text.ToLower()=="tsoft")
{
MessageBoxShow(”该用户是超级用户,不能删除!
","警告",
MessageBoxButtons.OK,MessageBoxIcon.Warning);
else
dataoperate.getCom("deletefromtb_adminwherename='"+txtName.Text+
"'");
lviewBind();
txtName.Text=lview.ltems[O].Text;
}
}
privatevoidlview_Click(objectsender,EventArgse)
{
txtName.Text=lview.Selectedltems[O].Text;
txtPwd.Text=string.Empty;
}
publicvoidlviewBind()
{
lview.Items.Clear();
ds=dataoperate.getDs("selectnamefromtb_admin","tb_admin");
foreach(DataRowdrinds.Tables[O].Rows)
{
ListViewItemlvItem=newListViewItem(dr[O].ToString(),0);
lvltem.Subltems.Add(dr[O].ToString());
lview.Items.Add(lvItem);
}
}
}
}
3.Register.cs
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingVWMS.CommonClass;
usingMicrosoft.Win32;
namespaceVWMS
{
publicpartialclassfrmRegister:
Form
{
publicfrmRegister()
{
InitializeComponent();
}
SoftRegsoftreg=newSoftReg();
privatevoidfrmRegister_Load(objectsender,EventArgse)
{
txtMNum.Text=softreg.getMNum();
}
private
voidbtnReg_Click(objectsender,
EventArgse)
{
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");
MessageBoxShow("注册成功!
","信息",MessageBoxButtons.OK,
MessageBoxIcon.lnformation);
showMain();
}
else
{
MessageBoxShow("注册码输入错误!
","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
privatevoidbtnClose_Click(objectsender,EventArgse)
{
showMain();
}
//隐藏注册窗体,显示主窗体|
publicvoidshowMain()
{
this.Hide();
frmMainfrmmain=newfrmMain();
frmmain.Show();
}
}
4.Play.cs
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceVWMS
{
publicpartialclassfrmPlay:
Form
{
publicfrmPlay()
{
InitializeComponent();
}
privatevoidbtnPlay_Click(objectsender,EventArgse)
{
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("\\"))+"WVideoW";
if(ofDialog.ShowDialog()==DialogResult.OK)
{
this.axWindowsMediaPlayer1.URL=ofDialog.FileName;
}
}
privatevoidbtnClose_Click(objectsender,EventArgse)
{
this.Close();
}
privatevoidaxWindowsMediaPlayer1_Enter(objectsender,EventArgse)
{
}
}
5.Main.cs
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
//添加的命名空间
usingVWMS.CommonClass;
usingSystem.10.Ports;
usingMicrosoft.Win32;
usingSystem.Threading;
namespaceVWMS{
publicpartialclassfrmMain:
Form
{
publicfrmMain()
{
InitializeComponent();
}
PelcoDpelcod=newPelcoD();
.None,8);
SoftRegsoftreg=newSoftReg();
SerialPortserialPort=newSerialPort("COM1"2400,Parityintm_dwDevNum=0;
byteaddressin=Byte.Parse(Convert.ToString(0x01));
bytespeedin=Byte.Parse(Convert.ToString(Oxff));
byte[]messagesend;
privatevoidfrmMain_Load(objectsender,EventArgse)
{
plVideo1.Backgroundlmage=null;
RegistryKeyretkey
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("software",true).CreateSubKey("wxk").CreateSubKey("wxk.INI");
foreach(stringstrRNuminretkey.GetSubKeyNames()){"I
if(strRNum==softreg.getRNum())
{
this.Text="智能视频监控系统“;
btnReg.Enabled=false;
startMonitor();
return;
}
}
this.Text="智能视频监控系统“;
btnReg.Enabled=true;
btnSetMonitor.Enabled=btnAutoMonitor.Enabled=false;
startMonitor();
MessageBoxShow(”您现在使用的是试用版,该软件可以免费试用30次!
","提示”,
MessageBoxButtons.OK,MessageBoxIcon.lnformation);
Int32tLong;
try
{
tLong=(Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\angel"
"UseTimes",0);
MessageBoxShow(“感谢您已使用了“+tLong+"次","提示",
MessageBoxButtons.OK,MessageBoxIcon.lnformation);
}
catch
{
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\angel"'UseTimes",0,RegistryValueKind.DWord);
MessageBoxShow("欢迎新用户使用本软件","提示",MessageBoxButtons.OK,
MessageBoxIcon.lnformation);
}
tLong=(Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\angel"
"UseTimes",0);
if(tLong<30)|
{
intTimes=tLong+1;
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\angel""UseTimes",
Times);
}
else
{
MessageBoxShow("试用次数已^U","警告",MessageBoxButt。
ns.OK,
MessageBoxIcon.Warning);
Application.Exit();
}
}
privatevoidfrmMain_Move(objectsender,EventArgse)
{
for(inti=0;i pIVideol.lnvalidate(); VideoOperate.VCAUpdateOverIayWnd(this.Handle); VideoOperate.VCAUpdateVideoPreview(i,plVideo1.Handle); } } privatevoidbtnSetMonitor_Click(objectsender,EventArgse) { frmSetMonitorfrmsetmonitor=newfrmSetMonitor(); frmsetmonitor.ShowDialog(); } privatevoidbtnVideo_Click(objectsender,EventArgse) { if(btnVideo.Text=="录像") { sfDialog.Filter="*avi|*avi";| sfDialog.Title="保存视频文件“; sfDialog.InitialDirectory=Application.StartupPath.Substring(0. Application.StartupPath.LastlndexOf( "\\")).Substring(0. Application Application .StartupPath.Substring(0, .StartupPath.LastlndexOf( "\\")).LastIndexOf("\\"))+ "WVideoW" { 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.COMPRESSMODTO_VBR_MODE); VideoOperate .VCAStartVideoCapture(0, VideoOperate.CAPM0DEAP_MPEG4_STREAM,VideoOperate.MP4MODffiMPEG4_AVIFILE_CALLBACK,sfDialog.FileName); } } elseif(btnVideo.Text=="停止录像”) { btnVideo.Text="录像"; VideoOperate.VCAStopVideoCapture(O); //回放 privatevoidbtnPlay_Click(objectsender.EventArgse) { frmPlayfrmpaly=newfrmPlay();frmpaly.ShowDialog(); } //快照 privatevoidbtnSnapShots_Click(objectsender,EventArgse) DateTime.Now.ToFileTime()+".
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 智能家居 视频 监控 系统 讲课 教案