private void SystemSetup_Load(object sender, EventArgs e) { string errorInfo = ""; //1、初始化通信类(服务器) bool result1 = CommunicationClass.Init(); if (!result1) { MessageBox.Show("连接服务器失败!"); return; } treeView1.ExpandAll(); //2、初始化设备数据(服务器数据库) Class1 class1 = new Class1(); class1.Init(); ManualRec.LogIn(); //获取录像设备选择列表 Thread th1 = new Thread(new ThreadStart(ListView1Init)); th1.IsBackground = true; th1.Start(); //显示录像设置信息 Thread th4 = new Thread(new ThreadStart(GetRecInfo)); th4.IsBackground = true; th4.Start(); //显示开关量设置信息 DataSet ds2 = SwitchDateClass.SelectAll(ref errorInfo); if (ds2 == null) { MessageBox.Show(errorInfo + "获取开关量设置信息失败!"); } else { dataGridView2.DataSource = ds2.Tables["SwitchDateList"]; } //显示其他设置的磁盘信息 LocalDisk(); //显示红外保护信息(服务器数据库) Thread th5 = new Thread(new ThreadStart(GetLensProtection)); th5.IsBackground = true; th5.Start(); lensProtection.Camera_DeviceID = Guid.NewGuid(); //获取开关量列表(服务器数据库) Thread th2 = new Thread(new ThreadStart(ListView2Init)); th2.IsBackground = true; th2.Start(); //获取用户列表(服务器数据库) Thread th3 = new Thread(new ThreadStart(dataGridView3Init)); th3.IsBackground = true; th3.Start(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Class1 c = new Class1(); CommunicationClass.Init(); c.Init(); Application.Run(new InformationManagement()); }
/// <summary> /// 单独启动时需要初始化 /// </summary> public void CommunicationClassInit() { bool result1 = CommunicationClass.Init(); if (result1) { Class1 class1 = new Class1(); class1.Init(); } }
public Form1() { InitializeComponent(); bool result1 = CommunicationClass.Init(); if (result1) { Class1 class1 = new Class1(); //class1.Init(); initFormData(); } }
private void GetInfo() { //连接服务器获取权限列表 string message = "GetUserAuthorityList\r\n"; byte[] data = Encoding.UTF8.GetBytes(message); if (CommunicationClass.stream2 == null) { if (!CommunicationClass.Init()) { MessageBox.Show("服务器连接失败!"); return; } } CommunicationClass.stream2.Write(data, 0, data.Length); Thread th = new Thread(new ThreadStart(ReceiveInfo)); th.IsBackground = true; th.Start(); }
public PlanList() { InitializeComponent(); //ASF.controllInitializeSize(this); bool result1 = CommunicationClass.Init(); if (result1) { MessageBox.Show("通讯初始化成功!"); ////初始化设备数据 //Class1 class1 = new Class1(); //class1.Init(); pre_arrangeList = temp_Pre_Command.Pre_arrangeList_QueryData(); } else { MessageBox.Show("通讯初始化失败!"); } comboBox1.SelectedIndex = 0; AnimateWindow(Handle, 300, AW_CENTER);//窗体弹出效果 }
public PresetForm() { InitializeComponent(); ASF.controllInitializeSize(this); bool result1 = CommunicationClass.Init(); if (result1) { MessageBox.Show("通讯初始化成功!"); ////初始化设备数据 //Class1 class1 = new Class1(); //class1.Init(); //报警预案数据初始化 classplan = new ClassPlan(); classplan.PlanInit(); } else { MessageBox.Show("通讯初始化失败!"); } DataLoad(); AnimateWindow(Handle, 300, AW_CENTER);//窗体弹出效果 }
// 点击登录按钮事件 private void loginBtn_Click(object sender, EventArgs e) { username = userNameCombo.Text;//获取用户名的文本信息 string pass = Encrypt.EncryptPassword(passWord.Text); if (username == "") { result = MessageBox.Show("用户名不能为空", "提示", MessageBoxButtons.OK); } else { if (pass == "") { result = MessageBox.Show("密码不能为空", "提示", MessageBoxButtons.OK); } else { try { string message = "CheckUser/" + username + "," + pass + "\r\n"; byte[] data = Encoding.UTF8.GetBytes(message); CommunicationClass.stream2.Write(data, 0, data.Length); ReceiveData(); //Thread th = new Thread(new ThreadStart(ReceiveData)); //th.IsBackground = true; //th.Start(); } catch (Exception ex) { if (!CommunicationClass.Init()) { MessageBox.Show("服务器连接失败!"); } } } } }
private static void Init() { //绑定服务状态事件 CommunicationClass.ServiceStatusEvent += CommunicationClass_ServiceStatusEvent; //1、初始化通信类 bool result1 = CommunicationClass.Init(); if (result1) { ShowResult("通讯初始化成功!"); //初始化设备数据 Class1 class1 = new Class1(); class1.Init(); if (Class1.IsDone) { NetPing.StateCallback();//状态实时信息 } //报警预案数据初始化 //ClassPlan classplan = new ClassPlan(); //classplan.PlanInit(); } else { ShowResult("通讯初始化失败!"); } //2、流媒体初始化 //先判断流媒体是否启用 if (System.Configuration.ConfigurationManager.AppSettings["MediaStream"] == "1") { int result5 = CMSSdk.VM_CMS_Init(); if (result5 != -1) { ShowResult("流媒体初始化成功!"); } else { ShowResult("流媒体初始化失败!"); } CMSSdk.LPCMS_USER_LOGIN_INFO LoginInfo = new CMSSdk.LPCMS_USER_LOGIN_INFO(); LoginInfo.szIP = System.Configuration.ConfigurationManager.AppSettings["MediaStream_IP"]; LoginInfo.uPort = int.Parse(System.Configuration.ConfigurationManager.AppSettings["MediaStream_Port"]); LoginInfo.szUser = System.Configuration.ConfigurationManager.AppSettings["MediaStream_User"]; LoginInfo.szPassword = System.Configuration.ConfigurationManager.AppSettings["MediaStream_Password"]; form1.lHandle = CMSSdk.VM_CMS_Login(ref LoginInfo, 0); if (form1.lHandle < 0) { MessageBox.Show("媒体管理服务器登录失败!"); } else { MessageBox.Show("媒体管理服务器登录成功!"); } } //3、录像初始化 bool result6 = RecDataClass.Init(); if (result6) { ShowResult("SDK初始化成功!"); } else { ShowResult("SDK初始化失败!"); } //4、报警初始化 CommunicationClass.AlarmEvent += AlarmOperation.Alarm; }