Пример #1
0
		/// <summary>
		/// 
		/// </summary>
		public void OpenBrowser(TweetListItemData item)
		{
			if (item == null) return;
			var tw = item.Status;
			string uriText = string.Format("https://twitter.com/{0}/status/{1}", tw.User.ScreenName, tw.Id);
			System.Diagnostics.Process.Start(uriText);
		}
Пример #2
0
		/// <summary>
		/// 
		/// </summary>
		async Task Run()
		{
			await Task.Factory
				.StartNew(() =>
			{
				SearchOptions searchOption = new SearchOptions();
				searchOption.Q = "-RT #艦これ版深夜の真剣お絵描き60分一本勝負";
				searchOption.Resulttype = TwitterSearchResultType.Recent;
				searchOption.Count = 11;
				searchOption.Lang = "ja";

				int skipNum = 0;

				if (!this._RcentMode)
				{
					if (lastTweetId != 0L)
					{
						searchOption.MaxId = lastTweetId;
						skipNum = 1;
					}
				}

				this.Items.Clear();
				this.SelectedListItem = null;

				IAsyncResult result = service.Search(searchOption, (searchResult, response) =>
				{
					if (response.StatusCode == HttpStatusCode.OK)
					{
						// RxとLINQを使えばもっとスマートだけれど。
						foreach (var tweet in searchResult.Statuses.Skip(skipNum))
						{
							var i = new TweetListItemData(tweet);
							this.Items.Add(i);

							var bgw = new BackgroundWorker();
							bgw.DoWork += OnLoadMediaBackgroundWorker;
							bgw.RunWorkerAsync(i);

							lastTweetId = tweet.Id;
						}
					}
				});

				//result.AsyncWaitHandle.WaitOne();
			});
		}