本文整理汇总了C#中Dictionary.toJson方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.toJson方法的具体用法?C# Dictionary.toJson怎么用?C# Dictionary.toJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary.toJson方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: performRequest
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the
// url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs
// for the given method. See Twitter's API docs for all available methods
public static void performRequest( string methodType, string path, Dictionary<string,string> parameters )
{
if( Application.platform != RuntimePlatform.Android )
return;
string param = parameters != null ? parameters.toJson() : string.Empty;
_plugin.Call( "performRequest", methodType, path, param );
}
示例2: adsSetUserCookies
// Sets user cookies for the ad session
public static void adsSetUserCookies( Dictionary<string,string> cookies )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_flurryAdsSetUserCookies( cookies.toJson() );
}
示例3: showFacebookShareDialog
// Shows the Facebook share dialog. Valid dictionary keys (from FBShareDialogParams) are: link, name, caption, description, picture, friends (array)
public static void showFacebookShareDialog( Dictionary<string,object> parameters )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_facebookShowFacebookShareDialog( parameters.toJson() );
}
示例4: graphRequest
// Allows you to use any available Facebook Graph API method
public static void graphRequest( string graphPath, string httpMethod, Dictionary<string,object> keyValueHash )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
{
// convert the Dictionary to JSON
string jsonDict = keyValueHash.toJson();
if( jsonDict != null )
{
// if we arent logged in start up the babysitter
if( !isSessionValid() )
{
babysitRequest( true, () => { _facebookGraphRequest( graphPath, httpMethod, jsonDict ); } );
}
else
{
_facebookGraphRequest( graphPath, httpMethod, jsonDict );
}
}
}
}
示例5: showDialog
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types
public static void showDialog( string dialogType, Dictionary<string,string> options )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
{
// if we arent logged in start up the babysitter
if( !isSessionValid() )
{
babysitRequest( false, () => { _facebookShowDialog( dialogType, options.toJson() ); } );
}
else
{
_facebookShowDialog( dialogType, options.toJson() );
}
}
}
示例6: performRequest
// Performs a request for any available Twitter API methods. methodType must be either "get" or "post". path is the
// url fragment from the API docs (excluding https://api.twitter.com) and parameters is a dictionary of key/value pairs
// for the given method. Path must request .json! See Twitter's API docs for all available methods.
public static void performRequest( string methodType, string path, Dictionary<string,string> parameters )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_twitterPerformRequest( methodType, path, parameters != null ? parameters.toJson() : null );
}
示例7: trackEventWithValueAndMetadata
// Tracks an event with a value and additional metadata
public static void trackEventWithValueAndMetadata( string eventIdentifier, float value, Dictionary<string,string> metadata )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_chartBoostTrackEventWithValueAndMetadata( eventIdentifier, value, metadata.toJson() );
}
示例8: showDialog
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types
public static void showDialog( string dialogType, Dictionary<string,string> parameters )
{
if( Application.platform != RuntimePlatform.Android )
return;
parameters = parameters ?? new Dictionary<string,string>();
if( !isSessionValid() )
babysitRequest( false, () => { _facebookPlugin.Call( "showDialog", dialogType, parameters.toJson() ); } );
else
_facebookPlugin.Call( "showDialog", dialogType, parameters.toJson() );
}
示例9: SendEventWithParam
// Reports an achievement notification the given title and content
public static void SendEventWithParam( string eventId, Dictionary<string,string> param)
{
// Call plugin only when running on real device
if( Application.platform == RuntimePlatform.IPhonePlayer )
_sendEventWithParam( eventId , param.toJson());
}
示例10: startWithAppIdAndUserData
// Starts up the SDK with the given appId and userData. See VGUserData for allowed values.
public static void startWithAppIdAndUserData( string appId, Dictionary<string,object> userData )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_vungleStartWithAppIdAndUserData( appId, userData.toJson() );
}
示例11: Add
/// <summary>
/// Add the specified val and metadata.
/// </summary>
/// <param name='val'>
/// Value.
/// </param>
/// <param name='metadata'>
/// Metadata.
/// </param>
public void Add(String val, Dictionary<String, String> metadata){
#if UNITY_ANDROID
javaObject.Call ("add", val, DictionaryToAndroidHashMap(metadata));
#elif UNITY_IOS
string metadataAsJSON = null != metadata ? metadata.toJson() : null;
if(null != addStringWithMetadataToList) {
addStringWithMetadataToList(key,val,metadataAsJSON);
}
#endif
}
示例12: Set
/// <summary>
/// Set the specified val and metadata.
/// </summary>
/// <param name='val'>
/// Value.
/// </param>
/// <param name='metadata'>
/// Metadata.
/// </param>
public void Set(string val, Dictionary<string, string> metadata)
{
#if UNITY_ANDROID
javaObject.Call ("set", val, DictionaryToAndroidHashMap(metadata));
#elif UNITY_IOS && !UNITY_EDITOR
string metadataAsJSON = (null != metadata) ? metadata.toJson() : null;
_AmazonGCWSSetLatestStringMetadataAsJSON(key, val, metadataAsJSON);
#endif
}
示例13: Set
/// <summary>
/// Set the specified val and metadata.
/// </summary>
/// <param name='val'>
/// Value.
/// </param>
/// <param name='metadata'>
/// Metadata.
/// </param>
public void Set(string val, Dictionary<string,string> metadata){
#if UNITY_ANDROID
javaObject.Call ("set", val, DictionaryToAndroidHashMap(metadata));
#elif UNITY_IOS
string metadataAsJSON = null != metadata ? metadata.toJson() : null;
if(null != setNumberWithStringAndMetadata) {
setNumberWithStringAndMetadata(key, val, metadataAsJSON);
}
#endif
}
示例14: graphRequest
// Calls a custom Graph API method with the key/value pairs in the Dictionary. Pass in a null dictionary if no parameters are needed.
public static void graphRequest( string graphPath, string httpMethod, Dictionary<string,string> parameters )
{
if( Application.platform != RuntimePlatform.Android )
return;
parameters = parameters ?? new Dictionary<string,string>();
// call off to java land
if( !isSessionValid() )
babysitRequest( true, () => { _facebookPlugin.Call( "graphRequest", graphPath, httpMethod, parameters.toJson() ); } );
else
_facebookPlugin.Call( "graphRequest", graphPath, httpMethod, parameters.toJson() );
}
示例15: showDialog
// Full access to any existing or new Facebook dialogs that get added. See Facebooks documentation for parameters and dialog types
public static void showDialog( string dialogType, Dictionary<string,string> options )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
_facebookShowDialog( dialogType, options.toJson() );
}