本文整理汇总了C#中IDictionary.GetIfAvailable方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.GetIfAvailable方法的具体用法?C# IDictionary.GetIfAvailable怎么用?C# IDictionary.GetIfAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDictionary
的用法示例。
在下文中一共展示了IDictionary.GetIfAvailable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AndroidBillingTransaction
public AndroidBillingTransaction(IDictionary _transactionInfo)
{
IDictionary _originalJSON = _transactionInfo[kOriginalJSON] as IDictionary;
// Set raw response
RawPurchaseData = _originalJSON.ToJSON();
// Assign values
ProductIdentifier = _originalJSON.GetIfAvailable<string>(kProductID);
// Transaction time
long _purchaseTimeInMillis = _originalJSON.GetIfAvailable<long>(kPurchaseTime);
System.DateTime _purchaseDate = _purchaseTimeInMillis.ToDateTimeFromJavaTime();
TransactionDateUTC = _purchaseDate.ToUniversalTime();
TransactionDateLocal = _purchaseDate.ToLocalTime();
TransactionIdentifier = GetPurchaseIdentifier(_originalJSON);
int _purchaseState = _originalJSON.GetIfAvailable<int>(kPurchaseState);
TransactionState = GetConvertedPurchaseState(_purchaseState);
// Data from _transactionInfo
TransactionReceipt = _transactionInfo.GetIfAvailable<string>(kSignature);
//First find out if the transaction is valid
string _validationState = _transactionInfo.GetIfAvailable<string>(kPurchaseValidationState);
VerificationState = GetValidationState(_validationState);
// Error
Error = _transactionInfo.GetIfAvailable<string>(kError);
}
示例2: iOSSpecificProperties
internal iOSSpecificProperties (IDictionary _jsonDict)
{
AlertAction = _jsonDict.GetIfAvailable<string>(kAlertActionKey);
HasAction = _jsonDict.GetIfAvailable<bool>(kHasActionKey);
BadgeCount = _jsonDict.GetIfAvailable<int>(kBadgeCountKey);
LaunchImage = _jsonDict.GetIfAvailable<string>(kLaunchImageKey);
}
示例3: RequestForImageFinished
protected override void RequestForImageFinished (IDictionary _dataDict)
{
string _error = _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
Texture2D _image = _dataDict.GetIfAvailable<Texture2D>(EditorGameCenter.kImageKey);
DownloadImageFinished(_image, _error);
}
示例4: AndroidAddressBookContact
public AndroidAddressBookContact (IDictionary _contactInfoJsontDict)
{
//If Given Name is available set it. Else pick from Display Name
string _displayName = _contactInfoJsontDict.GetIfAvailable<string>(kDisplayName);
string _givenName = _contactInfoJsontDict.GetIfAvailable<string>(kGivenName);
string _familyName = _contactInfoJsontDict.GetIfAvailable<string>(kFamilyName);
if(string.IsNullOrEmpty(_displayName))
{
_displayName = "";
}
FirstName = _givenName;
LastName = _familyName;
ImagePath = _contactInfoJsontDict[kImagePath] as string;
PhoneNumberList = new List<string>();
EmailIDList = new List<string>();
// Add phone numbers
IList _phoneNumJsonList = _contactInfoJsontDict[kPhoneNumList] as IList;
foreach (string _phoneNo in _phoneNumJsonList)
PhoneNumberList.Add(_phoneNo);
// Add email id's
IList _emailIDJsonList = _contactInfoJsontDict[kEmailList] as IList;
foreach (string _emailID in _emailIDJsonList)
EmailIDList.Add(_emailID);
}
示例5: iOSTwitterSession
public iOSTwitterSession (IDictionary _sessionJsonDict)
{
AuthToken = _sessionJsonDict.GetIfAvailable<string>(kAuthToken);
AuthTokenSecret = _sessionJsonDict.GetIfAvailable<string>(kAuthTokenSecret);
UserName = _sessionJsonDict.GetIfAvailable<string>(kUserName);
UserID = _sessionJsonDict.GetIfAvailable<string>(kUserID);
}
示例6: iOSBillingTransaction
public iOSBillingTransaction (IDictionary _transactionJsonDict)
{
ProductIdentifier = _transactionJsonDict.GetIfAvailable<string>(kProductID);
// Transaction date can be NULL/Empty
string _tDateStr = _transactionJsonDict.GetIfAvailable<string>(kTransactionDate);
if (!string.IsNullOrEmpty(_tDateStr))
{
TransactionDateUTC = _tDateStr.ToZuluFormatDateTimeUTC();
TransactionDateLocal = TransactionDateUTC.ToLocalTime();
}
// Transaction identifier
TransactionIdentifier = _transactionJsonDict.GetIfAvailable<string>(kTransactionID);
// Transaction receipt can be NULL/Empty
TransactionReceipt = _transactionJsonDict.GetIfAvailable<string>(kTransactionReceipt);
// Transactions state
SKPaymentTransactionState _skTransactionState = (SKPaymentTransactionState)int.Parse(_transactionJsonDict[kTransactionState].ToString());
TransactionState = ConvertToBillingTransactionState(_skTransactionState);
// Verifications state
VerificationState = (eBillingTransactionVerificationState)int.Parse(_transactionJsonDict[kVerificationState].ToString());
// Error can be NULL/Empty
Error = _transactionJsonDict.GetIfAvailable<string>(kError);
// Set response which is sent from Native side
RawPurchaseData = _transactionJsonDict.ToJSON();
}
示例7: AndroidBillingProduct
public AndroidBillingProduct (IDictionary _productJsonDict)
{
ProductIdentifier = _productJsonDict[kProductID] as string;
Name = _productJsonDict[kTitle] as string;
Description = _productJsonDict[kDescription] as string;
Price = _productJsonDict.GetIfAvailable<long>(kPriceAmount)/1000000.0f;//As the value is in microns
LocalizedPrice = _productJsonDict.GetIfAvailable<string>(kLocalizedPrice);
}
示例8: iOSBillingProduct
public iOSBillingProduct (IDictionary _productJsonDict)
{
Name = _productJsonDict.GetIfAvailable<string>(kTitle);
ProductIdentifier = _productJsonDict.GetIfAvailable<string>(kProductID);
Description = _productJsonDict.GetIfAvailable<string>(kDescription);
Price = _productJsonDict.GetIfAvailable<float>(kPrice);
LocalizedPrice = _productJsonDict.GetIfAvailable<string>(kLocalizedPrice);
}
示例9: AndroidTwitterUser
public AndroidTwitterUser (IDictionary _userJsonDict)
{
UserID = _userJsonDict[kUserID] as string;
Name = _userJsonDict[kName] as string;
IsVerified = _userJsonDict.GetIfAvailable<bool>(kIsVerified);
IsProtected = _userJsonDict.GetIfAvailable<bool>(kIsProtected);
ProfileImageURL = _userJsonDict[kProfileImageURL] as string;
}
示例10: iOSTwitterUser
public iOSTwitterUser (IDictionary _userJsonDict)
{
UserID = _userJsonDict.GetIfAvailable<string>(kUserID);
Name = _userJsonDict.GetIfAvailable<string>(kName);
IsVerified = _userJsonDict.GetIfAvailable<bool>(kIsVerified);
IsProtected = _userJsonDict.GetIfAvailable<bool>(kIsProtected);
ProfileImageURL = _userJsonDict.GetIfAvailable<string>(kProfileImageURL);
}
示例11: iOSNotificationPayload
public iOSNotificationPayload (IDictionary _payloadDict)
{
IDictionary _apsDict = _payloadDict[kAPS] as IDictionary;
string _userInfoKey = NPSettings.Notification.iOS.UserInfoKey;
iOSProperties = new iOSSpecificProperties();
// Read alert info
if (_apsDict.Contains(kAlert))
{
object _alertUnknownType = _apsDict[kAlert] as object;
if (_alertUnknownType != null)
{
// String format
if ((_alertUnknownType as string) != null)
{
AlertBody = _alertUnknownType as string;
}
// Dictionary format
else
{
IDictionary _alertDict = _alertUnknownType as IDictionary;
AlertBody = _alertDict.GetIfAvailable<string>(kBody);
string _alertAction = _alertDict.GetIfAvailable<string>(kAction);
if (string.IsNullOrEmpty(_alertAction))
{
iOSProperties.AlertAction = null;
iOSProperties.HasAction = false;
}
else
{
iOSProperties.AlertAction = _alertAction;
iOSProperties.HasAction = true;
}
// Launch image
iOSProperties.LaunchImage = _alertDict.GetIfAvailable<string>(kLaunchImage);
}
}
}
// Read sound, badge info
iOSProperties.SoundName = _apsDict.GetIfAvailable<string>(kSound);
iOSProperties.BadgeCount = _apsDict.GetIfAvailable<int>(kBadge);
// Read user info
if (_apsDict.Contains(_userInfoKey))
UserInfo = _payloadDict[_userInfoKey] as IDictionary;
// Read fire date, repeat interval
string _fireDateStr = _payloadDict.GetIfAvailable<string>(kFireDate);
if (!string.IsNullOrEmpty(_fireDateStr))
FireDate = _fireDateStr.ToDateTimeLocalUsingZuluFormat();
RepeatInterval = ConvertToRepeatInterval(_payloadDict.GetIfAvailable<CalendarUnit>(kRepeatIntervalKey));
}
示例12: AndroidUser
internal AndroidUser (IDictionary _userProfileData)
{
if(_userProfileData != null)
{
m_identifier = _userProfileData.GetIfAvailable<string>(kIdentifier);
m_name = _userProfileData.GetIfAvailable<string>(kName);
m_imagePath = _userProfileData.GetIfAvailable<string>(kHighResImageURL);
}
}
示例13: LoadUsersFinished
protected override void LoadUsersFinished (IDictionary _dataDict)
{
EGCUser[] _gcUsers = _dataDict.GetIfAvailable<EGCUser[]>(EditorGameCenter.kUsersListKey);
string _error = _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
User[] _newUsers = EditorUser.ConvertUsersList(_gcUsers);
// Invoke handler
LoadUsersFinished(_newUsers, _error);
}
示例14: LoadAchievementsFinished
protected override void LoadAchievementsFinished (IDictionary _dataDict)
{
EGCAchievement[] _gcAchievements = _dataDict.GetIfAvailable<EGCAchievement[]>(EditorGameCenter.kAchievementsListKey);
string _error = _dataDict.GetIfAvailable<string>(EditorGameCenter.kErrorKey);
Achievement[] _newAchievements = EditorAchievement.ConvertAchievementsList(_gcAchievements);
// Invoke handler
LoadAchievementsFinished(_newAchievements, _error);
}
示例15: LoadAchievementsFinished
protected override void LoadAchievementsFinished (IDictionary _dataDict)
{
IList _achievementsJSONList = _dataDict.GetIfAvailable<IList>(kAchievementsListKey);
string _error = _dataDict.GetIfAvailable<string>(GameServicesIOS.kNativeMessageErrorKey);
Achievement[] _newAchievements = iOSAchievement.ConvertAchievementsList(_achievementsJSONList);
// Invoke handler
LoadAchievementsFinished(_newAchievements, _error);
}