/// <summary> /// Update câu trả lời cho client /// </summary> /// <param name="client"></param> public void updateClientAnswer(MyClient client, string answer) { if (this.tbMessage.InvokeRequired) { SetClientAnswerCallback d = new SetClientAnswerCallback(updateClientAnswer); this.Invoke(d, new object[] { client, answer }); } else { for (int i = 0; i < lvClients.Items.Count; i++) { int id = (int)lvClients.Items[i].Tag; if (id == client.getId()) { lvClients.Items[i].SubItems[1].Text = answer; break; } } } }
/// <summary> /// Thêm một client vào danh sách user /// </summary> /// <param name="client"></param> /// <returns></returns> public void addClientToListView(MyClient client) { //ListViewItem item = new ListViewItem(); //item.Text = client.Username; //item.Tag = client.getId(); //item.SubItems.Add(""); //lvClients.Items.Add(item); MyClient my_new_text = client; // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.tbMessage.InvokeRequired) { SetLvClientCallback d = new SetLvClientCallback(addClientToListView); this.Invoke(d, new object[] { client }); } else { ListViewItem item = new ListViewItem(); item.Text = client.Username; item.Tag = client.getId(); item.SubItems.Add(""); lvClients.Items.Add(item); } }
/// <summary> /// Check if the input is a valid url. /// </summary> /// <param name="url"></param> /// <returns>Returns input if it's a valid url. If the input is not a valid url, returns empty string.</returns> public static string CleanUrl(string url) { if(string.IsNullOrWhiteSpace(url)) { return string.Empty; } string prefix = "http"; if(url.Substring(0, prefix.Length) != prefix) { url = prefix + "://" + url; } using(var client = new MyClient()) { client.HeadOnly = true; try { client.DownloadString(url); } catch(WebException) { url = string.Empty; } return url; } }
private void FillCombo() { client = new MyClient(); ds = new DataSet(); ds.Tables.Add(client.GetTable("Select Id,Name From Office")); cboOfficeName.DataSource = ds.Tables[0].DefaultView; cboOfficeName.ValueMember = "Id"; cboOfficeName.DisplayMember = "Name"; cboOfficeName.SelectedIndex = 0; }
/// <summary> /// Handles initial connection /// </summary> private void OnOpen(object sender, EventArgs e) { Authentication authenticateBlock = new Authentication(ConfigSettings); TransportMessage auth = new TransportMessage() { Event = authenticateBlock.Type, Payload = authenticateBlock }; MyClient.Send(Serialize(auth)); }
public void Test1() { var rc = new Rectangle(2, 3); var s1 = MyClient.UseIt(rc); Assert.AreEqual("Expected area of 20, got 20", s1); var sq = new Square(5); var s2 = MyClient.UseIt(sq); Assert.AreEqual("Expected area of 100, got 100", s2); }
public void disconnect() { int result; result = MyClient.Disconnect(); if (result != 0) { string error = "Error during PLC disconnect"; throw new wPlcException(error, result); } }
/// <summary> /// 用户离开 /// </summary> /// <param name="client"></param> /// <returns></returns> public AccountModel Leave(MyClient client) { if (!room.clientAccountDict.ContainsKey(client)) { return(null); } AccountModel model = room.clientAccountDict[client]; room.clientAccountDict.Remove(client); return(model); }
public override void Initialize(AiClient client) { score = 0; EventManager.Instance.AddListener <Events.UtilityAi.OnActionChanged>(e => { if (MyClient.Equals(Events.UtilityAi.OnActionChanged.Origin) && Events.UtilityAi.OnActionChanged.Action.Name == resetAction) { ResetScore(); } }); base.Initialize(client); }
public MyClient GetClient() { var apiKey = ConfigurationManager.AppSettings["APIKey"]; var myClient = new MyClient(apiKey); // This will not work as this code is executed on app start // The identity will not be of the user making the web request var identity = Thread.CurrentPrincipal.Identity as ClaimsIdentity; var tokenClaim = identity.Claims.First(c => c.Type == ClaimTypes.Sid); client.AddCredentials(tokenClaim.Value); return(myClient); }
public void start() { MyClient client = new MyClient(); bool joined = false; Server myServer = new Server(); while (!joined) { joined = client.sendMessage("JOIN#"); } myServer.listen(); }
private void InitHomePage() { ipAddress = txtIPServer.Text.Trim(); username = txtID.Text.Trim(); password = txtPassword.Password.Trim(); myClient = new MyClient(username, password, ipAddress); myClient.LoginMessageReceived += myClient_LoginMessageReceived; myClient.TakeTooMuchTimeToConnect += myClient_TakeTooMuchTime; myClient.ConnectionChanged += myClient_ConnectionChanged; myClient.TimesUp += myClient_TimesUp; myClient.MessageGenerated += myClient_MessageGenerated; }
/// <summary> /// 客户端进入聊天房间 /// </summary> /// <param name="client"></param> private void enter(MyClient client) { OperationResponse response = new OperationResponse((byte)OpCode.Chat, new Dictionary <byte, object>()); AccountModel account = Factory.AccountCache.GetModel(client); RoomModel room = cache.Enter(client, account); if (room == null) { response.DebugMessage = "进入失败."; response.ReturnCode = -1; client.SendOperationResponse(response, new SendParameters()); return; } //成功进入(2个事情) //1.告诉他自己 进入成功 给他发送一个房间模型 RoomDto roomDto = new RoomDto(); foreach (var model in room.clientAccountDict.Values) { roomDto.accountList.Add(new AccountDto() { Account = model.Account, Password = model.Password }); } response.Parameters[80] = ChatCode.Enter; response.Parameters[0] = LitJson.JsonMapper.ToJson(roomDto); response.DebugMessage = "进入成功."; response.ReturnCode = 0; client.SendOperationResponse(response, new SendParameters()); //2.告诉房间的其他人 有新的客户端连接了 AccountDto accountDto = new AccountDto() { Account = account.Account, Password = account.Password }; response.Parameters[80] = ChatCode.Add; response.Parameters[0] = LitJson.JsonMapper.ToJson(accountDto); response.DebugMessage = "新的客户端进入."; response.ReturnCode = 1; foreach (var item in room.clientAccountDict.Keys) { if (item == client) { continue; } item.SendOperationResponse(response, new SendParameters()); } }
private void ShowData() { client = new MyClient(); DataTable dt = new DataTable(); dt = client.GetTable("Select Id,UserName From Users Where ClosedDate Is NULL order by UserName"); cboUsers.DataSource = dt.DefaultView; cboUsers.ValueMember = "UserName"; cboUsers_SelectedIndexChanged(null, null); txtPass0.Focus(); this.AcceptButton = btnSubmit; }
public static void RecieveGameRequest(byte[] bytes, MyClient client) { int byte_compt = 0; int user_id = BitConverter.ToInt16(bytes, byte_compt); byte_compt += 2; int userName_length = BitConverter.ToInt16(bytes, byte_compt); byte_compt += 2; string userName = System.Text.Encoding.UTF8.GetString(bytes, byte_compt, userName_length); byte_compt += userName_length; if (!(client.ConnectedUsers.ContainsKey(user_id))) { client.ConnectedUsers[user_id] = new User(user_id, userName); } client.gameRequestsRecieved[user_id] = new User(user_id, userName); }
/// <summary> /// Changes the score on the game objet and in the player's UIEOD /// </summary> /// <param name="newScore"></param> internal void ChangeMyScore(short newScore, bool immediately) { MyScore = newScore; // execute Simantics event to display new score on this object if (immediately) { Controller.SendOBJEvent(new VMEODEvent((short)VMEODGameshowPlayerPluginEvents.Change_My_Score, new short[] { MyScore })); } // execute Client event to display new score in UIEOD MyClient.Send("Buzzer_Player_Score", BitConverter.GetBytes(MyScore)); }
private void EditData(int id) { string[] installs = new string[] { "Məbləğ", "Faiz" }; cmbxAdditiontype.Items.AddRange(installs); client = new MyClient(); ds = new DataSet(); ds = client.GetDataSet("Select a.Id,a.Name,a.Number,b.Name As GroupName,a.Type,a.Amount,a.GroupId, a.Status" + " From Tables As a INNER JOIN TableGroup As b ON a.Id = b.Id Where a.Id =" + id + "; Select Id, Name From TableGroup; Select Distinct Number From Tables"); cmbxTableGroup.DataSource = ds.Tables[1].DefaultView; cmbxTableGroup.DisplayMember = "Name"; cmbxTableGroup.ValueMember = "Id"; foreach (DataRow dr in ds.Tables[0].Rows) { txtName.Text = (dr["Name"].ToString()); tablename = (dr["Name"].ToString()); cmbxTableNumber.SelectedValue = (int)dr["Number"]; defnum = (dr["Number"].ToString()); cmbxTableGroup.SelectedValue = (int)dr["GroupId"]; cmbxAdditiontype.SelectedIndex = (int)dr["Type"]; txtAdditionAmount.Text = (dr["Amount"].ToString()); chbxStatus.Checked = Convert.ToBoolean(dr["Status"]); } ds.Dispose(); chbxStatus.Enabled = false; cmbxTableNumber.Items.Add(defnum); cmbxTableNumber.SelectedIndex = 0; for (int i = 1; i <= 100; i++) { int k = 0; foreach (DataRow dr in ds.Tables[2].Rows) { if (i.ToString() != dr["Number"].ToString()) { k++; } } if (k == ds.Tables[2].Rows.Count) { cmbxTableNumber.Items.Add(i.ToString()); } } }
public void setCpuRunMode(wCpuRunMode runMode) { int result; wCpuRunMode currentRunMode = this.getCpuRunMode(); if (runMode == wCpuRunMode.Run) { if (currentRunMode == wCpuRunMode.Run) { Console.WriteLine("PLC is already in Run"); } else { result = MyClient.PlcHotStart(); if (result == 0) { Console.WriteLine("PLC has started"); } else { string error = "Could not start PLC"; throw new wPlcException(error, result); } } } else if (runMode == wCpuRunMode.Stop) { if (currentRunMode == wCpuRunMode.Stop) { Console.WriteLine("PLC is already in Stop"); } else { result = MyClient.PlcStop(); if (result == 0) { Console.WriteLine("PLC has stopped"); } else { string error = "Could not stop PLC"; throw new wPlcException(error, result); } } } else { Console.WriteLine("Unknown is not a valid CPU Run Mode"); } }
public void copyRamToRom() { int result = MyClient.PlcCopyRamToRom(timeout); if (result == 0) { Console.WriteLine("Copied RAM to ROM"); } else { string error = "Could not copy RAM to ROM"; throw new wPlcException(error, result); } }
public void compressMemory() { int result = MyClient.PlcCompress(timeout); if (result == 0) { Console.WriteLine("PLC Memory Compressed"); } else { string error = "Could not compress PLC memory"; throw new wPlcException(error, result); } }
public Task <CustomerDetails> GetCustomerDetails(int customerId) { var tcs = new TaskCompletionSource <CustomerDetails>(); var client = new MyClient(); client.GetCustomerDetailsCompleted += (object sender, GetCustomerDetailsCompletedEventArgs e) => { var result = new CustomerDetails(); result.Name = e.Name; tcs.SetResult(result); } client.GetCustomerDetailsAsync(customerId); return(tcs.Task); }
public void downloadBlock(List <byte> b) { int result = MyClient.Download(-1, b.ToArray(), b.Count); if (result != 0) { string error = "Failed to download block"; throw new wPlcException(error, result); } else { Console.WriteLine("Downloaded Block"); } }
private void ShowData(int id) { client = new MyClient(); dt = client.GetTable("Select RoleName, Role,RoleStr From Users Where Id=" + id); if (dt.Rows.Count > 0) { string rolename = dt.Rows[0]["RoleName"].ToString(); string rolevalue = dt.Rows[0]["Role"].ToString(); foreach (Control control in this.Controls) { if ((control is CheckBox) && ((CheckBox)control).Checked) { ((CheckBox)control).Checked = false; } } if (rolename == "Admin" && rolevalue.Length > 5) { foreach (Control control in grUserRoles.Controls) { if ((control is CheckBox)) { ((CheckBox)control).Checked = true; ((CheckBox)control).Enabled = false; } } } else { char[] delimiters = new char[] { ',' }; string[] parts = rolevalue.Split(delimiters, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < parts.Length; i++) { foreach (Control control in grUserRoles.Controls) { if ((control is CheckBox)) { if (((CheckBox)control).Tag.ToString() == parts[i].ToString().Trim()) { ((CheckBox)control).Checked = true; } } } } } } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } MyClient = await _context.MyClient.FirstOrDefaultAsync(m => m.MyClientID == id); if (MyClient == null) { return(NotFound()); } return(Page()); }
public void adfsdl() { IPAddress ipAddress = IPAddress.Any; TcpListener tcpListener = new TcpListener(ipAddress, 13000); tcpListener.Start(); bool done = false; while (!done) { TcpClient tcpClient = tcpListener.AcceptTcpClient(); MyClient newClient = new MyClient(tcpClient); Thread t = new Thread(new ThreadStart(newClient.Communicate)); t.Start(); } }
public byte[] readM(int location, int length) { byte[] b = new byte[length]; int result = MyClient.MBRead(location, length, b); if (result == 0) { return(b); } else { string error = "Problem reading M, " + location + ", " + length; throw new wPlcException(error, result); } }
private void Write(IAsyncResult result) { MyClient obj = (MyClient)result.AsyncState; if (obj.client.Connected) { try { obj.stream.EndWrite(result); } catch (Exception ex) { LogWrite(string.Format("[/ {0} /]", ex.Message)); } } }
public void DragBowPin() { // Vector3 newPos = Vector3.zero; //bowPin.position = Input.GetTouch(touchBowIndex).position; float angle = Vector3.Angle(bowPin.position - bowBase.position, Vector3.up); if (bowPin.position.x > bowBase.position.x) { angle = -angle; } bowPad.eulerAngles = new Vector3(0, 0, angle); string msg = "BOWANGLE" + "-" + (angle + 180).ToString(); // Debug.Log(msg); MyClient.SendButtonInfo(msg); }
public void OnPointerUp(PointerEventData data) { // Debug.Log("tc|" + Input.touchCount); touchOnAnalogCount--; MyClient.SendButtonInfo("ANALOGUP"); /*foreach (Image img in analogImg) * img.enabled = false;*/ isAnalogPinDrag = false; analogPin.position = startPos; // touchAnalogIndex = -1; joyStick.endDrag(); rePostAnalog(); }
//public void startDrag() //{ // touchOnAnalogCount++; // isAnalogPinDrag = true; // touchAnalogIndex = Input.touchCount - 1; // Touch nt = Input.GetTouch(touchAnalogIndex); // startPos = nt.position; // analogBase.position = startPos; // joyStick.setCostumeDrag(startPos); // foreach (Image img in analogImg) // img.enabled = true; // // Debug.Log(Input.touchCount); //} //public void stopDrag() //{ // // Debug.Log("tc|" + Input.touchCount); // touchOnAnalogCount--; // if (touchOnAnalogCount == 0) // { // foreach (Image img in analogImg) // img.enabled = false; // isAnalogPinDrag = false; // analogPin.position = startPos; // touchAnalogIndex = -1; // joyStick.endDrag(); // } //} public void OnDrag(PointerEventData data) { analogPin.position = data.position; float angle = Vector3.Angle(analogPin.position - analogBase.position, Vector3.up); if (analogPin.position.x > analogBase.position.x) { angle = -angle + 360; } string msg = "CASTANGLE" + "-" + (angle).ToString(); MyClient.SendButtonInfo(msg); // Debug.Log(test.phase); //Debug.Log(data.position); //joyStick.costumeDrag(Input.GetTouch(touchAnalogIndex).position); }
public void SentSkillUpFromButton(int buttonIndex) { try { if (MyClient.Instance != null && MyClient.Instance.IsConnectedToServer()) { MyClient.SendUpSkillMessage(skillPanels[buttonIndex].skillCode); } Debug.Log("Sending skillcode " + skillPanels[buttonIndex].skillCode + " To Server"); } catch (System.Exception) { Debug.LogError("Can't send message to server, Check internet connection"); } skillUpSystem.Upskill(skillPanels[buttonIndex].skillCode); }
/// <summary> /// 聊天 /// </summary> /// <param name="client"></param> /// <param name="text"></param> private void Talk(MyClient client, string text) { OperationResponse response = new OperationResponse((byte)OpCode.Chat, new Dictionary <byte, object>()); response.Parameters[80] = ChatCode.Talk; AccountModel account = Factory.AccountCache.GetModel(client); RoomModel room = cache.GetModel(); //群发给每一个客户端 response.Parameters[0] = string.Format("{0} : {1}", account.Account, text); foreach (var item in room.clientAccountDict.Keys) { item.SendOperationResponse(response, new SendParameters()); } }
private void Main_Load(object sender, EventArgs e) { client = new MyClient(); dt = new DataTable(); dt = client.GetTable("Select PasswordHash from Users Where Id=" + userId); string hashcode = client.PassHash("1234"); if (hashcode == dt.Rows[0][0].ToString()) { PasswordChange pswrch = new PasswordChange(); pswrch.ShowDialog(); } LoadMenu(); }
private void ChangeBuzzerState(VMEODGameshowBuzzerStates newState) { switch (newState) { case VMEODGameshowBuzzerStates.Ready: { SetUTimer(_Options.BuzzerTimeLimit); BroadcastToPlayers("BuzzerEOD_Master", new byte[] { 1 }, true); _Tock = 0; break; } case VMEODGameshowBuzzerStates.Engaged: { SetUTimer(_Options.AnswerTimeLimit); _EngagedTimer = ACTIVE_BUZZER_WINDOW_TICKS; _Tock = 0; break; } case VMEODGameshowBuzzerStates.Expired: { MyClient.Send("Buzzer_Host_Tip", (byte)VMEODGameshowBuzzerPluginEODTips.H_Player_Timeout + ""); break; } case VMEODGameshowBuzzerStates.Disabled: { _AnsweringPlayerIndex = -1; BroadcastToPlayers("BuzzerEOD_Master", new byte[] { 0 }, false); _Tock = 0; break; }; case VMEODGameshowBuzzerStates.Locked: { // other players should react var players = GetConnectedPlayers(_AnsweringPlayerIndex, true); foreach (var otherPlayers in players) { otherPlayers.ActivateOtherBuzzer(); } break; } } _BuzzerState = newState; }
public void multipleを超えたリクエストは破棄される事をcountで確認する() { const int multiple = 5; const int port = 8889; const string address = "127.0.0.1"; var ip = new Ip(address); var oneBind = new OneBind(ip, ProtocolKind.Tcp); Conf conf = TestUtil.CreateConf("OptionSample"); conf.Set("port", port); conf.Set("multiple", multiple); conf.Set("acl", new Dat(new CtrlType[0])); conf.Set("enableAcl", 1); conf.Set("timeOut", 3); var myServer = new MyServer(conf, oneBind); myServer.Start(); var ar = new List<MyClient>(); for (int i = 0; i < 20; i++){ var myClient = new MyClient(address, port); myClient.Connet(); ar.Add(myClient); } Thread.Sleep(100); //multiple以上は接続できない Assert.That(myServer.Count(), Is.EqualTo(multiple)); myServer.Stop(); myServer.Dispose(); foreach (var c in ar){ c.Dispose(); } }
private static string GetContent(String csvLink) { if (System.IO.File.Exists(csvLink)) return System.IO.File.ReadAllText(csvLink); String content = ""; using (MyClient client = new MyClient()) { client.HeadOnly = true; string uri = csvLink; byte[] body = client.DownloadData(uri); // note should be 0-length string type = client.ResponseHeaders["content-type"]; client.HeadOnly = false; // check 'tis not binary... we'll use text/, but could // check for text/html if (type.StartsWith(@"text/") || IsTextExtension(csvLink)) { client.HeadOnly = false; content = client.DownloadString(uri); } else throw new Exception(@"Dokumentet skal være tekst-baseret. Se den gratis demo for hjælp"); } return content; }
/// <summary> /// Xóa client ra khỏi listview /// </summary> /// <param name="client"></param> public void removeClientFromListView(MyClient client) { MyClient my_new_text = client; // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.tbMessage.InvokeRequired) { SetLvClientCallback d = new SetLvClientCallback(removeClientFromListView); this.Invoke(d, new object[] { client }); } else { for (int i = 0; i < lvClients.Items.Count; i++) { int id = (int)lvClients.Items[i].Tag; if (id == client.getId()) { lvClients.Items.RemoveAt(i); break; } } } }
private void TcpServerListen() { IPAddress ipAddress = IPAddress.Any; _tcpListener = new TcpListener(ipAddress, 13000); _tcpListener.Start(); while (_tcpListening) { TcpClient tcpClient = _tcpListener.AcceptTcpClient(); if (_threadCount > toplimit) { // tell Client it's been over 2000 continue; } MyClient newClient = new MyClient(tcpClient, this); Thread t = new Thread(new ThreadStart(newClient.Communicate)); t.IsBackground = true; t.Start(); _list.Add(newClient); } }
public MainWindow() { InitializeComponent(); //set the current date and time currentDateTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //set total timer count to 0 and init vars highPerformanceTimer = new HiPerfTimer(); totalHighPerfTimeElapsed = 0; numLinesWritten = 0; //set the total number of lines written to 0 so we can track when to start the timer //init pipe stuff pipeClient = new MyClient(PIPE_NAME); pipeClient.SendMessage("I Am Intel RealSense"); //Debug.WriteLine("Server Ready"); //initialise combobox populateComboBox(); //init the exprToDisplay global var exprToDisplay = ""; //Work on the file //create paths string dirToCreate = "data"; string dirToCreateFull = System.IO.Path.GetFullPath(dirToCreate); Directory.CreateDirectory(dirToCreateFull); dirToCreate = "video"; dirToCreateFull = System.IO.Path.GetFullPath(dirToCreate); Directory.CreateDirectory(dirToCreateFull); //create the csv file to write to file = new StreamWriter("data/" + currentDateTime + "data" + ".csv"); //initialise global expressions array - faster to add the keys here? var enumListMain = Enum.GetNames(typeof(PXCMFaceData.ExpressionsData.FaceExpression)); exprTable = new Hashtable(); string initLine = ""; //Add the column schema //Initial line: timestamp and high prec time initLine += "TIMESTAMP,HIGH_PRECISION_TIME_FROM_START,STIMCODE"; //add all the expression data columns for (int i = 0; i < enumListMain.Length; i++) { exprTable.Add(enumListMain[i], 0); initLine += "," + enumListMain[i]; } //add the bounding rectangle column initLine += "," + "BOUNDING_RECTANGLE_HEIGHT" + "," + "BOUNDING_RECTANGLE_WIDTH" + "," + "BOUNDING_RECTANGLE_X" + "," + "BOUNDING_RECTANGLE_Y"; //add the average depth column initLine += "," + "AVERAGE_DEPTH"; //add landmark points column for (int i = 0; i < LANDMARK_POINTS_TOTAL; i++) { initLine += "," + "LANDMARK_" + i + "_X"; initLine += "," + "LANDMARK_" + i + "_Y"; } //add euler angles columns initLine += "," + "EULER_ANGLE_PITCH" + "," + "EULER_ANGLE_ROLL" + "," + "EULER_ANGLE_YAW"; initLine += "," + "QUATERNION_W" + "," + "QUATERNION_X" + "," + "QUATERNION_Y" + "," + "QUATERNION_Z"; //write the initial row to the file file.WriteLine(initLine); //configure the camera mode selection box cbCameraMode.Items.Add("Color"); cbCameraMode.Items.Add("IR"); cbCameraMode.Items.Add("Depth"); //configure initial camera mode cameraMode = "Color"; //initialise global vars numFacesDetected = 0; handWaving = false; handTrigger = false; handResetTimer = 0; lEyeClosedIntensity = 0; lEyeClosed = false; lEyeClosedTrigger = false; lEyeClosedResetTimer = 0; rEyeClosed = false; rEyeClosedTrigger = false; rEyeClosedResetTimer = 0; rEyeClosedIntensity = 0; emotionEvidence = 0; blinkTrigger = false; blinkResetTimer = 0; //global fps vars prevTime = 0; stopwatch = new Stopwatch(); // Instantiate and initialize the SenseManager senseManager = PXCMSenseManager.CreateInstance(); if (senseManager == null) { MessageBox.Show("Cannot initialise sense manager: closing in 20s, report to Sriram"); Thread.Sleep(20000); Environment.Exit(1); } //capture samples senseManager.captureManager.SetFileName("video/" + currentDateTime + ".raw", true); //Enable color stream senseManager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, STREAM_WIDTH, STREAM_HEIGHT, STREAM_FPS); senseManager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH, STREAM_WIDTH, STREAM_HEIGHT, STREAM_FPS); senseManager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_IR, STREAM_WIDTH, STREAM_HEIGHT, STREAM_FPS); //Enable face and hand tracking AND EMOTION TRACKING senseManager.EnableHand(); senseManager.EnableFace(); senseManager.EnableEmotion(); //Initialise the senseManager - begin collecting data senseManager.Init(); // Configure the Hand Module hand = senseManager.QueryHand(); handConfig = hand.CreateActiveConfiguration(); handConfig.EnableGesture("wave"); handConfig.EnableAllAlerts(); handConfig.ApplyChanges(); //Configure the Face Module face = senseManager.QueryFace(); faceConfig = face.CreateActiveConfiguration(); faceConfig.EnableAllAlerts(); faceConfig.detection.isEnabled = true; //enables querydetection function to retrieve face loc data faceConfig.detection.maxTrackedFaces = 1; //MAXIMUM TRACKING - 1 FACE faceConfig.ApplyChanges(); //Configure the sub-face-module Expressions exprConfig = faceConfig.QueryExpressions(); exprConfig.Enable(); exprConfig.EnableAllExpressions(); faceConfig.ApplyChanges(); // Start the worker thread that processes the captured data in real-time processingThread = new Thread(new ThreadStart(ProcessingThread)); processingThread.Start(); }
internal void addNewClient(TcpClient clientSocket) { MyClient myclient = new MyClient(clientSocket, _currentForm); //myclient.setCurrentForm(_currentForm); _lClients.Add(myclient); _currentForm.addToReceiverText(">> Usser " + myclient.getId() + " kết nối!"); }
public void RemoveClient(MyClient client) { this._lClients.Remove(client); }
/// <summary> /// Сохраняем принятый бинарник /// </summary> /// <param name="myPacket">Объект, представляющий пакет с данными</param> /// <param name="clientNum">Номер клиента</param> public void SaveData(MyClient.MyPacketWrapper myPacket, int clientNum) { try { string path = baseDir + "Client" + clientNum; if (!Directory.Exists(path)) //создаем дирректорию Directory.CreateDirectory(path); string pathToFile = path + @"\" + myPacket.FileName; File.WriteAllBytes(pathToFile, myPacket.FileBuff); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
/// <summary> /// Отображает данные о пользователе в псевдоконсоль /// </summary> /// <param name="myPacket"></param> public void ShowData(MyClient.MyPacketWrapper myPacket) { this.Dispatcher.BeginInvoke (DispatcherPriority.Normal, (ThreadStart)delegate() { ConsoleTextBox.Text += "ФИО: " + myPacket.UserDetails.FullName + "\r\n"; ConsoleTextBox.Text += "Название учебного заведения: " + myPacket.UserDetails.University + "\r\n"; ConsoleTextBox.Text += "Номер телефона: " + myPacket.UserDetails.Phone + "\r\n"; } ); }
/// <summary> /// Init vars and subscribe the required listener to the leap controller /// </summary> /// public MainWindow() { InitializeComponent(); this.controller = new Controller(); this.listener = new LeapEventListener(this); controller.AddListener(listener); //init pipe stuff pipeClient = new MyClient(PIPE_NAME); pipeClient.SendMessage("I Am Leap Motion"); //init the frame list frameList = new List<Leap.Frame>(); //init the stimcode curStimCode = 0; btnStimCodeInject.Focus(); }
private void toolStripMenuUpdate_Click(object sender, EventArgs e) { string currentVersionUrlTxt = _YameConst.Updateurl + _YameConst.Updatefilename; using (var client = new MyClient()) { string updateversion = client.DownloadString(currentVersionUrlTxt); if (String.Empty != updateversion) { Version assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; string currentVersion = assemblyVersion.Major.ToString() + assemblyVersion.Minor.ToString() + assemblyVersion.Build.ToString(); string updateVersionFileUrl = _YameConst.Updateurl + _YameConst.Appname + "_" + updateversion + ".zip"; if (updateversion != currentVersion) { string message = "Update " + updateversion + " available !\r\n" + "\r\nVisit website for download ?"; DialogResult result = SMARTDIALOG.SmartDialog.Show(message, "V" + currentVersion, "Server found.", "Update found", "NO", "YES"); if(result == DialogResult.No) // Inverted button on frame ;) System.Diagnostics.Process.Start(_YameConst.Helpurl + "#download"); } else { SMARTDIALOG.SmartDialog.Show("Current version is up to date !", "V"+currentVersion, "Server found.", "No update found", "OK"); } } else { MessageBox.Show("Website unreachable!"); } } }