public void skype_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status) { if (Status == TChatMessageStatus.cmsReceived) { if (!skypeUserTabs.Contains(new SkypeUserTab(pMessage.Sender.Handle))) { user_combobox.Items.Add(pMessage.Sender.Handle); var newTabUser = new SkypeUserTab(pMessage.Sender.Handle); skypeUserTabs.Add(newTabUser); tabUsers.Controls.Add(newTabUser.tabPage); pMessage.Chat.SendMessage(Properties.Settings.Default.welcomeMessage); //pMessage.Chat.SendMessage("Hello! \n \n Please wait until we give you the control of the robot."); //pMessage.Chat.SendMessage(welcome_textBox.Text); if (skypeAdminSelected) skype.SendMessage(skypeAdmin, string.Format("New user connected: {0}", pMessage.Sender.Handle)); } if (pMessage.Body.Length == 1) { if (pMessage.Sender.Handle == skypeAdmin) { /*if (pMessage.Body == "u") { string response = "Connected Users: \n"; foreach( var userTab in skypeUserTabs) { response += userTab.skypeChatUser; skype.SendMessage(skypeAdmin, ); } }*/ } SkypeUserTab selected = skypeUserTabs.First(delegate(SkypeUserTab value) { return value.skypeChatUser == pMessage.Sender.Handle; }); selected.textBox.Text += string.Format("{0} \r\n", pMessage.Body); if (selected.skypeChatUser == selectedSkypeChatUser) { if (serialPort.IsOpen) { if (pMessage.Body.Contains('3')) controlState = 3; else if (pMessage.Body.Contains('2')) controlState = 2; else if (pMessage.Body.Contains('1')) controlState = 1; serialPort.Write(pMessage.Body.ToCharArray(), 0, 1); msg_listbox.Paste(string.Format("S: {0} \r\n", pMessage.Body)); } else { msg_listbox.Text += string.Format("Failed to Send: {0} \r\n", pMessage.Body); pMessage.Chat.SendMessage(Properties.Settings.Default.failedToSendMessage); } } else { pMessage.Chat.SendMessage(Properties.Settings.Default.waitMessage); } } } }
public void OurCallStatus(Call call, TCallStatus status) { try { if (status == TCallStatus.clsInProgress /*call.VideoSendStatus == TCallVideoSendStatus.vssAvailable*/) { call.StartVideoSend(); } } catch { } // Always use try/catch with ANY Skype calls. try { if (status == TCallStatus.clsRinging) { if (numCalls == 0) { call.Answer(); callID = call.Id; numCalls++; } else if (numCalls == 1 && callID != call.Id) { try { this.BeginInvoke((Action)(() => { call.Finish(); })); } catch (InvalidCastException e) { } } } // If this call is from a SkypeIn/Online number, show which one. else if (call.Type == TCallType.cltIncomingP2P && status == TCallStatus.clsInProgress && call.Id == callID) { selectedSkypeChatUser = call.PartnerHandle.ToString(); this.BeginInvoke((Action)(() => { skype.SendMessage(selectedSkypeChatUser, Properties.Settings.Default.controllerMessage); })); chatUserSelected = true; user_combobox.ResetText(); user_combobox.SelectedText = call.PartnerHandle.ToString(); if (!skypeUserTabs.Contains(new SkypeUserTab(call.PartnerHandle))) { user_combobox.Items.Add(call.PartnerHandle); var newTabUser = new SkypeUserTab(call.PartnerHandle); skypeUserTabs.Add(newTabUser); tabUsers.Controls.Add(newTabUser.tabPage); } } else if (status == TCallStatus.clsFinished && call.Id == callID) { numCalls--; callID = 0; } } catch (Exception e) { } }