public P2PConnectionsManager(UserModel user, NSConnection nsConnection)
 {
     _user = user;
     _nsConnection = nsConnection;
     _nsConnection.ObjectReceivedEvent += NsConnectionOnObjectReceivedEvent;
     ConnectionClosedEvent += OnConnectionClosedEvent;
     _superPeerEndPoint = new IPEndPoint(IPAddress.Parse(SuperPeerConfig.Url), SuperPeerConfig.Port);
 }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            nametTitle.Text = $"{_user.Id}: {_user.FirstName} {_user.LastName}";

            _nsConnection = new NSConnection(_user);

            _p2PConnectionsManager = new P2PConnectionsManager(_user, _nsConnection);
            _p2PConnectionsManager.MessageReceivedEvent += MessageReceivedHandler;
            _p2PConnectionsManager.ConnectedToFriendEvent += P2PConnectionsManagerOnConnectedToFriendEvent;

            var progress = new Progress<IJob>(s => UpdateUI(s));
            Task.Factory.StartNew(() => _nsConnection.Process(progress),
                TaskCreationOptions.LongRunning);
        }