示例#1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _twitterSettings = Helper.LoadSetting <TwitterAccess>(Constants.TwitterAccess);
            if (_twitterSettings == null)
            {
                return;
            }

            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = !String.IsNullOrEmpty(_twitterSettings.AccessToken) && !String.IsNullOrEmpty(_twitterSettings.AccessTokenSecret);

            var detailItem = Helper.LoadSetting <TweetPageData>(Constants.TweetPageFileName);

            if (detailItem != null)
            {
                TweetTextBox.Content = detailItem.Tweet;

                var tweetPage = new TweetPageData
                {
                    Tweet = ""
                };

                // Save the detailpage object which the detailpage will load up
                Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);
            }
        }
示例#2
0
        private void SendDirectMessageClick(object sender, EventArgs e)
        {
            var tweetPage = new TweetPageData
            {
                Tweet = String.Format("d {0} ", _detailItem.UserName),
            };

            Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);

            NavigationService.Navigate(new Uri("/Pages/TweetPage.xaml", UriKind.Relative));
        }
示例#3
0
        private void ReplyClick(object sender, EventArgs e)
        {
            var tweetPage = new TweetPageData
            {
                Tweet = String.Format("@{0} ", _detailItem.UserName)
            };

            // Save the detailpage object which the detailpage will load up
            Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);

            NavigationService.Navigate(new Uri("/Pages/TweetPage.xaml", UriKind.Relative));
        }
        private void ApplicationBarMenuItem_Click_2(object sender, EventArgs e)
        {
            var twitterSettings = Helper.LoadSetting<TwitterAccess>(Constants.TwitterAccess);

            if (_firstLaunch && (twitterSettings == null ||
                String.IsNullOrEmpty(twitterSettings.AccessToken) ||
                String.IsNullOrEmpty(twitterSettings.AccessTokenSecret)))
            {
                _firstLaunch = false;

                NavigationService.Navigate(new Uri("/SecondaryViews/TwitterAuthPage.xaml", UriKind.Relative));
                return;
            }

            _firstLaunch = false;

            var tweetPage = new TweetPageData
            {
                Tweet = String.Format("{0} {1} #osarena", emailTitle, feedUrl)
            };

            // Save the detailpage object which the detailpage will load up
            Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);

            NavigationService.Navigate(new Uri("/SecondaryViews/TweetPage.xaml", UriKind.Relative));
        }
        private void listSelectionChanged(string from, string message)
        {
            if (listBox1.SelectedItems.Count != 0)
            {
                var twitterSettings = Helper.LoadSetting<TwitterAccess>(Constants.TwitterAccess);

                if (_firstLaunch && (twitterSettings == null ||
                    String.IsNullOrEmpty(twitterSettings.AccessToken) ||
                    String.IsNullOrEmpty(twitterSettings.AccessTokenSecret)))
                {
                    _firstLaunch = false;

                    NavigationService.Navigate(new Uri("/SecondaryViews/TwitterAuthPage.xaml", UriKind.Relative));
                    return;
                }

                _firstLaunch = false;

                try
                {
                    var tweetPage = new TweetPageData
                    {
                        Tweet = String.Format("RT @" + from + " " + message)
                    };

                    Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);

                    NavigationService.Navigate(new
                        Uri("/SecondaryViews/TweetPage.xaml?item="
                        + listBox1.SelectedIndex,
                        UriKind.Relative));
                }
                catch { }
            }
        }
        private void listBox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listBox2.SelectedItems.Count != 0)
            {
                string string1 = (e.AddedItems[0]
                       as WP7_FeedReader.osarena.TwitterItem).Message;

                var twitterSettings = Helper.LoadSetting<TwitterAccess>(Constants.TwitterAccess);

                if (_firstLaunch && (twitterSettings == null ||
                    String.IsNullOrEmpty(twitterSettings.AccessToken) ||
                    String.IsNullOrEmpty(twitterSettings.AccessTokenSecret)))
                {
                    _firstLaunch = false;

                    NavigationService.Navigate(new Uri("/SecondaryViews/TwitterAuthPage.xaml", UriKind.Relative));
                    return;
                }

                _firstLaunch = false;

                try
                {
                    var tweetPage = new TweetPageData
                    {
                        Tweet = String.Format("RT @cerebrux " + string1)
                    };

                    Helper.SaveSetting(Constants.TweetPageFileName, tweetPage);

                    NavigationService.Navigate(new
                        Uri("/SecondaryViews/TweetPage.xaml?item="
                        + listBox1.SelectedIndex,
                        UriKind.Relative));
                }
                catch
                {
            #if DEBUG
                    //MessageBox.Show("An error has occured");
            #endif
                }
            }
            else
            {
            #if DEBUG
                //MessageBox.Show("Error listbox index < 0");
            #endif
            }

            listBox2.SelectedIndex = -1; //Do NOT remove
        }