Пример #1
0
 private void OnConnectionRequested(Object s, SocketConnectionRequestedEventArgs e)
 {
     if (e.SocketFd == socketFd)
     {
         ConnectionRequested?.Invoke(this, e);
     }
 }
Пример #2
0
 /// <summary>
 /// The constructor
 /// </summary>
 /// <since_tizen> 4 </since_tizen>
 public BluetoothOppServer()
 {
     _impl = BluetoothOppServerImpl.Instance;
     _impl.ConnectionRequested += (s, e) => ConnectionRequested?.Invoke(this, e);
     _impl.TransferProgress    += (s, e) => TransferProgress?.Invoke(this, e);
     _impl.TransferFinished    += (s, e) => TransferFinished?.Invoke(this, e);
 }
Пример #3
0
        public ConnectWindow()
        {
            InitializeComponent();

            IpInputBox.TextChanged += (sender, args) =>
                                      IpTextUpdated?.Invoke(this, new TextUpdatedEventArgs(IpInputBox.Text));

            PortInputBox.TextChanged += (sender, args) =>
                                        PortTextUpdated?.Invoke(this, new TextUpdatedEventArgs(PortInputBox.Text));

            DoneButton.Click += (sender, args) =>
                                ConnectionRequested?.Invoke(this,
                                                            new ConnectionRequestedEventArgs(IpInputBox.Text, int.Parse(PortInputBox.Text)));

            CancelButton.Click += (sender, args) => Close();
        }
Пример #4
0
        internal int StartServer(string filePath)
        {
            _ConnectionRequestedCallback = (string devAddress, IntPtr userData) =>
            {
                ConnectionRequested?.Invoke(this, new ConnectionRequestedEventArgs(devAddress));
            };

            int ret = Interop.Bluetooth.InitializeOppServerCustom(filePath, _ConnectionRequestedCallback, IntPtr.Zero);

            if (ret != (int)BluetoothError.None)
            {
                Log.Error(Globals.LogTag, "Failed to start bluetooth opp server, Error - " + (BluetoothError)ret);
                BluetoothErrorFactory.ThrowBluetoothException(ret);
            }
            else
            {
                Globals.IsOppServerInitialized = true;
            }
            return(ret);
        }
Пример #5
0
 private void MqttClient_ApplicationMessageReceived(object sender, MqttApplicationMessageReceivedEventArgs e)
 {
     if (e.ApplicationMessage.Topic == LoggedInAs)
     {
         var data    = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
         var message = JsonConvert.DeserializeObject <Message>(data);
         if (message.Command == "Text")
         {
             MessageReceived?.Invoke(this, new GenericEventArgs <string>(message.Parameters));
         }
         else if (message.Command == "ChatRequested")
         {
             var req = JsonConvert.DeserializeObject <ConnectionRequest>(message.Parameters);
             ConnectionRequested?.Invoke(this, new GenericEventArgs <ConnectionRequest>(req));
         }
         else
         {
             reply = message;
         }
     }
 }
 public void RequestConnect()
 => ConnectionRequested?.Invoke(this, new RequestConnectEventArgs(IpAddress));
Пример #7
0
 private unsafe static void OnConnectionRequest(P2PSessionRequest_t result)
 {
     ConnectionRequested?.Invoke(User.GetUser(result.m_steamIDRemote));
 }