Exemplo n.º 1
0
        /* parses the JSON response from the server */
        public void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            WebClient WC = (WebClient)sender;

            if (WC.BaseAddress.Contains("id=") && WC.BaseAddress.Contains("name="))
            {
                try
                {
                    Debug.WriteLine("d:" + e.Result);
                    List <Friend> Friends = JsonConvert.DeserializeObject <List <Friend> >(e.Result);

                    MP.RespondToGetFriends(Friends);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("ERR on DownloadStringCompleted: " + ex.Message);
                }
            }
            else if (WC.BaseAddress.Contains("id=") && WC.BaseAddress.Contains("pushkey="))
            {
                // Do nothing
            }
            else if (WC.BaseAddress.Contains("pid="))
            {
                string pushkey = e.Result;
                if (IP != null)
                {
                    IP.SendToastToUser(pushkey);
                    IP = null;
                }
                else
                {
                    MP.SendQuickToastToUser(pushkey);
                    MP = null;
                }
            }
            else if (WC.BaseAddress.Contains("/event"))
            {
                long EventId = long.Parse(e.Result);
                DataUse.Instance.EventId = EventId;
                MP.CreateMeeting();
            }
            else if (WC.BaseAddress.Contains("apis.live.net"))
            {
                // do nothing
            }
            else if (WC.BaseAddress.Contains("/search"))
            {
                List <Friend> Friends = JsonConvert.DeserializeObject <List <Friend> >(e.Result);
                FA.RespondToSearchResults(Friends);
                FA = null;
            }
        }
Exemplo n.º 2
0
 public void GetPushKey(string id, InvitationPage IP)
 {
     this.IP = IP;
     send("http://lyncapi.appspot.com/user?pid=" + id);
 }