private void btnSession_Click(object sender, System.EventArgs e) { m_broker = new OCTLNET.Broker(); m_con = m_broker.Create("192.168.0.19"); OysterClassLibrary.CardReader cardreader = (OysterClassLibrary.CardReader)comboBox2.SelectedItem; if (!m_con.Connected) { if (!m_con.Open()) { Msg("*Connection not opened*"); return; } else { Msg("Connection opened"); } } m_con.CreateSession(cardreader.ID); btnStatus.Enabled = true; btnSwipe.Enabled = true; }
private void Button1_ServerClick(object sender, System.EventArgs e) { //LUser =(OysterClassLibrary.User) Session["LUser"]; txtDidOnce.Value = "DIDONCE"; OSystem = (OysterClassLibrary.Oyster) Session["Oyster"]; int RMID = Convert.ToInt32(txtRoomId.Value,10); int LUID = Convert.ToInt32(txtLUserId.Value,10); LUser = OSystem.GetUserById(LUID); OysterClassLibrary.Room RM = OSystem.GetRoomById(RMID); lbTitle.Value = "Recording Scene: " + RM.Description; tbStartTime.Value = System.DateTime.Now.ToShortTimeString(); tbEndTime.Value = System.DateTime.Now.AddHours(2).ToShortTimeString(); m_broker = new OCTLNET.Broker(); Msg("Attempting to create a new control agent..."); m_conn = m_broker.Create(RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Address); Msg("successfully created control agent for " + LUser.Description); Session["Connection"] = m_conn; Session["Broker"] = m_broker; if(!m_conn.Open()) { Msg("Agent failed to connect to Oyster System"); Msg("killing agent.."); txtCloseApp.Value = "Error: Failed to start recording. Unable to establish connection."; return; } Msg("Agent successfully connected to Oyster System"); int CardReaderId = RM.AllCurrentCardReaders.Item(0).ID; m_conn.CreateSession(CardReaderId); m_conn.Swipe(LUser.CardNumber); Session["Connection"] = m_conn; Session["Broker"] = m_broker; }