Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Sign in to PNM
            PeerCollaboration.SignIn(PeerScope.NearMe);

            // Get local peer name to display
            this.Title = string.Format("PNMSample - {0}", ContactManager.LocalContact.Nickname);
        }
Exemplo n.º 2
0
        private void btnSignIn_Click(object sender, RoutedEventArgs e)
        {
            // 登入至Internet之範圍
            PeerCollaboration.SignIn(PeerScope.NearMe);

            // 宣告當Peer端點登入或登出時所觸發之事件
            // 並定義所呼叫的方法為PeerNearMeChangedCallback
            PeerNearMe.PeerNearMeChanged += new EventHandler <PeerNearMeChangedEventArgs>(PeerNearMeChangedCallback);
        }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------------------
        // <Snippet1>
        //This function signs the users into the Collaboration Infrastructure.
        public static bool PeerCollabSignin()
        {
            bool result = false;

            try
            {
                PeerCollaboration.SignIn(PeerScope.All);
                result = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error signing in: {0}", ex.Message);
            }
            return(result);
        }
Exemplo n.º 4
0
        private void buttonStartOrUpdate_Click(object sender, EventArgs e)
        {
            if (PeerOpened)
            {
                AddLog("UpdateSend", LogType.System);
                SetSendData();
            }
            else
            {
                try
                {
                    PeerCollaboration.SignIn(PeerScope);
                }
                catch (PeerToPeerException ex)
                {
                    AddLog("SignIn:" + ex.Message, LogType.System);
                    return;
                }
                SetupPeer();
                UpdateUI();

                PeerNearMe.PeerNearMeChanged += PeerNearMe_PeerNearMeChanged;

                AddLog("StartPeer", LogType.System);
                SetSendData();

                //buttonLoad.PerformClick();

                PeerNearMeCollection peerNearMeCollection = PeerCollaboration.GetPeersNearMe();
                foreach (PeerNearMe peerNearMe in peerNearMeCollection)
                {
                    peerNearMe.RefreshDataCompleted += peerNearMe_RefreshDataCompleted;
                    peerNearMe.RefreshDataAsync("Setup");
                }
            }
        }
Exemplo n.º 5
0
 private void btnSignIn_Click(object sender, RoutedEventArgs e)
 {
     // 登入至Internet之範圍
     PeerCollaboration.SignIn(PeerScope.NearMe);
 }