Beispiel #1
0
        private async Task <string> getAppToken()
        {
            PropertySet parameters = new PropertySet();
            string      result     = null;

            parameters.Add("request_host", FBSDKTokenServiceHost);
            parameters.Add("access_token", "");
            parameters.Add("id", TestAppId);

            FBSingleValue sval = new FBSingleValue(FBSDKTokenApiPath,
                                                   parameters,
                                                   new FBJsonClassFactory((JsonText) =>
            {
                JsonObject obj = null;
                if (!JsonObject.TryParse(JsonText, out obj))
                {
                    obj = null;
                }

                return(obj);
            }));

            FBResult fbresult = await sval.Get();

            if (fbresult.Succeeded)
            {
                JsonObject obj = (JsonObject)fbresult.Object;
                if (obj.Keys.Contains("access_token"))
                {
                    result = obj.GetNamedString("access_token");
                }
            }

            return(result);
        }
Beispiel #2
0
 public async void GetPageWithId(
     string ID
     )
 {
     FBSingleValue val = new FBSingleValue("/" + ID, null,
         new FBJsonClassFactory((JsonText) => 
             MyFBPage.FromJson(JsonText)));
     FBResult result = await val.Get();
     if (result.Succeeded)
     {
         MyFBPage page = (MyFBPage)result.Object;
         //Do something with page here
     }
     else
     {
         HandleError(result.ErrorInfo);
     }
 }
Beispiel #3
0
        public async void GetPageWithId(
            string ID
            )
        {
            FBSingleValue val = new FBSingleValue("/" + ID, null,
                                                  new FBJsonClassFactory((JsonText) =>
                                                                         MyFBPage.FromJson(JsonText)));
            FBResult result = await val.Get();

            if (result.Succeeded)
            {
                MyFBPage page = (MyFBPage)result.Object;
                //Do something with page here
            }
            else
            {
                HandleError(result.ErrorInfo);
            }
        }
Beispiel #4
0
        private async Task<string> getAppToken()
        {
            PropertySet parameters = new PropertySet();
            string result = null;
 
            parameters.Add("request_host", FBSDKTokenServiceHost);
            parameters.Add("access_token", "");
            parameters.Add("id", TestAppId);
            
            FBSingleValue sval = new FBSingleValue(FBSDKTokenApiPath,
                parameters, 
                new FBJsonClassFactory((JsonText) => 
            {
                JsonObject obj = null;
                if (!JsonObject.TryParse(JsonText, out obj))
                {
                    obj = null;
                }

                return obj;
            }));

            FBResult fbresult = await sval.Get();

            if (fbresult.Succeeded)
            {
                JsonObject obj = (JsonObject)fbresult.Object;
                if (obj.Keys.Contains("access_token"))
                { 
                    result = obj.GetNamedString("access_token"); 
                }
            }

            return result;
        }
 private async void OnGetInfoClicked(object sender, RoutedEventArgs e)
 {
     string endpoint = "/me";
     FBSingleValue value = new FBSingleValue(endpoint, null, Entities.Profile.FromJson);
     FBResult result = await value.Get();
     if (result.Succeeded)
     {
         Profile profile = result.Object as Profile;
         string name = profile?.Name;
         MessageDialog dialog = new MessageDialog(name);
         await dialog.ShowAsync();
     }
 }