本文整理汇总了C#中Parse.ParseUser.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# ParseUser.ContainsKey方法的具体用法?C# ParseUser.ContainsKey怎么用?C# ParseUser.ContainsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveLocationToParseUser
/// <summary>
/// Save a new location data to the parse user.
/// This method does not save the data to the server.
/// Need to call SaveAsync on the user afterwards.
/// </summary>
/// <param name="user">the user whose location is to be saved</param>
/// <param name="newData">the new location data</param>
public static void SaveLocationToParseUser(ParseUser user, GeoPosition<GeoCoordinate> newData)
{
int lastLocationIndex = user.Get<int>(ParseContract.UserTable.LAST_LOCATION_INDEX);
int newLocationIndex = lastLocationIndex + 1;
newLocationIndex %= user.Get<int>(ParseContract.UserTable.LOCATION_DATA_SIZE);
user[ParseContract.UserTable.LAST_LOCATION_INDEX] = newLocationIndex;
if (!user.ContainsKey(ParseContract.UserTable.LOCATION(newLocationIndex)))//If the new slot was not filled.
{
user[ParseContract.UserTable.LOCATION(newLocationIndex)] = ParseContract.LocationTable.GeoPositionToParseObject(newData);
}
else//If the new slot contains a valid location
{
ParseObject newLocation = user.Get<ParseObject>(ParseContract.UserTable.LOCATION(newLocationIndex));
//Change the location entry without creating a new one.
ParseContract.LocationTable.GeoPositionSetParseObject(newData, newLocation);
}
user[ParseContract.UserTable.LAST_GEO_POINT] = new ParseGeoPoint(newData.Location.Latitude, newData.Location.Longitude);
}
示例2: ReadParseUser
public static bool ReadParseUser(ParseUser user)
{
if (user.ContainsKey("Created"))
{
if (user.ContainsKey("MaxScore"))
{
var maxscore = (long)user["MaxScore"];
_maxScore = (int)maxscore;
}
return true;
}
else
{
return false;
}
}