private void Video_but_Click(object sender, EventArgs e) { try { if (Video_but.Text == "Cancal") { this.SendingFactories = new List <ChannelFactory <IVeryBasicCommunicationService> >(); this.SendingFactories.Add(new ChannelFactory <IVeryBasicCommunicationService>(new BasicHttpBinding(), new EndpointAddress(string.Format("{0}/Chat", vclient_ipaddress)))); IVeryBasicCommunicationService httpProxy = SendingFactories[0].CreateChannel(); httpProxy.Transmit("#decline#*"); ringing.Stop(); Video_but.Text = "Video Chat"; this.AdjustUi(); } else { int index = 0; index = lbConnectedClients.SelectedIndex; if (index == -1) { MessageBox.Show("Select a user to start up the video chat"); return; } vclient_name = ConnectedUsers[index]; string[] splitmessage = Connectedports[index].Split('/'); vclient_ipaddress = splitmessage[2]; if (vclient_name == username) { vclient_ipaddress = ""; vclient_name = ""; } else { this.SendingFactories = new List <ChannelFactory <IVeryBasicCommunicationService> >(); this.SendingFactories.Add(new ChannelFactory <IVeryBasicCommunicationService>(new BasicHttpBinding(), new EndpointAddress(string.Format("http://{0}/Chat", vclient_ipaddress)))); IVeryBasicCommunicationService httpProxy = SendingFactories[0].CreateChannel(); httpProxy.Transmit("#videochat#*" + username + "*" + myListeningUrl + "*" + videoport + "*" + auport); ringing.PlayLooping(); Video_but.Text = "Cancal"; videoflag = false; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void decline_button_Click(object sender, EventArgs e) { this.SendingFactories = new List <ChannelFactory <IVeryBasicCommunicationService> >(); this.SendingFactories.Add(new ChannelFactory <IVeryBasicCommunicationService>(new BasicHttpBinding(), new EndpointAddress(string.Format("http://{0}/Chat", vclient_ipaddress)))); IVeryBasicCommunicationService httpProxy = SendingFactories[0].CreateChannel(); httpProxy.Transmit("#decline#*"); vclient_ipaddress = ""; vclient_name = ""; client_videoport = ""; client_auport = ""; videoflag = false; ringing.Stop(); this.AdjustUi(); }
private void accept_button_Click(object sender, EventArgs e) { auport = (int.Parse(client_auport) % 999 + 555).ToString(); videoport = (int.Parse(client_videoport) % 999 + 555).ToString(); this.txtIpAddress.Text = videoport; this.audio_port.Text = auport; this.SendingFactories = new List <ChannelFactory <IVeryBasicCommunicationService> >(); this.SendingFactories.Add(new ChannelFactory <IVeryBasicCommunicationService>(new BasicHttpBinding(), new EndpointAddress(string.Format("http://{0}/Chat", vclient_ipaddress)))); IVeryBasicCommunicationService httpProxy = SendingFactories[0].CreateChannel(); httpProxy.Transmit("#acceptance#*" + videoport + "*" + auport); videoflag = false; ringing.Stop(); this.AdjustUi(); camname = (string)cbCameras.SelectedItem; audioinputname = cmbInputs.SelectedIndex.ToString(); //video_chat_room(string myListening, string videop, string aup, string vclient_n, string vclient_ipadd, string client_videop, string client_aup, string camn, string audioinputn, string audiooutputn) videoroom = new video_chat_room(myListeningUrl, videoport, auport, vclient_name, vclient_ipaddress, client_videoport, client_auport, camname, audioinputname, ""); videoroom.Show(); }
private void Send() { string userName = this.username; // send to all connected clients, except to myself.. string message = string.Format("({0}): {1}", userName, this.txtMessage.Text); foreach (ChannelFactory <IVeryBasicCommunicationService> factory in this.SendingFactories) { try { IVeryBasicCommunicationService httpProxy = factory.CreateChannel(); httpProxy.Transmit(message); } catch (EndpointNotFoundException) { this.PostMessage(string.Format("FAILED TO SEND TO {0} => nobody listening.", factory.Endpoint.Address)); } } }
private void acceptance() { if (this.InvokeRequired) { this.Invoke(new Action(acceptance), new object[] { }); } else { try { this.SendingFactories = new List <ChannelFactory <IVeryBasicCommunicationService> >(); this.SendingFactories.Add(new ChannelFactory <IVeryBasicCommunicationService>(new BasicHttpBinding(), new EndpointAddress(string.Format("http://{0}/Chat", vclient_ipaddress)))); IVeryBasicCommunicationService httpProxy = SendingFactories[0].CreateChannel(); httpProxy.Transmit("#acceptance#*" + videoport + "*" + auport); } catch (Exception e) { Console.WriteLine(e.ToString()); } } }