protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (NavigationContext.QueryString.TryGetValue("symbol", out _currentSymbol))
            {
                System.Diagnostics.Debug.WriteLine("DetailedQuotedPage: symbol is " + CurrentSymbol);
                CurrentQuote = App.GetQuote(CurrentSymbol);

                TweetView.EmptyData();

                if (CurrentQuote.Change > 0)
                {
                    Change.Foreground = new SolidColorBrush(Colors.Green);
                }
                else if (CurrentQuote.Change < 0)
                {
                    Change.Foreground = new SolidColorBrush(Colors.Red);
                }

                if (App.StClient.User != null)
                {
                    // signed in
                    App.StClient.AccessToken = App.StClient.User.access_token;
                    App.StClient.UserID      = App.StClient.User.user_id;
                    App.StClient.UserName    = App.StClient.User.username;
                }

                RssView.Symbol        = CurrentSymbol;
                ProgressBar.IsVisible = false;

                RefreshView(RootPanorama.SelectedIndex);
            }
        }
Example #2
0
 private void loadTweet(StackLayout tweetList)
 {
     foreach (var tweet in twitterService.getTweets())
     {
         TweetView tweetView = new TweetView();
         tweetView.LoadData(tweet);
         tweetList.Children.Add(tweetView);
     }
 }
        public IActionResult Tweets(string startDate, string endDate)
        {
            List <Tweets> tweetList;
            TweetView     tweetView = new TweetView();

            if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate))
            {
                tweetView.TweetList = GetAllTweets.GetTweets(startDate, endDate);
            }
            else
            {
                tweetView.TweetList = new List <Tweets>();
            }
            return(View(tweetView));
        }
Example #4
0
 public App()
 {
     MainPage = new TweetView();
     // The root page of your application
     //MainPage = new ContentPage {
     //    Content = new StackLayout {
     //        VerticalOptions = LayoutOptions.Center,
     //        Children = {
     //            new Label {
     //                XAlign = TextAlignment.Center,
     //                Text = "Welcome to Xamarin Forms!"
     //            }
     //        }
     //    }
     //};
 }
        private void StockTwits_NewTweet(object sender, EventArgs e)
        {
            if (App.StClient.User != null)
            {
                var tb = new TextBox();
                tb.MinHeight = 120;
                tb.Text      = "$" + CurrentSymbol + " ";
                var box = new CustomMessageBox()
                {
                    Caption            = "New Tweet",
                    LeftButtonContent  = "Post",
                    RightButtonContent = "Cancel",
                    Content            = tb,
                    IsFullScreen       = false
                };
                box.Dismissed += (s, ev) =>
                {
                    if (ev.Result == CustomMessageBoxResult.LeftButton)
                    {
                        // a very basic new tweet form
                        App.StClient.CreateMessage(tb.Text, delegate(object obj, UploadStringCompletedEventArgs args)
                        {
                            System.Diagnostics.Debug.WriteLine(args.Result);
                            TweetView.LoadData(ProgressBar);
                        });
                    }
                };

                // focus on the text box by default
                box.Loaded += (s, ev) =>
                {
                    tb.Focus();
                };

                box.Show();
            }
            else
            {
                string           message = "You need to sign in with StockTwits to post tweets.";
                string           caption = "Oops";
                MessageBoxButton buttons = MessageBoxButton.OK;
                MessageBoxResult result  = MessageBox.Show(message, caption, buttons);
            }
        }
        private void RefreshView(int panoramaIndex)
        {
            if (panoramaIndex < 2)
            {
                WebClient client = new WebClient();
                client.DownloadStringCompleted += (obj, args) =>
                {
                    YahooAPI.UpdateQuotes(args.Result.ToString());

                    if (CurrentQuote.Change > 0)
                    {
                        Change.Foreground = new SolidColorBrush(Colors.Green);
                    }
                    else if (CurrentQuote.Change < 0)
                    {
                        Change.Foreground = new SolidColorBrush(Colors.Red);
                    }
                };
                client.DownloadStringAsync(YahooAPI.GetQuotesXmlUrl(new List <string>()
                {
                    CurrentSymbol
                }));
            }
            if (panoramaIndex == 2)
            {
                // graph page
                UpdateGraph();
            }
            else if (panoramaIndex == 3)
            {
                // rss news page
                ProgressBar.IsIndeterminate = true;
                ProgressBar.IsVisible       = true;
                RssView.LoadData(ProgressBar);
            }
            else if (panoramaIndex == 4)
            {
                // tweets page
                ProgressBar.IsIndeterminate = true;
                ProgressBar.IsVisible       = true;
                TweetView.Symbol            = CurrentSymbol;
                TweetView.LoadData(ProgressBar);
            }
        }
Example #7
0
        protected override void Tick()
        {
            var tweets = TwitterSearch.FromUsers(_since, Brain.Settings.Twitters.ToArray());

            _since = tweets.Max_id_str;
            foreach (var tweet in tweets.Results)
            {
                if (tweet.Entities.Urls.Count() > 0)
                {
                    var tweet1 = tweet;
                    Brain.Pipe.ListenOnce((s, match, arg3) => Process.Start(tweet1.Entities.Urls.First().Url), "open|more|show");
                    foreach (var twitterEntityUrl in tweet.Entities.Urls)
                    {
                        tweet.Text = tweet.Text.Replace(twitterEntityUrl.Url, "");
                    }
                }
                TweetView.Create(tweet.Text, tweet.From_user);
                Brain.ListenerManager.CurrentListener.Output("{0}: {1}".Template(tweet.From_user_name, tweet.Text));
            }
        }
Example #8
0
 public App()
 {
     // The root page of your application
     MainPage = new TweetView();
 }
        public ActionResult UserAccount(string id)
        {
            CompleteProfile  myProfile = (CompleteProfile ) Session["myProfile"];

            UserAccountViewModel accountRetrieved = UserAccountService.GetUserAccountByKey(id);

            UserAccountView accountView = new UserAccountView();

            accountView.Profile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = accountRetrieved.Profile.BasicProfile.ReferenceKey  , AccountType = AccountType.UserAccount  }, FullName= accountRetrieved.Profile.FullName  , Description1=accountRetrieved.Profile.Description1 , Description2=accountRetrieved.Profile.Description2   };

            accountView.EmailOfThisProfile = accountRetrieved.Email;

            accountView.FoldersOfThisProfile = new Dictionary<string, string>();
            accountView.WallOfThisProfile = new ContentStreamView();
            accountView.WallOfThisProfile.Posts = new List<PostView>();
            accountView.WallOfThisProfile.Tweets = new List<TweetView>();
            accountView.WallOfThisProfile.Retweets = new List<RetweetView>();

            if (User.Identity.Name == accountRetrieved.Email)
            {
                accountView.IsThisMyOwnProfile = true;
            }
            else
            {
                FriendshipStateInfoViewModel friendship = UserAccountService.GetFriendshipBetweenUserAccountsByKeys(myProfile.BasicProfile.ReferenceKey.ToString() , accountRetrieved.Profile.BasicProfile.ReferenceKey );

                switch (friendship.FriendshipAction)
                {
                    case FriendshipAction.Accept :
                        accountView.ShowFriendshipButtonForThisProfile = true;
                        accountView.EnableFriendshipButtonForThisProfile = true;
                        accountView.IsThisProfileAFriendOfMine = true;
                        accountView.FriendshipButtonActionNameForThisProfile = "CancelFriendshipWith";
                        accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts";
                        accountView.FriendshipButtonCaptionForThisProfile = "Cancel Friendship";
                        break;

                    case FriendshipAction.Request :

                        if (friendship.Sender.BasicProfile.ReferenceKey == myProfile.BasicProfile.ReferenceKey.ToString())
                        {
                            //if the viewer is the one that sent the request
                            accountView.ShowFriendshipButtonForThisProfile = true;
                            accountView.EnableFriendshipButtonForThisProfile = false;
                            accountView.isWaitingForFriendshipResponse = true;
                            accountView.FriendshipButtonActionNameForThisProfile = "CancelRequestTo";
                            accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts";
                            accountView.FriendshipButtonCaptionForThisProfile = "Cancel Request";
                        }
                        else
                        {
                            //if the viewer is the one that received the request
                            accountView.ShowFriendshipButtonForThisProfile = true;
                            accountView.EnableFriendshipButtonForThisProfile = false;
                            accountView.FriendshipButtonActionNameForThisProfile = "Null";
                            accountView.FriendshipButtonControllerNameForThisProfile = "Null";
                            accountView.FriendshipButtonCaptionForThisProfile = "Request Received";
                        }

                        break;

                    //case Domain.Friendships.States.FriendshipAction.New :
                    //case Domain.Friendships.States.FriendshipAction.Cancel :
                    //case Domain.Friendships.States.FriendshipAction.Reject :
                    default :
                        accountView.ShowFriendshipButtonForThisProfile = true;
                        accountView.EnableFriendshipButtonForThisProfile = true;
                        accountView.FriendshipButtonActionNameForThisProfile = "RequestFriendshipTo";
                        accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts";
                        accountView.FriendshipButtonCaptionForThisProfile = "Send Request";
                        break;

                }
            }

            var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString();
            ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamAsProfileWall(id,thisViewerKey);

            if (wallRetrieved.Posts.Count>0)
            {
                if (wallRetrieved.Posts != null)
                {
                    accountView.WallOfThisProfile.Posts = new List<PostView>();
                    foreach (PostViewModel post in wallRetrieved.Posts)
                    {
                        PostView thisPost = new PostView();
                        thisPost.Key = post.Key;
                        thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=post.Author.BasicProfile.ReferenceKey , AccountType=post.Author.BasicProfile.AccountType  }, FullName= post.Author.FullName , Description1= post.Author.Description1 , Description2= post.Author.Description2  };

                        thisPost.Text = post.Text;
                        thisPost.PublishDateTime = post.PublishDateTime;
                        thisPost.Likes = post.Likes;
                        thisPost.ILikedIt = post.ILikedIt;
                        thisPost.Comments = new List<CommentView>();
                        foreach (CommentViewModel comment in post.Comments)
                        {
                            CommentView thisComment = new CommentView();
                            thisComment.Key = comment.Key;
                            thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 };

                            thisComment.Text = comment.Text;
                            thisComment.ILikedIt = comment.ILikedIt;
                            thisComment.PublishDateTime = comment.PublishDateTime;
                            thisComment.Likes = comment.Likes;
                            thisPost.Comments.Add(thisComment);
                        }
                        accountView.WallOfThisProfile.Posts.Add(thisPost);
                    }
                }

            }

            if (wallRetrieved.Tweets.Count > 0)
            {
                foreach (TweetViewModel tweet in wallRetrieved.Tweets)
                {
                    TweetView thisTweet = new TweetView();

                    thisTweet.Key = tweet.Key;
                    thisTweet.Text = tweet.Text;
                    thisTweet.PublishDateTime = tweet.PublishDateTime;
                    thisTweet.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = tweet.Author.BasicProfile.ReferenceKey, AccountType = tweet.Author.BasicProfile.AccountType }, FullName = tweet.Author.FullName, Description1 = tweet.Author.Description1, Description2 = tweet.Author.Description2 };

                    accountView.WallOfThisProfile.Tweets.Add(thisTweet);
                }
            }

            if (wallRetrieved.Retweets.Count > 0)
            {
                foreach (RetweetViewModel retweet in wallRetrieved.Retweets)
                {
                    RetweetView thisRetweet = new RetweetView();

                    thisRetweet.RetweetKey = retweet.RetweetKey;
                    thisRetweet.TweetKey = retweet.TweetKey;

                    thisRetweet.Text = retweet.Text;
                    thisRetweet.PublishDateTime = retweet.PublishDateTime;
                    thisRetweet.TweetPublishDateTime = retweet.TweetPublishDateTime.ToString();

                    thisRetweet.RetweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.RetweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.RetweetAuthor.BasicProfile.AccountType }, FullName = retweet.RetweetAuthor.FullName, Description1 = retweet.RetweetAuthor.Description1, Description2 = retweet.RetweetAuthor.Description2 };

                    thisRetweet.TweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.TweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.TweetAuthor.BasicProfile.AccountType }, FullName = retweet.TweetAuthor.FullName, Description1 = retweet.TweetAuthor.Description1, Description2 = retweet.TweetAuthor.Description2 };

                    accountView.WallOfThisProfile.Retweets.Add(thisRetweet);
                }
            }

            accountView.WorkContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetWorkContactsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey  ));
            accountView.PartnershipContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetPartnershipContactsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey));
            accountView.GroupsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetGroupsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey));

            accountView.WallOfThisProfile.PublishedItems = new List<ISortingCapable>();

            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Posts);
            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Tweets);
            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Retweets);

            accountView.WallOfThisProfile.PublishedItems = accountView.WallOfThisProfile.PublishedItems.OrderByDescending(x => x.PublishDateTime).ToList();

            return View("MyWall", accountView);
        }
        public ActionResult Index()
        {
            CompleteProfile  myProfile = (CompleteProfile)Session["myProfile"];

            UserAccountView accountView = new UserAccountView();

            accountView.IsThisMyOwnProfile = true;
            //accountView.WallOfThisProfile.Posts = new List<PostView>();
            //accountView.WallOfThisProfile.Tweets = new List<TweetView>();
            //accountView.WallOfThisProfile.Retweets = new List<RetweetView>();

            CompleteProfileView completeProfile = new CompleteProfileView();
            BasicProfileView basicProfile = new BasicProfileView();
            completeProfile.BasicProfile = basicProfile;
            basicProfile.ReferenceKey = myProfile.BasicProfile.ReferenceKey.ToString();
            basicProfile.AccountType = AccountType.UserAccount;
            completeProfile.FullName = myProfile.FullName;
            completeProfile.Description1 = myProfile.Description1;
            completeProfile.Description2 = myProfile.Description2;

            accountView.Profile = completeProfile;

            accountView.EmailOfThisProfile = User.Identity.Name;

            accountView.FoldersOfThisProfile = new Dictionary<string, string>();
            accountView.WallOfThisProfile = new ContentStreamView();
            accountView.WallOfThisProfile.Posts = new List<PostView>();
            accountView.WallOfThisProfile.Tweets = new List<TweetView>();
            accountView.WallOfThisProfile.Retweets = new List<RetweetView>();

            accountView.WorkContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetWorkContactsOfUserAccountByKey( myProfile.BasicProfile.ReferenceKey.ToString() ));
            accountView.PartnershipContactsOfThisProfile =Converters.ConvertFromViewModelToView(UserAccountService.GetPartnershipContactsOfUserAccountByKey( myProfile.BasicProfile.ReferenceKey.ToString()));
            accountView.GroupsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetGroupsOfUserAccountByKey(myProfile.BasicProfile.ReferenceKey.ToString()));

            //Im the owner and the viewer of the wall
            var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString();
            ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamAsNewsfeed(thisViewerKey,thisViewerKey);
            CompleteProfileViewModel myOrganizationAccount = OrganizationAccountService.GetOrganizationAccountProfileByEmployeeUserAccountKey(thisViewerKey);
            accountView.OrganizationAccountOfThisProfile = new CompleteProfileView { BasicProfile = new BasicProfileView  { ReferenceKey=myOrganizationAccount.BasicProfile.ReferenceKey, AccountType=myOrganizationAccount.BasicProfile.AccountType    }, FullName=myOrganizationAccount.FullName, Description1=myOrganizationAccount.Description1 , Description2=myOrganizationAccount.Description2  };
               // accountView.WallOfThisProfile = new ContentStreamView();
               // accountView.WallOfThisProfile.Posts = new List<PostView>();
            if (wallRetrieved.Posts.Count >0)
            {

                foreach (PostViewModel post in wallRetrieved.Posts)
                {
                    PostView thisPost = new PostView();
                    thisPost.Key = post.Key;
                    thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=post.Author.BasicProfile.ReferenceKey  , AccountType= post.Author.BasicProfile.AccountType  }, FullName=post.Author.FullName, Description1= post.Author.Description1 , Description2= post.Author.Description2  };
                    thisPost.PublishDateTime = post.PublishDateTime;
                    thisPost.Text = post.Text;
                    thisPost.Likes = post.Likes;
                    thisPost.ILikedIt = post.ILikedIt;

                    thisPost.Comments = new List<CommentView>();
                    foreach (CommentViewModel comment in post.Comments)
                    {
                        CommentView thisComment = new CommentView();
                        thisComment.Key = comment.Key;
                        thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 };
                        thisComment.Text = comment.Text;
                        thisComment.PublishDateTime = comment.PublishDateTime;
                        thisComment.Likes = comment.Likes;
                        thisComment.ILikedIt = comment.ILikedIt;
                        thisPost.Comments.Add(thisComment);
                    }

                    accountView.WallOfThisProfile.Posts.Add(thisPost);
                }
            }

            if (wallRetrieved.Tweets.Count > 0)
            {
                foreach (TweetViewModel tweet in wallRetrieved.Tweets)
                {
                    TweetView thisTweet = new TweetView();

                    thisTweet.Key = tweet.Key;
                    thisTweet.Text = tweet.Text;
                    thisTweet.PublishDateTime = tweet.PublishDateTime;
                    thisTweet.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = tweet.Author.BasicProfile.ReferenceKey, AccountType = tweet.Author.BasicProfile.AccountType }, FullName = tweet.Author.FullName, Description1 = tweet.Author.Description1, Description2 = tweet.Author.Description2 };

                    accountView.WallOfThisProfile.Tweets.Add(thisTweet);
                }
            }

            if (wallRetrieved.Retweets.Count > 0)
            {
                foreach (RetweetViewModel retweet in wallRetrieved.Retweets)
                {
                    RetweetView thisRetweet = new RetweetView();

                    thisRetweet.RetweetKey = retweet.RetweetKey;
                    thisRetweet.TweetKey = retweet.TweetKey;

                    thisRetweet.Text = retweet.Text;
                    thisRetweet.PublishDateTime = retweet.PublishDateTime;
                    thisRetweet.TweetPublishDateTime = retweet.TweetPublishDateTime.ToString();

                    thisRetweet.RetweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.RetweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.RetweetAuthor.BasicProfile.AccountType }, FullName = retweet.RetweetAuthor.FullName, Description1 = retweet.RetweetAuthor.Description1, Description2 = retweet.RetweetAuthor.Description2 };

                    thisRetweet.TweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.TweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.TweetAuthor.BasicProfile.AccountType }, FullName = retweet.TweetAuthor.FullName, Description1 = retweet.TweetAuthor.Description1, Description2 = retweet.TweetAuthor.Description2 };

                    accountView.WallOfThisProfile.Retweets.Add(thisRetweet);
                }
            }

            accountView.WallOfThisProfile.PublishedItems = new List<ISortingCapable>();

            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Posts);
            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Tweets);
            accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Retweets);

             accountView.WallOfThisProfile.PublishedItems= accountView.WallOfThisProfile.PublishedItems.OrderByDescending(x => x.PublishDateTime).ToList();

             CompleteProfileView groupView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "ACBCCE0E-7C9F-4386-99AA-1458F308EBB0", AccountType = AccountType.Group }, FullName = "Electric Providers Group" };
             CompleteProfileView coworkerView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "BCBCCE0E-7C9F-4386-98AA-1458F308E205", AccountType = AccountType.UserAccount  }, FullName = "Larry Page" };
             CompleteProfileView partnerView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "BCBCCE0E-7C9F-4386-98AA-1458F308E203", AccountType = AccountType.UserAccount }, FullName = "Allie Opper" };

             accountView.GroupSuggestion = groupView;
             accountView.PartnerSuggestion = partnerView;
             accountView.CoworkerSuggestion = coworkerView;

            return View("Newsfeed",accountView);
        }
Example #11
0
        public App()
        {
            InitializeComponent();

            MainPage = new TweetView();
        }