private bool UploadNativeStrings(Dictionary <string, string> native_strings, bool isAsync, UploadNativeStringsCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.fbml.uploadNativeStrings" } }; Utilities.AddJSONAssociativeArray(parameterList, "native_strings", native_strings); if (isAsync) { SendRequestAsync <fbml_uploadNativeStrings_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state); return(true); } var response = SendRequest <fbml_uploadNativeStrings_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? true : response.TypedValue); }
/// <summary> /// Lets you insert text strings into the Facebook Translations database so they can be translated. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// var native_strings = new Dictionary<string, string> { { "text", "(Testing uploadNativeStrings) Do you want to add a friend?" }, { "description", "text string in a popup dialog" } }; /// api.Fbml.UploadNativeStringsAsync(native_strings, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="native_strings">A collection of strings to translate. Each element of the collection is an object, with 'text' storing the actual string, 'description' storing the description of the text.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>If successful, this method returns the number of strings uploaded.</returns> public void UploadNativeStringsAsync(Dictionary <string, string> native_strings, UploadNativeStringsCallback callback, Object state) { UploadNativeStrings(native_strings, true, callback, state); }
/// <summary> /// Lets you insert text strings in their native language into the Facebook Translations database so they can be translated. See Translating Platform Applications for more information about translating your applications. /// </summary> /// <param name="native_strings">A JSON-encoded array of strings to translate. Each element of the string array is an object, with text storing the actual string, description storing the description of the text.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>If successful, this method returns the number of strings uploaded. </returns> public void UploadNativeStringsAsync(List <native_string> native_strings, UploadNativeStringsCallback callback, Object state) { UploadNativeStrings(native_strings, true, callback, state); }
private long UploadNativeStrings(List <native_string> native_strings, bool isAsync, UploadNativeStringsCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.intl.uploadNativeStrings" } }; var translationList = new List <string>(); foreach (var item in native_strings) { var translation = new Dictionary <string, string> { { "text", item.text }, { "description", item.description } }; translationList.Add(JSONHelper.ConvertToJSONAssociativeArray(translation)); } Utilities.AddRequiredParameter(parameterList, "native_strings", JSONHelper.ConvertToJSONArray(translationList)); if (isAsync) { SendRequestAsync <intl_uploadNativeStrings_response, long>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <long>(callback), state); return(0); } var response = SendRequest <intl_uploadNativeStrings_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? -1 : response.TypedValue); }
private bool UploadNativeStrings(Dictionary<string, string> native_strings, bool isAsync, UploadNativeStringsCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.fbml.uploadNativeStrings" } }; Utilities.AddJSONAssociativeArray(parameterList, "native_strings", native_strings); if (isAsync) { SendRequestAsync<fbml_uploadNativeStrings_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<fbml_uploadNativeStrings_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Lets you insert text strings into the Facebook Translations database so they can be translated. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// var native_strings = new Dictionary<string, string> { { "text", "(Testing uploadNativeStrings) Do you want to add a friend?" }, { "description", "text string in a popup dialog" } }; /// api.Fbml.UploadNativeStringsAsync(native_strings, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="native_strings">A collection of strings to translate. Each element of the collection is an object, with 'text' storing the actual string, 'description' storing the description of the text.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>If successful, this method returns the number of strings uploaded.</returns> public void UploadNativeStringsAsync(Dictionary<string, string> native_strings, UploadNativeStringsCallback callback, Object state) { UploadNativeStrings(native_strings, true, callback, state); }