protected void btnSendMessage_Click(object sender, EventArgs e)
        {
            String content = txtSendMessage.Text;

            CommunicationClass.insertMessage(conversationID, user, content);
            gvMessages.DataSource = CommunicationClass.getMessages(conversationID);
            gvMessages.DataBind();
        }
        public AWIRSSIUserControl()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call
            communication = MainForm.communication;
        }
Exemple #3
0
        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();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     conversationID = Session["conversationID"].ToString();
     //debug
     //conversationID = "BobJen";
     user = Session["User"].ToString();
     gvMessages.DataSource = CommunicationClass.getMessages(conversationID);
     gvMessages.DataBind();
 }
Exemple #5
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Class1 c = new Class1();

            CommunicationClass.Init();
            c.Init();
            Application.Run(new InformationManagement());
        }
        protected void gvMessages_SelectedIndexChanged(object sender, EventArgs e)
        {
            //String conversationID = gvMessages.Rows[gvMessages.SelectedIndex].Cells[3].Text;
            int messageID = Convert.ToInt32(gvMessages.Rows[gvMessages.SelectedIndex].Cells[3].Text);

            Session["conversationID"] = conversationID;
            CommunicationClass.deleteMessage(messageID);
            gvMessages.DataSource = CommunicationClass.getMessages(conversationID);
            gvMessages.DataBind();
        }
        /// <summary>
        /// 单独启动时需要初始化
        /// </summary>
        public void CommunicationClassInit()
        {
            bool result1 = CommunicationClass.Init();

            if (result1)
            {
                Class1 class1 = new Class1();
                class1.Init();
            }
        }
Exemple #8
0
        public Form1()
        {
            InitializeComponent();
            bool result1 = CommunicationClass.Init();

            if (result1)
            {
                Class1 class1 = new Class1();
                //class1.Init();
                initFormData();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["UserType"].ToString() == "v")
         {
             Response.Redirect("/search.aspx");
         }
         String user = Session["User"].ToString();
         gvAllConversations.DataSource = CommunicationClass.myConversation(user);
         gvAllConversations.DataBind();
     }
 }
Exemple #10
0
        //private NetRdrReconnClass netRdrReconn;
        #endregion

        #region Constructor
        public NetRdrConnClass(CommunicationClass comm)
        {
            rdrIndexPoll     = 0;          //index of pollReaderStruct
            trunOnRdrPolling = false;      //stop timer for OnPollReaderTimerEvent until it is set
            communication    = comm;
            //netRdrReconn = new NetRdrReconnClass(comm);
            CommunicationClass.PowerupEventHandler      += new PowerupEvent(this.PowerupReaderNotifty);
            CommunicationClass.RdrErrorEventHandler     += new RdrErrorEvent(this.ErrorEventNotify);
            CommunicationClass.EnableReaderEventHandler += new EnableReaderEvent(this.EnableReaderEventNotify);
            CommunicationClass.CloseSocketEventHandler  += new CloseSocketEvent(this.CloseSocketEventNotify);

            CommunicationClass.TagDetectedEventHandler           += new TagDetectedEvent(this.ReaderIsOnlineEventNotify);
            CommunicationClass.TagDetectedRSSIEventHandler       += new TagDetectedRSSIEvent(this.ReaderIsOnlineEventNotify);
            CommunicationClass.TagDetectedTamperEventHandler     += new TagDetectedTamperEvent(this.ReaderIsOnlineEventNotify);
            CommunicationClass.TagDetectedRSSITamperEventHandler += new TagDetectedRSSITamperEvent(this.ReaderIsOnlineEventNotify);
        }
        public TagSearchClass(CommunicationClass comm)
        {
            #region events
            communication = comm;
            CommunicationClass.PowerupEventHandler  += new PowerupEvent(this.PowerupReaderEventNotifty);
            CommunicationClass.QueryTagEventHandler += new QueryTagAckEvent(this.QueryTagEventNotifty);

            srchIndex   = -1;
            startSearch = false;
            srchTagID   = 0;
            counter     = 0;

            searchReaderTimer           = new System.Timers.Timer();
            searchReaderTimer.Interval  = 3000;
            searchReaderTimer.AutoReset = true;
            searchReaderTimer.Enabled   = true;
            searchReaderTimer.Elapsed  += new ElapsedEventHandler(OnSearchReaderTimer);
            #endregion
        }
        public NetRdrReconnClass(CommunicationClass comm)
        {
            communication = comm;

            startProcessEvents     = false;
            scanRdrIpListIndex     = -1;
            openSockRdrIpListIndex = -1;
            resetRdrIpListIndex    = -1;

            //Scanner
            OnRdrScanTimer           = new Timer();
            OnRdrScanTimer.Interval  = 1200;
            OnRdrScanTimer.AutoReset = true;
            OnRdrScanTimer.Enabled   = true;
            OnRdrScanTimer.Elapsed  += new ElapsedEventHandler(OnRdrScanTimerEvent);

            //open socket
            OnRdrOpenSocketTimer           = new Timer();
            OnRdrOpenSocketTimer.Interval  = 1400;
            OnRdrOpenSocketTimer.AutoReset = true;
            OnRdrOpenSocketTimer.Enabled   = true;
            OnRdrOpenSocketTimer.Elapsed  += new ElapsedEventHandler(OnRdrOpenSocketTimerEvent);

            // reset/powerup reader
            OnRdrRestTimer           = new Timer();
            OnRdrRestTimer.Interval  = 3000;
            OnRdrRestTimer.AutoReset = true;
            OnRdrRestTimer.Enabled   = true;
            OnRdrRestTimer.Elapsed  += new ElapsedEventHandler(OnRdrRestTimerEvent);

            //api = new APINetClass();
            pktID = 1;

            #region events
            //these events will be used by the communication class to let the module know of the events
            CommunicationClass.PowerupEventHandler     += new PowerupEvent(this.PowerupReaderNotifty);
            CommunicationClass.ScanNetworkEventHandler += new ScanNetworkEvent(this.ScanNetworkEventNotify);
            CommunicationClass.OpenSocketEventHandler  += new OpenSocketEvent(this.OpenSocketEventNotify);
            CommunicationClass.CloseSocketEventHandler += new CloseSocketEvent(this.CloseSocketEventNotify);
            NetRdrConnClass.StartReconnProcessHandler  += new StartReconnProcess(this.StartReconnProcessNotify);
            #endregion
        }
Exemple #13
0
        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();
        }
Exemple #14
0
        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);//窗体弹出效果
        }
Exemple #15
0
        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);//窗体弹出效果
        }
Exemple #16
0
        // 点击登录按钮事件
        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("服务器连接失败!");
                        }
                    }
                }
            }
        }
Exemple #17
0
 public EventClass()
 {
     comm = new CommunicationClass();
     comm.TagDetectedEventHandler += new TagDetectedEvent(comm_TagDetectedEventHandler);        //+= new EnableOutputRelay(eventActions_EnableOutputRelayEvent);
 }
 protected void btnMessage_Click(object sender, EventArgs e)
 {
     CommunicationClass.newConversation(Session["User"].ToString(), Session["ViewProfileUsername"].ToString());
     Session["communicationID"] = Session["User"].ToString() + Session["ViewProfileUsername"].ToString();
     Response.Redirect("/AllConversations.aspx");
 }
Exemple #19
0
        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;
        }