public TimelineRow(Tweet tweet,string ownerScreenName,SettingData setting,Action<RowAction> actionCallback) :base(tweet,ownerScreenName,setting,actionCallback,RowType.Tweet) { if (tweet.retweeted_status == null) { this.RowType = RowType.Tweet; if (Tweet.text.Contains("@" + ownerScreenName)) { SharedDispatcher.RunAsync(() => { BarColorBrush = (Application.Current.Resources["MentionForegroundBrush"] as SolidColorBrush).Color; }); } } else { this.RowType = RowType.Retweet; SharedDispatcher.RunAsync(() => { BarColorBrush = (Application.Current.Resources["RetweetForegroundBrush"] as SolidColorBrush).Color; }); } Initialize(rowActionCallback); }
public override async void Initialize(TwitterAccount account,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) { base.Initialize(account,setting, timelineActionCallback, rowActionCallback); ChangeLoadState(true); if (TimeLine.Count > 0) { string sinceId = (TimeLine.First() as DirectMessageRow).DirectMessage.id_str; var dms = await Account.TwitterClient.GetDirectMessages(sinceId); var sents = await Account.TwitterClient.GetDirectMessageSent(sinceId); dms.AddRange(sents); dms.Sort(); dms.Reverse(); var dmRows = dms.Select(d => new DirectMessageRow(d, Account.UserInfomation.screen_name, Setting,rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(dmRows); } else { var dms = await Account.TwitterClient.GetDirectMessages(); var sents = await Account.TwitterClient.GetDirectMessageSent(); dms.AddRange(sents); dms.Sort(); dms.Reverse(); var dmRows = dms.Select(d => new DirectMessageRow(d, Account.UserInfomation.screen_name, Setting,rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(dmRows); } ChangeLoadState(false); }
public DirectMessageRow(DirectMessage dm,string ownerScreenName,SettingData setting,Action<RowAction> actionCallback) :base(new Tweet(), ownerScreenName,setting,actionCallback,RowType.DirectMessage) { this.directMessage = dm; Initialize(rowActionCallback); }
public SearchTimeline(TwitterAccount account, string listTitle, string tabName, string searchWord,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) : base(account, listTitle, tabName, TimelineType.Search,setting,timelineActionCallback,rowActionCallback) { this.SearchWord = searchWord; Initialize(account,setting,timelineActionCallback,rowActionCallback); }
public NotificationRow(Tweet tweet,string message,SettingData setting,NotificationType type,string ownerScreenName,Action<RowAction> actionCallback) :base(tweet,ownerScreenName,setting,actionCallback,RowType.Notification) { Initialize(rowActionCallback); this.NType = type; this.Message = message; }
public RowBase(Tweet tweet,string ownerScreenName,SettingData setting,Action<RowAction> rowActionCallBack,RowType type) { this.ownerScreenName = ownerScreenName; this.RowType = type; this.Tweet = tweet; this.setting = setting; InitializeBase(rowActionCallBack); }
public static async Task SaveSettingAsync(SettingData data) { ApplicationData.Current.LocalSettings.Values["SettingDataInitializeCompleted"] = true; await DataSerializer.DataContractSerializeAsync("SettingData", typeof(SettingData), data); await WriteBytesStorageFileAsync("MainBackground", data.AppTheme.MainBackground.UIImage); await WriteBytesStorageFileAsync("AppBarTopBackground", data.AppTheme.TopAppBarBackground.UIImage); await WriteBytesStorageFileAsync("AppBarBottomBackground", data.AppTheme.BottomAppBarBackground.UIImage); await WriteBytesStorageFileAsync("TweetBarBottomBackground", data.AppTheme.BottomTweetBarBackground.UIImage); await WriteBytesStorageFileAsync("SettingsFlyoutBackground", data.AppTheme.SettingsFlyoutBackground.UIImage); }
public override async void Initialize(TwitterAccount account,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<Row.RowAction> rowActionCallback) { base.Initialize(account,setting, timelineActionCallback, rowActionCallback); await InsertRestInTimeLineAsync((await Account.TwitterClient.GetSearchAsync(SearchWord)).statuses.Select(q=>new TimelineRow(q,Account.UserInfomation.screen_name,Setting,rowActionCallback)).Cast<RowBase>().ToList()); trackStream = new TrackStream(account.TwitterClient.ConsumerData, account.TwitterClient.AccessToken, account.UserInfomation, searchWord); trackStream.ConnectStreamAsync(); trackStream.GetStreamTrack += async(tweet) => { await InsertStreamInTimeLineAsync(new TimelineRow(tweet,Account.UserInfomation.screen_name,Setting,rowActionCallback)); }; }
public override async void Initialize(TwitterAccount account,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) { base.Initialize(account,setting, timelineActionCallback, rowActionCallback); if (TimeLine.Count > 0) { var t = TimeLine.First() as TimelineRow; var rows = (await Account.TwitterClient.GetListAsync(TwitterList,t.Tweet.id_str)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name,Setting, rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(rows); } else { var rows = (await Account.TwitterClient.GetListAsync(TwitterList)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name,Setting, rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(rows); } }
public static async Task <SettingData> LoadSettingAsync() { SettingData resultData = new SettingData(); resultData = await DataSerializer.DataContractDeselializeAsync("SettingData", typeof(SettingData)) as SettingData; resultData.AppTheme.MainBackground.UIImage = await ReadBytesStorageFileAsync("MainBackground"); resultData.AppTheme.TopAppBarBackground.UIImage = await ReadBytesStorageFileAsync("AppBarTopBackground"); resultData.AppTheme.BottomAppBarBackground.UIImage = await ReadBytesStorageFileAsync("AppBarBottomBackground"); resultData.AppTheme.BottomTweetBarBackground.UIImage = await ReadBytesStorageFileAsync("TweetBarBottomBackground"); resultData.AppTheme.SettingsFlyoutBackground.UIImage = await ReadBytesStorageFileAsync("SettingsFlyoutBackground"); resultData.SettingConstInitialize(); return(resultData); }
public override async void Initialize(TwitterAccount account,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) { base.Initialize(account,setting, timelineActionCallback, rowActionCallback); ChangeLoadState(true); if (TimeLine.Count > 0) { string sinceId = (TimeLine.First() as TimelineRow).Tweet.id_str; var rows = (await Account.TwitterClient.GetMentionTimelineNewAsync(sinceId)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name,Setting, rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(rows); } else { var rows = (await Account.TwitterClient.GetMentionTimelineAsync(200)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name,Setting, rowActionCallback)).Cast<RowBase>().ToList(); await InsertRestInTimeLineAsync(rows); } ChangeLoadState(false); }
public ListTimeline(TwitterAccount account, string listTitle, string tabName,TwitterList list,SettingData setting,Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) : base(account, listTitle, tabName, TimelineType.List,setting,timelineActionCallback,rowActionCallback) { this.TwitterList = list; Initialize(account,setting, timelineActionCallback, rowActionCallback); }
public virtual void Initialize(TwitterAccount account, SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) { this.account = account; this.account.UserStreamClient.GetStreamHome += this.GetStreamTweet; this.account.UserStreamClient.GetStreamFavorited += this.GetStreamFavorited; this.account.UserStreamClient.GetStreamIsFavorited += this.GetStreamIsFavorited; this.account.UserStreamClient.GetStreamSystemMessage += this.GetStreamSystemMessage; this.account.UserStreamClient.GetStreamDelete += this.GetStreamDelete; this.account.UserStreamClient.GetStreamDirectMessage += GetStreamDirectMessage; this.account.UserStreamClient.GetStreamFollow+=GetStreamFollow; this.account.UserStreamClient.GetStreamIsFollowed += GetStreamIsFollow; this.account.FollowStreamClient.GetStreamRetweet += GetStreamRetweet; this.account.FollowStreamClient.GetStreamRetweeted += GetStreamRetweeted; this.account.FollowStreamClient.GetStreamMe += GetStreamMe; this.account.FollowStreamClient.GetStreamMention += GetStreamMention; this.account.FollowStreamClient.GetStreamDelete += GetStreamDelete; this.account.OnTweetFailed += OnTweetFailed; this.account.OnUserStreamHttpError += OnUserStreamHttpError; this.account.ChangeUserStreamEvent += ChangeUserStreamEvent; this.timelineWidth = 320; this.RowMax = 2000; this.timelineActionCallback = timelineActionCallback; this.rowActionCallback = rowActionCallback; this.Setting = setting; EditCommand = new DelegateCommand(() => { this.timelineActionCallback(new TimelineAction(TimelineActionType.Edit, this)); }); DeleteCommand = new DelegateCommand(() => { this.timelineActionCallback(new TimelineAction(TimelineActionType.Delete, this)); }); foreach (var t in TimeLine) { t.InitializeBase(rowActionCallback); if (t is TimelineRow) { (t as TimelineRow).Initialize(rowActionCallback); } else if (t is DirectMessageRow) { (t as DirectMessageRow).Initialize(rowActionCallback); } else if (t is NotificationRow) { (t as NotificationRow).Initialize(rowActionCallback); } } }
public TimelineBase(TwitterAccount account, string listTitle, string tabName, TimelineType type, SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) { this.ListTitle = listTitle; timeLine = new ObservableCollection<RowBase>(); IsTimelineFiltering = false; IsNewNotification = false; this.TimelineType = type; this.TabName = tabName; ExtractionAccountScreenNameStr = string.Empty; ExcludeAccountScreenNameStr = string.Empty; ExtractionWordStr = string.Empty; ExcludeWordStr = string.Empty; this.Setting = setting; IsNowLoading = false; liveTileCounter = 0; }
public DirectMessageTimeline(TwitterAccount account, string listTitle, string tabName,SettingData setting, Action<TimelineAction> timelineActionCallback, Action<RowAction> rowActionCallback) : base(account, listTitle, tabName, TimelineType.DirectMessage,setting, timelineActionCallback, rowActionCallback) { Initialize(account,setting, timelineActionCallback, rowActionCallback); }
public NeuroniaModel(CoreDispatcher dispatcher, ConsumerData consumerData) { SharedDispatcher.Dispatcher = dispatcher; twitterUIComponent = new TwitterUIComponent(); accountList = new ObservableCollection<TwitterAccount>(); TimelineListTab = new ObservableCollection<TimelineTab>(); NowTimelineList = new ObservableCollection<TimelineBase>(); SearchDetail = new SearchDetail(); Setting = new SettingData(); TweetDetail = new TweetDetail(new TimelineRow(Tweet.ZeroTweet,"",Setting,CallRowAction)); DMDetail = new DirectMessageDetail(); UserDetail = new UserDetail(); NotifyMessage = new NotificationMessage(); IsFirstNavigate = true; this.consumerData = consumerData; this.connectionStatusStr = ""; Authorizer = new TwitterAuthorizer(); restTimerCounter = 0; LicenseInfo = CurrentApp.LicenseInformation; RestTimer = new DispatcherTimer(); RestTimer.Interval = TimeSpan.FromMinutes(1); RestTimer.Tick += (s, e) => Task.Run(async() => { await SharedDispatcher.RunAsync(() => { NowTime = DateTime.Now; NowTimeStr = NowTime.ToString("HH:mm"); }); if (restTimerCounter%2 == 0) { foreach (var tab in TimelineListTab) { foreach (var t in tab.TimelineList) { await t.RestUpdate(); } } } if (restTimerCounter%10 == 0) { TwitterUIComponent.MentionSuggestSourceList.Clear(); TwitterUIComponent.HashSuggestSourceList.Clear(); foreach (var tab in TimelineListTab) { foreach (var t in tab.TimelineList) { foreach (var ac in (await t.GetTimelineAccountListAsync())) { TwitterUIComponent.MentionSuggestSourceList.Add(ac); } foreach (var ac in (await t.GetTimelineHashTagListAsync())) { TwitterUIComponent.HashSuggestSourceList.Add(ac); } } } } restTimerCounter++; if (restTimerCounter > 100) { restTimerCounter = 0; } }); RestTimer.Start(); timelineWidth = 320; IsFirstLaunch = true; if (LicenseInfo.ProductLicenses["ApplicationTheme"].IsActive) { IsPurchase = true; } else { IsPurchase = false; } }