示例#1
0
 private void sessionSubscriber(string data, ref int sz)
 {
     MessageBox.Show("SUBSCRIBED" + data);
     if (_session == null)
     _session = new AllJoynSession(_allJoyn);
     _session.NewParticipant(data);
 }
示例#2
0
        private void receiveOutput(string data, ref int sz, ref int informType)
        {
            string it = informType.ToString() + ":";

            if (informType == 1)
            {
                if (_allJoyn == null)
                {
                    _chatText.AppendLine(it + data);
                    return;
                }
                if (_session == null)
                {
                    _chatText.AppendLine("*** MISSING SESSION *** ");
                    _session = new AllJoynSession(_allJoyn);
                    //               sendIdentityMessage();
                }
                if (parseForIdentity(data))
                {
                    return;         // don't display
                }
                string chatter;
                chatter = lookupChatter(data, out chatter);
                _chatText.AppendLine(chatter + data);
                return;
            }
            _transcriptText.AppendLine(it + data);
        }
示例#3
0
 private void sessionSubscriber(string data, ref int sz)
 {
     MessageBox.Show("SUBSCRIBED" + data);
     if (_session == null)
     {
         _session = new AllJoynSession(_allJoyn);
     }
     _session.NewParticipant(data);
 }
示例#4
0
 private void btnAllJoyn_Click(object sender, EventArgs e)
 {
     if (!_callbacksInstalled) {
     setCallbacks();
     }
     _connectForm.ShowDialog(this);
     txtTranscript.Text = _trancriptText.ToString();
     if (_connectForm.IsConnected) {
     _allJoyn = _connectForm.AJBus;
     _session = _connectForm.AJSession;
     }
 }
示例#5
0
        private void sessionSubscriber(string data, ref int sz)
        {
            // MessageBox.Show("SUBSCRIBED" + data);
            _chatText.AppendLine("*** SUBSCRIBE **** ");

            if (_session == null)
            {
                _session = new AllJoynSession(_allJoyn);
            }
            _session.NewParticipant(data);
            sendIdentityMessage();
        }
示例#6
0
        private void btnAllJoyn_Click(object sender, EventArgs e)
        {
            if (!_callbacksInstalled)
            {
                setCallbacks();
            }
            _connectForm.ShowDialog(this);

            if (_connectForm.IsConnected)
            {
                _allJoyn   = _connectForm.AJBus;
                _session   = _connectForm.AJSession;
                _identity  = _connectForm.MyHandle;
                _connected = true;
                if (!_connectForm.IsNameOwner)
                {
                    sendIdentityMessage();
                }
            }
        }
示例#7
0
 private void sessionSubscriber(string data, ref int sz)
 {
     if (_session == null)
     _session = new AllJoynSession(_allJoyn);
     _session.NewParticipant(data);
     Thread.Sleep(1000);
     sendIdentityMessage();
 }
示例#8
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;
            }
        }
示例#9
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;
        }
示例#10
0
        private void sessionSubscriber(string data, ref int sz)
        {
            // MessageBox.Show("SUBSCRIBED" + data);
            _chatText.AppendLine("*** SUBSCRIBE **** ");

            if (_session == null)
            _session = new AllJoynSession(_allJoyn);
            _session.NewParticipant(data);
            sendIdentityMessage();
        }
示例#11
0
 private void receiveOutput(string data, ref int sz, ref int informType)
 {
     string it = informType.ToString() + ":";
     if (informType == 1) {
     if (_allJoyn == null) {
         _chatText.AppendLine(it + data);
         return;
     }
     if (_session == null) {
         _chatText.AppendLine("*** MISSING SESSION *** ");
         _session = new AllJoynSession(_allJoyn);
         //               sendIdentityMessage();
     }
     if (parseForIdentity(data))
         return;             // don't display
     string chatter;
     chatter = lookupChatter(data, out chatter);
     _chatText.AppendLine(chatter + data);
     return;
     }
     _transcriptText.AppendLine(it + data);
 }
示例#12
0
        private void btnAllJoyn_Click(object sender, EventArgs e)
        {
            if (!_callbacksInstalled) {
            setCallbacks();
            }
            _connectForm.ShowDialog(this);

            if (_connectForm.IsConnected) {
            _allJoyn = _connectForm.AJBus;
            _session = _connectForm.AJSession;
            _identity = _connectForm.MyHandle;
            _connected = true;
            if (!_connectForm.IsNameOwner)
                sendIdentityMessage();
            }
        }