本文整理汇总了C#中Inscribe.ViewModels.PartBlocks.MainBlock.TimelineChild.TweetViewModel类的典型用法代码示例。如果您正苦于以下问题:C# TweetViewModel类的具体用法?C# TweetViewModel怎么用?C# TweetViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TweetViewModel类属于Inscribe.ViewModels.PartBlocks.MainBlock.TimelineChild命名空间,在下文中一共展示了TweetViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSuggestedUser
public static TwitterUser GetSuggestedUser(TweetViewModel status)
{
if (IsPublishedByRetweet(status))
return ((TwitterStatus)status.Status).RetweetedOriginal.User;
else
return status.Status.User;
}
示例2: TabDependentTweetViewModel
public TabDependentTweetViewModel(TweetViewModel tvm, TabViewModel parent)
{
if (tvm == null)
throw new ArgumentNullException("tvm");
if (parent == null)
throw new ArgumentNullException("parent");
this.Parent = parent;
this.Tweet = tvm;
switch (Setting.Instance.TimelineExperienceProperty.TimelineItemInitStrategy)
{
case ItemInitStrategy.None:
break;
case ItemInitStrategy.DefaultColors:
_lightningColorCache = Setting.Instance.ColoringProperty.BaseHighlightColor.GetColor();
_foreColorCache = Setting.Instance.ColoringProperty.BaseColor.GetDarkColor();
_backColorCache = Setting.Instance.ColoringProperty.BaseColor.GetLightColor();
_foreBrushCache = new SolidColorBrush(_foreColorCache).CloneFreeze();
_backBrushCache = new SolidColorBrush(_backColorCache).CloneFreeze();
break;
case ItemInitStrategy.Full:
CommitColorChanged(true);
break;
}
}
示例3: EventDescription
public EventDescription(EventKind kind, UserViewModel source, UserViewModel target, TweetViewModel tweet = null)
{
this.CreatedAt = DateTime.Now;
this.Kind = kind;
this.SourceUser = source;
this.TargetUser = target;
this.TargetTweet = tweet;
}
示例4: QueueNotify
public static void QueueNotify(TweetViewModel tweet, string soundSource = null)
{
if (soundSource == null)
soundSource = String.Empty;
lock (waitingsLocker)
{
if (waitings.ContainsKey(tweet))
waitings[tweet] = soundSource;
}
}
示例5: RegisterNotify
public static void RegisterNotify(TweetViewModel tweet)
{
if (!Setting.Instance.NotificationProperty.NotifyReceives ||
tweet.CreatedAt < DateTime.Now.Subtract(TimeSpan.FromMinutes(10)) ||
!CheckIsAllowed(tweet))
return;
lock (waitingsLocker)
{
if (!waitings.ContainsKey(tweet))
waitings.Add(tweet, null);
}
}
示例6: DispatchNotify
public static void DispatchNotify(TweetViewModel tweet)
{
lock (waitingsLocker)
{
if (waitings.ContainsKey(tweet))
{
var notify = waitings[tweet];
waitings.Remove(tweet);
if (notify != null)
IssueNotification(UserStorage.Get(tweet.Status.User), null, tweet.Status.Text, EventKind.Undefined, notify);
}
}
}
示例7: DispatchNotify
public static void DispatchNotify(TweetViewModel tweet)
{
lock (waitingsLocker)
{
if (waitings.ContainsKey(tweet))
{
var notify = waitings[tweet];
waitings.Remove(tweet);
if (notify != null)
{
UserViewModel source = UserStorage.Get(tweet.Status.User);
RaiseNotificationEvent(null, new EventDescriptionEventArgs(new EventDescription(EventKind.Undefined, source, null, tweet)));
IssueNotification(source, null, tweet.Status.Text, EventKind.Undefined, notify);
}
}
}
}
示例8: UnfavTweetSink
private static void UnfavTweetSink(IEnumerable<AccountInfo> infos, TweetViewModel status)
{
var ts = status.Status as TwitterStatus;
if (ts == null)
{
NotifyStorage.Notify("DirectMessageはFavできません。");
return;
}
if (ts.RetweetedOriginal != null)
status = TweetStorage.Get(ts.RetweetedOriginal.Id, true);
if (status == null)
{
NotifyStorage.Notify("Unfav 対象ステータスが見つかりません。");
return;
}
bool success = true;
Parallel.ForEach(infos,
(d) =>
{
var ud = d.UserViewModel;
// ふぁぼり状態更新
if (ud != null)
status.RemoveFavored(ud);
try
{
unfavoriteInjection.Execute(new Tuple<AccountInfo, TweetViewModel>(d, status));
}
catch (Exception ex)
{
success = false;
if (ud != null)
status.RegisterFavored(ud);
NotifyStorage.Notify("Unfavに失敗しました: @" + d.ScreenName);
if (!(ex is ApplicationException))
{
ExceptionStorage.Register(ex, ExceptionCategory.TwitterError,
"Unfav操作時にエラーが発生しました");
}
}
});
if (success)
NotifyStorage.Notify("Unfavしました: @" + status.Status.User.ScreenName + ": " + status.Status.Text);
}
示例9: UnretweetSink
private static void UnretweetSink(IEnumerable<AccountInfo> infos, TweetViewModel status)
{
var ts = status.Status as TwitterStatus;
if (ts == null)
{
NotifyStorage.Notify("DirectMessageはUnretweetできません。");
return;
}
if (ts.RetweetedOriginal != null)
status = TweetStorage.Get(ts.RetweetedOriginal.Id, true);
if (status == null)
{
NotifyStorage.Notify("Retweet オリジナルデータが見つかりません。");
return;
}
bool success = true;
Parallel.ForEach(infos,
d =>
{
// リツイート状態更新
var ud = d.UserViewModel;
if (ud != null)
status.RegisterRetweeted(ud);
try
{
unretweetInjection.Execute(new Tuple<AccountInfo, TweetViewModel>(d, status));
}
catch (Exception ex)
{
if (ud != null)
status.RemoveRetweeted(ud);
success = false;
NotifyStorage.Notify("Retweetキャンセルに失敗しました: @" + d.ScreenName);
if (!(ex is ApplicationException))
{
ExceptionStorage.Register(ex, ExceptionCategory.TwitterError,
"Retweetキャンセル操作時にエラーが発生しました");
}
}
});
if (success)
NotifyStorage.Notify("Retweetをキャンセルしました: @" + status.Status.User.ScreenName + ": " + status.Status.Text);
}
示例10: IsFavoredThis
public static bool IsFavoredThis(TweetViewModel status)
{
if (status == null || !status.IsStatusInfoContains) return false;
var fvd = status.FavoredUsers.Select(d => d.TwitterUser.ScreenName).ToArray();
return AccountStorage.Accounts.Any(d => fvd.Contains(d.ScreenName));
}
示例11: UnfavTweetCore
private static void UnfavTweetCore(AccountInfo d, TweetViewModel status)
{
if (ApiHelper.ExecApi(() => d.DestroyFavorites(status.Status.Id)) == null)
throw new ApplicationException();
}
示例12: OnRetweeted
public static void OnRetweeted(TweetViewModel tweet, UserViewModel retweeter)
{
if (AccountStorage.Contains(retweeter.TwitterUser.ScreenName) || tweet.CreatedAt < wakeupTime)
return;
Register(new EventDescription(EventKind.Retweet, retweeter,
UserStorage.Get(tweet.Status.User), tweet));
}
示例13: IsMyCurrentTweet
public static bool IsMyCurrentTweet(TweetViewModel status, TabProperty property)
{
if (status == null || !status.IsStatusInfoContains || property == null) return false;
return property.LinkAccountScreenNames.Any(a => a == status.Status.User.ScreenName);
}
示例14: FavTweetSink
public static void FavTweetSink(IEnumerable<AccountInfo> infos, TweetViewModel status)
{
var ts = status.Status as TwitterStatus;
if (ts == null)
{
NotifyStorage.Notify("DirectMessageはFavできません。");
return;
}
if (ts.RetweetedOriginal != null)
status = TweetStorage.Get(ts.RetweetedOriginal.Id, true);
if (status == null)
{
NotifyStorage.Notify("Fav 対象ステータスが見つかりません。");
return;
}
bool success = true;
Parallel.ForEach(infos,
(d) =>
{
var ud = d.UserViewModel;
// ふぁぼり状態更新
if (ud != null)
status.RegisterFavored(ud);
try
{
favoriteInjection.Execute(new Tuple<AccountInfo, TweetViewModel>(d, status));
}
catch (Exception ex)
{
success = false;
if (ud != null)
status.RemoveFavored(ud);
if (ex is FavoriteSuspendedException && Setting.Instance.InputExperienceProperty.EnableFavoriteFallback)
{
// ふぁぼ規制 -> フォールバック
AccountInfo fallback = null;
if(!String.IsNullOrEmpty( d.AccountProperty.FallbackAccount) &&
(fallback = AccountStorage.Get(d.AccountProperty.FallbackAccount)) != null &&
!status.FavoredUsers.Contains(fallback.UserViewModel))
{
NotifyStorage.Notify("Fav fallbackします: @" + d.ScreenName + " >> @");
FavTweetSink(new[] { fallback }, status);
}
}
else
{
NotifyStorage.Notify("Favに失敗しました: @" + d.ScreenName);
if (!(ex is ApplicationException))
{
ExceptionStorage.Register(ex, ExceptionCategory.TwitterError,
"Fav操作時にエラーが発生しました");
}
}
}
});
if (success)
NotifyStorage.Notify("Favしました: @" + status.Status.User.ScreenName + ": " + status.Status.Text);
}
示例15: RemoveTweet
private void RemoveTweet(TweetViewModel tvm)
{
this._tweetsSource.Remove(new TabDependentTweetViewModel(tvm, this.Parent));
}