本文整理汇总了C#中Inscribe.Authentication.AccountInfo.RegisterBlocking方法的典型用法代码示例。如果您正苦于以下问题:C# AccountInfo.RegisterBlocking方法的具体用法?C# AccountInfo.RegisterBlocking怎么用?C# AccountInfo.RegisterBlocking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inscribe.Authentication.AccountInfo
的用法示例。
在下文中一共展示了AccountInfo.RegisterBlocking方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveInidividualInfo
/// <summary>
/// 指定アカウントの依存情報を受信します。
/// </summary>
public static void ReceiveInidividualInfo(AccountInfo info)
{
// アカウント情報の受信
SafeExec(() => UserStorage.Register(info.GetUserByScreenName(info.ScreenName)));
// フォロー/フォロワー/ブロックの受信
SafeExec(() => info.GetFriendIds(screenName: info.ScreenName).ForEach(i => info.RegisterFollowing(i)));
SafeExec(() => info.GetFollowerIds(screenName: info.ScreenName).ForEach(i => info.RegisterFollower(i)));
SafeExec(() => info.GetBlockingIds().ForEach(i => info.RegisterBlocking(i)));
}
示例2: RegisterStreamElement
/// <summary>
/// ストリームエレメントを処理します。
/// </summary>
/// <param name="info">ストリームエレメントを受信したアカウント</param>
/// <param name="elem">ストリームエレメント</param>
private static void RegisterStreamElement(AccountInfo info, StreamingEvent elem)
{
switch (elem.Kind)
{
case ElementKind.Status:
case ElementKind.DirectMessage:
// 通常ステータスを受信した
TweetStorage.Register(elem.Status);
break;
case ElementKind.Favorite:
var avm = TweetStorage.Register(elem.Status);
if (avm == null) return;
var uavm = UserStorage.Get(elem.SourceUser);
if (avm.RegisterFavored(uavm))
EventStorage.OnFavored(avm, uavm);
break;
case ElementKind.Unfavorite:
var rvm = TweetStorage.Register(elem.Status);
if (rvm == null) return;
var urvm = UserStorage.Get(elem.SourceUser);
if (rvm.RemoveFavored(urvm))
EventStorage.OnUnfavored(rvm, urvm);
break;
case ElementKind.Delete:
TweetStorage.Remove(elem.DeletedStatusId);
break;
/*
* TODO:Implements later?
case ElementKind.ListUpdated:
break;
case ElementKind.ListMemberAdded:
if (ListStorage.IsListMemberCached(elem.TargetList.User.ScreenName, elem.TargetList.Name))
{
var members = ListStorage.GetListMembers(elem.TargetList.User.ScreenName, elem.TargetList.Name);
}
break;
case ElementKind.ListMemberRemoved:
case ElementKind.ListSubscribed:
case ElementKind.ListUnsubscribed:
// TODO: do something
break;
*/
case ElementKind.Follow:
case ElementKind.Unfollow:
var affect = AccountStorage.Get(elem.SourceUser.ScreenName);
var effect = AccountStorage.Get(elem.TargetUser.ScreenName);
if (affect != null)
{
// Add/Remove followings
if (elem.Kind == ElementKind.Follow)
affect.RegisterFollowing(elem.TargetUser.NumericId);
else
affect.RemoveFollowing(elem.TargetUser.NumericId);
}
if (effect != null)
{
// Add/Remove followers
if (elem.Kind == ElementKind.Follow)
effect.RegisterFollower(elem.SourceUser.NumericId);
else
effect.RemoveFollower(elem.SourceUser.NumericId);
}
if (elem.Kind == ElementKind.Follow)
EventStorage.OnFollowed(UserStorage.Get(elem.SourceUser), UserStorage.Get(elem.TargetUser));
else
EventStorage.OnRemoved(UserStorage.Get(elem.SourceUser), UserStorage.Get(elem.TargetUser));
break;
case ElementKind.Blocked:
if (info == null) break;
info.RemoveFollowing(elem.TargetUser.NumericId);
info.RemoveFollower(elem.TargetUser.NumericId);
info.RegisterBlocking(elem.TargetUser.NumericId);
// TODO: notify events
break;
case ElementKind.Unblocked:
if (info == null) break;
info.RemoveBlocking(elem.TargetUser.NumericId);
// TODO: Notify events
break;
default:
System.Diagnostics.Debug.WriteLine("unknown:" + elem.ToString());
break;
}
}