Beispiel #1
0
        private void connectionDialog()
        {
            DialogResult res = _setupUI.ShowDialog();

            if (res == DialogResult.OK)
            {
                if (_connected)
                {
                    _alljoyn.DisconnectAlljoyn();
                    _connected = false;
                    _buffer.Add("Disconnected...", null, TextType.Status);
                }
                else
                {
                    _alljoyn = _setupUI.Alljoyn;
                    if (_alljoyn == null)
                    {
                        MessageBox.Show("Unable to create AlljoynComponent");
                    }
                    else
                    {
                        if (setCallbacks())
                        {
                            _session = _setupUI.SessionName.Trim();
                            _tag     = _setupUI.MyHandle.Trim();
                            if (_session.Length < 1)
                            {
                                MessageBox.Show("ERROR: Session Name is missing or invalid");
                                _connected = false;
                            }
                            else
                            {
                                _connected = true;
                                if (_tag.Length < 1)
                                {
                                    _tag = "Unknown";
                                }
                                if (_setupUI.IsNameOwner)
                                {
                                    _alljoyn.StartChat(_session);
                                    _alljoyn.ConnectAlljoyn();
                                }
                                else
                                {
                                    _alljoyn.JoinChat(_session);
                                    _alljoyn.ConnectAlljoyn();
                                    Thread.Sleep(2000);
                                    sendIdentityMessage();
                                }
                            }
                        }
                    }
                }
            }
            updateButtons();
            _setupUI.Hide();
            txtMessage.Focus();
        }
 public AlljoynSetup(ChatDialog owner)
 {
     _owner = owner;
     InitializeComponent();
     this.Hide();
     _alljoyn      = new AlljoynChatComponant();
     InterfaceName = _alljoyn.InterfaceName;
     NamePrefix    = _alljoyn.NamePrefix;
     ObjectPath    = _alljoyn.ObjectPath;
 }
Beispiel #3
0
 private void connectionDialog()
 {
     DialogResult res = _setupUI.ShowDialog();
     if (res == DialogResult.OK) {
     if (_connected) {
         _alljoyn.DisconnectAlljoyn();
         _connected = false;
         _buffer.Add("Disconnected...", null, TextType.Status);
     } else {
         _alljoyn = _setupUI.Alljoyn;
         if (_alljoyn == null)
             MessageBox.Show("Unable to create AlljoynComponent");
         else {
             if (setCallbacks()) {
                 _session = _setupUI.SessionName.Trim();
                 _tag = _setupUI.MyHandle.Trim();
                 if (_session.Length < 1) {
                     MessageBox.Show("ERROR: Session Name is missing or invalid");
                     _connected = false;
                 } else {
                     _connected = true;
                     if (_tag.Length < 1)
                         _tag = "Unknown";
                     if (_setupUI.IsNameOwner) {
                         _alljoyn.StartChat(_session);
                         _alljoyn.ConnectAlljoyn();
                     } else {
                         _alljoyn.JoinChat(_session);
                         _alljoyn.ConnectAlljoyn();
                         Thread.Sleep(2000);
                         sendIdentityMessage();
                     }
                 }
             }
         }
     }
     }
     updateButtons();
     _setupUI.Hide();
     txtMessage.Focus();
 }
 public AlljoynSetup(ChatDialog owner)
 {
     _owner = owner;
     InitializeComponent();
     this.Hide();
     _alljoyn = new AlljoynChatComponant();
     InterfaceName = _alljoyn.InterfaceName;
     NamePrefix = _alljoyn.NamePrefix;
     ObjectPath = _alljoyn.ObjectPath;
 }