private void buttonSave_Click(object sender, RoutedEventArgs e) { if (_account == null && comboBoxAccounts.comboBoxAccounts.SelectedItem != null) { _account = comboBoxAccounts.comboBoxAccounts.SelectedItem as AccountTwitter; if (_account == null) { MessageBox.Show("Unable to detect the account for this list", "List adding failed", MessageBoxButton.OK, MessageBoxImage.Error); return; } } TweetList list = API.Functions.createList(_account, textBoxName.Text, textBoxDescription.Text, checkBoxPublic.IsChecked.Value); if (list != null) { CreateSuccessEventArgs args = new CreateSuccessEventArgs(); args.success = true; args.list = list; if (CreateSuccess != null) { CreateSuccess(this, args); } if (person != null) { API.Functions.addPersonToList(person, list, _account); } Close(); } }
public static TweetList createList(AccountTwitter account, string name, string description, bool publicVisible) { CreateListOptions options = new TweetSharp.CreateListOptions(); options.Name = name; options.Description = description; if (publicVisible) { options.Mode = TweetSharp.TwitterListMode.Public; } else { options.Mode = TweetSharp.TwitterListMode.Private; } TwitterList list = account.twitterService.CreateList(options); if (list != null) { TweetList newList = API.TweetSharpConverter.getTweetListFromList(list, account); newList.IsOwnList = true; account.Lists.Add(newList); return(newList); } else { System.Windows.MessageBox.Show("Twitter returned the following info: \"failed\"", "List creation failed"); return(null); } }
public TrendingTopicItem(TweetList list, string searchString, bool saveResults) { _list = list; _searchString = searchString; _saveResults = saveResults; Value = this.GetType().ToString(); }
public async void NextSearchResult(object sender) { if (Searching) { return; } try { Searching = true; var client = DI.Resolve <TwitterClient>(); var maxid = TweetList?.Min(tweet => tweet.Id) - 1; var tweets = await client.Search(SearchWord, maxid); var contents = tweets.Select(tweet => new TweetControlViewModel(tweet)); foreach (var content in contents) { content.SetProfileAndMediaSource(); Dispatch <TweetControlViewModel>(TweetList.Add)(content); } } finally { Searching = false; } }
public TrendingTopicItem(TweetList list, string searchString, TrendingTopic trendingTopic) { _list = list; _searchString = searchString; TrendingTopic = trendingTopic; Value = this.GetType().ToString(); }
public static bool deleteList(AccountTwitter account, TweetList list) { DeleteListOptions options = new TweetSharp.DeleteListOptions(); options.ListId = Convert.ToInt64(list.Id); options.OwnerScreenName = account.Login.Username; options.Slug = list.Slug; TwitterList tlist = null; if (list.IsOwnList) { IAsyncResult result = account.twitterService.BeginDeleteList(options); tlist = account.twitterService.EndDeleteList(result); } else { // xxx hä? wie kann man eine Liste unsubscriben...? } if (tlist != null) { account.Lists.Remove(list); AppController.Current.AllLists.Remove(list); list = null; return(true); } else { return(false); } }
public User() { InitializeComponent(); Loaded += (sender, e) => { if (ApplicationBar != null) { ApplicationBar.MatchOverriddenTheme(); } }; viewModel = new UserModel(); DataContext = viewModel; this.Loaded += (sender, e) => { string userName; if (!NavigationContext.QueryString.TryGetValue("user", out userName)) { NavigationService.GoBack(); return; } viewModel.Loaded(userName); }; viewModel.PropertyChanged += (sender, e) => { if (e.PropertyName == "ScreenName") { TweetList.Resource = new TwitterResource { String = "Tweets:" + viewModel.ScreenName, User = DataTransfer.CurrentAccount }; TweetList.Load(); MentionsList.Resource = new TwitterResource { Data = "@" + viewModel.ScreenName, Type = ResourceType.Search, User = DataTransfer.CurrentAccount }; MentionsList.Load(); } }; TweetList.Loader.PropertyChanged += (sender, e) => { if (e.PropertyName == "IsLoading") { viewModel.IsLoading = TweetList.Loader.IsLoading; } }; MentionsList.Loader.PropertyChanged += (sender, e) => { if (e.PropertyName == "IsLoading") { viewModel.IsLoading = MentionsList.Loader.IsLoading; } }; TweetList.Loader.Cached = false; MentionsList.Loader.Cached = false; }
private void buttonRemoveListMember_Click(object sender, RoutedEventArgs e) { Person person = listBoxListMembers.SelectedItem as Person; TweetList list = listBoxLists.SelectedItem as TweetList; if (person != null && list != null) { API.Functions.removePersonFromList(person, list, AppController.Current.getAccountForId(list.AccountId)); } }
private void Send() { var newTweet = new Tweet { Text = this.Text, CreatedAt = DateTime.Now, UserName = "******" }; TweetList.Insert(0, newTweet); Tweet = newTweet; Text = ""; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <Tweet> tweets = new List <Tweet>(); GetTweets getTweets = new GetTweets(); tweets = getTweets.GetTweetList(Username, Password, Screenname, ConsumerKey, ConsumerSecret, oAuthToken, oAuthSecret, tweetCount); TweetList.DataSource = tweets; TweetList.DataBind(); } }
void userSearchWindows_SearchSuccess(object sender, SearchUser.SearchSuccessEventArgs e) { TweetList list = listBoxLists.SelectedItem as TweetList; if (list != null) { foreach (Person person in e.selectedPersons) { API.Functions.addPersonToList(person, list, AppController.Current.getAccountForId(list.AccountId)); } } }
public async Task GetSOT(CommandContext ctx, [Description("Anzahl der Tweets (Min 5, Max 10, Default 5)")] int anzahl = 5) { var msg = string.Empty; var msg2 = string.Empty; TweetList twitterResponse = new TweetList(); if (5 > anzahl || anzahl > 100) { await ctx.Channel.SendMessageAsync("Du kek hast eine ungültige Zahl angegeben").ConfigureAwait(false); return; } foreach (ulong u in config.TwitterValues.UserIds) { var client = new RestClient($"https://api.twitter.com/2/users/{u}/tweets?max_results={anzahl}"); client.Timeout = -1; var request = new RestRequest(Method.GET); request.AddHeader("Authorization", $"Bearer {config.TwitterValues.BearerToken}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { int c = 0; twitterResponse = JsonConvert.DeserializeObject <TweetList>(response.Content); foreach (var t in twitterResponse.data) { if (c < 5) { var dummy = Functions.Functions.checkTwitterText(t.text); if (dummy.Item1) { msg += $"{dummy.Item2}\nhttps://twitter.com/SeaOfThieves/status/{t.id}\n"; c++; } } else { msg2 += $"https://twitter.com/SeaOfThieves/status/{t.id}\n"; c++; } } await ctx.Channel.SendMessageAsync(msg).ConfigureAwait(false); if (c > 5) { await ctx.Channel.SendMessageAsync(msg2).ConfigureAwait(false); } } } }
public void TweetList_Lifecycle() { var loggedUser = User.GetLoggedUser(); var newList = TweetList.CreateList("myTemporaryList", PrivacyMode.Private, "tmp"); var userLists = TweetList.GetUserLists(loggedUser, true); var newListVerify = TweetList.GetExistingList(newList); var updateParameter = TweetList.GenerateUpdateParameters(); updateParameter.Name = "piloupe"; newListVerify.Update(updateParameter); newListVerify.Destroy(); }
private void buttonAddToList_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button != null) { Person person = button.CommandParameter as Person; if (person != null) { TweetList list = comboBoxLists.comboBoxLists.SelectedItem as TweetList; if (list != null) { if (list.FullName != "Create new list...") { try { API.Functions.addPersonToList(person, list, AppController.Current.getAccountForId(list.AccountId)); } catch (Exception exp) { MessageBox.Show(exp.Message, "Adding to list failed"); AppController.Current.Logger.writeToLogfile(exp); } } else { try { addToNewlyCreatedList(person); } catch (Exception exp) { MessageBox.Show(exp.Message, "Adding to list failed"); AppController.Current.Logger.writeToLogfile(exp); } } } else { try { addToNewlyCreatedList(person); } catch (Exception exp) { MessageBox.Show(exp.Message, "Adding to list failed"); AppController.Current.Logger.writeToLogfile(exp); } } } } }
private void buttonRemoveList_Click(object sender, RoutedEventArgs e) { AccountTwitter account = comboBoxAccounts.comboBoxAccounts.SelectedItem as AccountTwitter; if (account != null) { TweetList list = listBoxLists.SelectedItem as TweetList; if (list != null) { if (API.Functions.deleteList(account, list)) { listBoxLists.Items.Refresh(); } } } }
private async void FetchHomeTimeline(object obj) { if (HomeTimelineCommand.CanExecute(obj) == false) { return; } try { IsGettingTimeline = true; await PopupService.Flash(Application.Current.MainWindow, "タイムライン取得中"); var tweets = (await Client.FetchHomeTimeline()).Select(tweet => new TweetControlViewModel(tweet)); if (tweets.Max(t => t?.Id) == TweetList.Max(t => t?.Id)) { return; } var excepts = Enumerable.Except(tweets.Select(t => t.Id), TweetList.Select(t => t.Id)); var orderedExcepts = tweets.Where(t => excepts.Contains(t.Id)).OrderBy(t => t.Id); foreach (var content in orderedExcepts) { content.SetProfileAndMediaSource(); Dispatcher.Invoke(() => TweetList.Insert(0, content)); } } catch (AggregateException err) { foreach (var ie in err.InnerExceptions) { throw ie; } } catch (CoreTweet.TwitterException err) { Debug.WriteLine(err); MessageBox.Show("Twitter API 取得制限に達しました。\r\n15分間の利用が制限されています。"); } finally { IsGettingTimeline = false; await PopupService.Flash(Application.Current.MainWindow, "タイムライン取得完了"); } }
public async void ShowTweets() { TweetList.Clear(); Debug.WriteLine("-- Retweets allowed? {0}", AllowRetweet); TweetList = await DependencyService.Get <ITweetService>().GetTweetsFromLocation(lat, lng, radius, allowRetweet, maxTweets, showRecent); foreach (var tweet in tweetList) { Debug.WriteLine( "User: {0}, Tweet: {1}, Place: {2}, Coordinates: Lat: {3}, Lng: {4} ", tweet.User, tweet.Text, tweet.Place, tweet.Lat, tweet.Lng ); } }
public static bool addPersonToList(Person person, TweetList list, AccountTwitter account) { AddListMemberOptions options = new TweetSharp.AddListMemberOptions(); options.OwnerScreenName = account.username; options.Slug = list.Slug; options.UserId = Convert.ToInt64(person.Id); TwitterUser user = account.twitterService.AddListMember(options); if (user != null) { list.Members.Add(person); return(true); } else { return(false); } }
// Constructeur public MainPage() { InitializeComponent(); HeaderLabel.Text = string.Format("#{0}", Bootstrap.HASHTAG); StatusLabel.Text = "Loading data from Twitter API..."; TweetList.ItemsSource = _source; Bootstrap.Initialize(); Bootstrap.TwitterSearchService.SearchAsync(Bootstrap.HASHTAG).ContinueWith(x => { Dispatcher.BeginInvoke(() => { if (x.Result.Count == 0) { StatusLabel.Text = "No result"; } else { StatusLabel.Visibility = Visibility.Collapsed; } foreach (Tweet t in x.Result) { _source.Add(t); } }); Bootstrap.TwitterSearchService.StreamAsync(Bootstrap.HASHTAG, (t) => { Dispatcher.BeginInvoke(() => { if (StatusLabel.Visibility == Visibility.Visible) { StatusLabel.Visibility = Visibility.Collapsed; } _source.Insert(0, t); Task.Run(() => Dispatcher.BeginInvoke(() => TweetList.ScrollTo(t))); }); }); }); }
public static TweetList getTweetListFromList(TwitterList list, AccountTwitter account) { TweetList tweetList = new TweetList(account); tweetList.name = list.Name; tweetList.person = getPersonFromUser(list.User, account); tweetList.Id = list.Id; tweetList.Slug = list.Slug; tweetList.FullName = list.FullName; if (list.User != null) { tweetList.NameAndCreator = list.Name + " (@" + list.User.ScreenName + ")"; tweetList.IsOwnList = false; } else { tweetList.NameAndCreator = list.Name; tweetList.IsOwnList = true; } return(tweetList); }
public MainViewModelDesign() { Text = "Text for a new tweet"; var now = DateTime.Now; TweetList.Insert(0, new Tweet { Text = "Creating a simple Twitter app for Android with MvvmQuickCross", UserName = "******", CreatedAt = now.AddSeconds(-115) }); TweetList.Insert(0, new Tweet { Text = "Created an Android solution with an application and a library project", UserName = "******", CreatedAt = now.AddSeconds(-63) }); TweetList.Insert(0, new Tweet { Text = "Added Tweet model class", UserName = "******", CreatedAt = now.AddSeconds(-45) }); TweetList.Insert(0, new Tweet { Text = "Added viewmodel properties and commands with code snippets", UserName = "******", CreatedAt = now.AddSeconds(-25) }); TweetList.Insert(0, new Tweet { Text = "Added some hardcoded design data fot the viewmodel", UserName = "******", CreatedAt = now.AddSeconds(-1) }); }
void listBoxLists_SelectionChanged(object sender, SelectionChangedEventArgs e) { TweetList list = listBoxLists.SelectedItem as TweetList; if (list != null) { listBoxListMembers.ItemsSource = list.Members; if (list.IsOwnList) { buttonAddListMember.IsEnabled = true; buttonRemoveListMember.IsEnabled = true; buttonRemoveList.IsEnabled = true; } else { buttonAddListMember.IsEnabled = false; buttonRemoveListMember.IsEnabled = false; buttonRemoveList.IsEnabled = false; } } }
private async void FetchNextHomeTimeLine(object obj) { if (!NextHomeTimelineCommand.CanExecute(obj)) { return; } try { IsGettingTimeline = true; await PopupService.Flash(Application.Current.MainWindow, "タイムライン取得中"); var maxid = TweetList.Min(tweet => tweet.Id) - 1; var tweets = (await Client.FetchHomeTimeline(maxid: maxid)).Select(tweet => new TweetControlViewModel(tweet)); foreach (var content in tweets) { content.SetProfileAndMediaSource(); Dispatch <TweetControlViewModel>(TweetList.Add)(content); } } catch (AggregateException err) { foreach (var ie in err.InnerExceptions) { throw ie; } } catch (CoreTweet.TwitterException err) { Debug.WriteLine(err); MessageBox.Show("Twitter API 取得制限に達しました。\r\n15分間の利用が制限されています。"); } finally { IsGettingTimeline = false; await PopupService.Flash(Application.Current.MainWindow, "タイムライン取得完了"); } }
public static bool removePersonFromList(Person person, TweetList list, AccountTwitter account) { RemoveListMemberOptions options = new TweetSharp.RemoveListMemberOptions(); options.OwnerScreenName = account.username; options.Slug = list.Slug; options.UserId = Convert.ToInt64(person.Id); TwitterUser user = account.twitterService.RemoveListMember(options); if (user != null) { if (list.Members.Contains(person)) { list.Members.Remove(person); } return(true); } else { return(false); } }
private void BtnTweetTemizle_Click(object sender, EventArgs e) { TweetList.Clear(); }
// Use this for initialization void Start() { options = GameObject.Find("Persistent").GetComponent <TweetList>(); StartCoroutine(Event()); }
private void Delete() { TweetList.Remove(Tweet); Tweet = null; }
public MoreResultsItem(TweetList list, ISpecialTimeLine timeLine) { _list = list; _timeLine = timeLine; Value = this.GetType().ToString(); }
public TrendingTopicItem(TweetList list, ISpecialTimeLine timeLine) { _list = list; _timeLine = timeLine; Value = this.GetType().ToString(); }