Inheritance: global::System.IDisposable
コード例 #1
0
        void Start()
        {
            if (this.PairingRole == Role.Connector)
            {
                this.pairMaker = new DirectPairConnector(this.RemoteAddress, this.RemotePort);
            }
            else
            {
                this.pairMaker = new DirectPairReceiver(this.LocalPort);
            }

            this.pairingAdapter = new PairingAdapter();
            this.pairingAdapter.SuccessEvent += OnPairingConnectionSucceeded;
            this.pairingAdapter.FailureEvent += OnPairingConnectionFailed;

            // Register to listen for disconnections, so we can reconnect automatically
            if (SharingStage.Instance != null)
            {
                this.sharingMgr = SharingStage.Instance.Manager;

                if (this.sharingMgr != null)
                {
                    this.connectionAdapter = new NetworkConnectionAdapter();
                    this.connectionAdapter.DisconnectedCallback += OnDisconnected;

                    NetworkConnection pairedConnection = this.sharingMgr.GetPairedConnection();
                    pairedConnection.AddListener((byte)MessageID.StatusOnly, this.connectionAdapter);
                }
            }

            StartPairing();
        }
コード例 #2
0
        void Start()
        {
            if (this.PairingRole == Role.Connector)
            {
                this.pairMaker = new DirectPairConnector(this.RemoteAddress, this.RemotePort);
            }
            else
            {
                this.pairMaker = new DirectPairReceiver(this.LocalPort);
            }

            this.pairingAdapter = new PairingAdapter();
            this.pairingAdapter.SuccessEvent += OnPairingConnectionSucceeded;
            this.pairingAdapter.FailureEvent += OnPairingConnectionFailed;

            // Register to listen for disconnections, so we can reconnect automatically
            if (SharingStage.Instance != null)
            {
                this.sharingMgr = SharingStage.Instance.Manager;

                if (this.sharingMgr != null)
                {
                    this.connectionAdapter = new NetworkConnectionAdapter();
                    this.connectionAdapter.DisconnectedCallback += OnDisconnected;

                    NetworkConnection pairedConnection = this.sharingMgr.GetPairedConnection();
                    pairedConnection.AddListener((byte)MessageID.StatusOnly, this.connectionAdapter);
                }
            }

            StartPairing();
        }