Ejemplo n.º 1
0
 protected virtual void OnSessionRequest(EventArguments.SessionRequestEventArguments args)
 {
     if (SessionRequest != null)
     {
         SessionRequest(this, args);
     }
 }
Ejemplo n.º 2
0
        private void SessionRequestHandler(SessionRequest request)
        {
            SessionResponse response = new SessionResponse(request);

            EventArguments.SessionRequestEventArguments args = new EventArguments.SessionRequestEventArguments(() =>
            {
                //Confirm Session
                response.IsConfirmed = true;
                response.ClientName  = request.ClientName;
                response.PublicKey   = PublicKey;
                if (clientPublicKey.ContainsKey(request.ClientName))
                {
                    clientPublicKey[request.ClientName] = request.PublicKey;
                }
                else
                {
                    clientPublicKey.Add(request.ClientName, request.PublicKey);
                }
                SendMessage(response);
            },
                                                                                                               () =>
            {
                //Refuse Session
                response.IsConfirmed = false;
                response.ClientName  = request.ClientName;
                SendMessage(response);
            });

            args.Request = request;
            OnSessionRequest(args);
        }