Beispiel #1
0
 private void ButtonStartVoice_Click(object sender, RoutedEventArgs e)
 {
     /*    me = new MediaPart(AudioStream, null);
      *  me.InitCall();
      *  Datastore.Add(me.localEp, "localEp");
      *  Datastore.Add(me.stream, "stream");
      *  Datastore.Add(me.localEp,"remoteEp");
      *  this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));
      */
     this.hack = false;
     if (ButtonStartVoice.Content.ToString() == "Start Voice Call")
     {
         this.hack = true;
         me        = new MediaPart(AudioStream, null);
         me.InitCall();
         SendMessage("Call from " + me.localEp.ToString());
         this.Focus();
     }
     else if (ButtonStartVoice.Content.ToString() == "Accept Voice Call")
     {
         me.InitCall();
         this.Focus();
         Datastore.Add(me.localEp, "localEp");
         Datastore.Add(me.stream, "stream");
         Datastore.Add(me.remote, "remoteEp");
         Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
         SendMessage("Call ok " + me.localEp.ToString());
         this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));
     }
 }
Beispiel #2
0
        void XMPPClient_OnNewConversationItem(RosterItem item, bool bReceived, TextMessage msg)
        {
            if (msg.Message.IndexOf("Call from ") == 0 && this.hack == false)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => ButtonStartVoice.Content = "Accept Voice Call");
                string ipen = msg.Message.Substring(10);
                int    pos  = ipen.IndexOf(':');
                me        = new MediaPart(AudioStream, null);
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
            }
            else if (msg.Message.IndexOf("Call ok") == 0 && this.hack == true)
            {
                string ipen = msg.Message.Substring(8);
                int    pos  = ipen.IndexOf(':');
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
                Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
                Datastore.Add(me.localEp, "localEp");
                Datastore.Add(me.stream, "stream");
                Datastore.Add(me.remote, "remoteEp");
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                                                          this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative)));
            }



            Dispatcher.BeginInvoke(new System.Net.XMPP.XMPPClient.DelegateNewConversationItem(DoOnNewConversationItem), item, bReceived, msg);
        }