Ejemplo n.º 1
0
        private void RcConsumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
        {
            ReceiverLostHandler handler = LostEvent;

            if (handler != null)
            {
                ReceiverLostReason reason = ReceiverLostReason.Unknown;
                switch (args.Reason)
                {
                case AllJoynSessionLostReason.LinkTimeout:
                    reason = ReceiverLostReason.Timeout;
                    break;

                case AllJoynSessionLostReason.RemovedByProducer:
                    reason = ReceiverLostReason.Removed;
                    break;

                case AllJoynSessionLostReason.ProducerLeftSession:
                    reason = ReceiverLostReason.Shutdown;
                    break;

                default:
                    reason = ReceiverLostReason.Unknown;
                    break;
                }
                var ignore = CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    handler(this, reason);
                });
            }
        }
Ejemplo n.º 2
0
 private void sessionSubscriber(string data, ref int sz)
 {
     if (_session == null)
     {
         _session = new AllJoynSession(_allJoyn);
     }
     _session.NewParticipant(data);
     Thread.Sleep(1000);
     sendIdentityMessage();
 }
Ejemplo n.º 3
0
        private void receiveOutput(string data, ref int sz, ref int informType)
        {
            string   handle = null;
            string   msg    = null;
            TextType type   = TextType.Error;

            if (_session == null)
            {
                if (_allJoyn == null)
                {
                    _allJoyn = _connectForm.AJBus;
                }
                _session = new AllJoynSession(_allJoyn);
                if (!_connectForm.IsNameOwner)
                {
                    sendIdentityMessage();
                }
            }
            switch (informType)
            {
            case 0:
                type = TextType.Error;
                _buffer.AddDeferred(data, "Error", type);
                _transcriptText.AppendLine(data);
                break;

            case 1:
                type = TextType.Remote;
                if (parseForIdentity(data))
                {
                    return;
                }
                msg  = lookupChatter(data, out handle);
                data = msg;
                _buffer.AddDeferred(data, handle, type);
                _deferredStatus = "last message received " + dateTimeString();
                break;

            case 2:
                type = TextType.Status;
                _transcriptText.AppendLine(data);
                break;

            case 3:
                type = TextType.System;
                _transcriptText.AppendLine(data);
                break;

            default:
                type = TextType.Error;
                _buffer.AddDeferred(data, "Error", type);
                _transcriptText.AppendLine(data);
                break;
            }
        }
Ejemplo n.º 4
0
        private void Consumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
        {
            if (discoveredReceivers.ContainsKey(sender.Id))
            {
                var lostReceiver = discoveredReceivers[sender.Id];
                discoveredReceivers.Remove(sender.Id);

                if (discovered != null)
                {
                    RCReceiverLost handler = lost;
                    var            ignore  = CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        handler(this, lostReceiver);
                    });
                }
            }
        }
Ejemplo n.º 5
0
        private bool parseForIdentity(string data)
        {
            if (data.Contains(token))
            {
                int i = data.IndexOf(token);
                if (i > 2)
                {
                    string tmp = data.Replace(token, "<");
                    string key = data.Substring(0, i - 2);
                    tmp = tmp.Replace(key, " ");
                    tmp = tmp.Substring(1, tmp.Length - 1);
                    int start = tmp.IndexOf("<");
                    int stop  = tmp.IndexOf(">");
                    tmp = tmp.Remove(stop);
                    start++;
                    tmp = tmp.Substring(start, tmp.Length - start);
                    if (_session == null)
                    {
                        _session = new AllJoynSession(_allJoyn);
                    }
                    if (!_session.HasKey(key))
                    {
                        _session.NewParticipant(key, tmp);
                        _transcriptText.AppendLine("*** ADD " + key + " **** ");
                        sendIdentityMessage();
                    }
                    else
                    {
                        _session.AddIdentity(key, tmp);
                    }

                    _buffer.AddDeferred("IDENTIFIED " + tmp + " AS " + key, tmp, TextType.Error);
                    return(true);
                }
            }
            return(false);
        }
 private void Consumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
 {
     UpdateStatusAsync(string.Format("AllJoyn session with the onboardee lost due to {0}.", args.Reason.ToString()), NotifyType.StatusMessage);
     DisposeConsumer();
     ResetControls();
 }
 private void Consumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
 {
     UpdateStatusAsync(string.Format("AllJoyn session with the producer lost due to {0}.", args.Reason.ToString()), NotifyType.StatusMessage);
     ConsumerOptionsVisibility = Visibility.Collapsed;
     DisposeConsumer();
 }
Ejemplo n.º 8
0
 private void Consumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
 {
     UpdateStatusAsync(string.Format("AllJoyn session with the producer lost due to {0}.", args.Reason.ToString()), NotifyType.StatusMessage);
     ConsumerOptionsVisibility = Visibility.Collapsed;
     DisposeConsumer();
 }
 private void Consumer_SessionLost(AllJoynSession sender, AllJoynSessionLostEventArgs args)
 {
     UpdateStatusAsync(string.Format("AllJoyn session with the onboardee lost due to {0}.", args.Reason.ToString()), NotifyType.StatusMessage);
     DisposeConsumer();
     ResetControls();
 }