private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            List <JsFile> selectedJsFiles = new List <JsFile>();

            foreach (var itemYear in yearsOfTweets)
            {
                selectedJsFiles.AddRange(itemYear.TweetJsFiles.Where(jsFile => jsFile.Selected == true));
            }

            if (selectedJsFiles.Count == 0)
            {
                MessageBox.Show("Please select at least one month from the twitter archive",
                                "Twitter Archive Eraser", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            var settings = ApplicationSettings.GetApplicationSettings();

            settings.JsFiles = selectedJsFiles;

            WebUtils.ReportMonthsToDelete(settings.Username,
                                          settings.SessionId.ToString(),
                                          selectedJsFiles.Select(jsFile => String.Format("{0}_{1}", jsFile.TweetYear, jsFile.TweetMonth)).ToList());

            DeleteTweets page = new DeleteTweets();

            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            page.ShowDialog();
            this.Show();
            //Application.Current.Shutdown();
        }
Пример #2
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            if (jsFiles.Count == 0)
            {
                MessageBox.Show("Please select at least one *.js file from the twitter archive",
                                "Twitter Archive Eraser", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            List <string> files = new List <string>();

            foreach (var item in jsFiles)
            {
                files.Add(item.Path);
            }

            Application.Current.Properties["jsFiles"] = files;

            DeleteTweets page = new DeleteTweets();

            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            page.ShowDialog();
            this.Show();
            //Application.Current.Shutdown();
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            List <JsFile> selectedJsFiles = new List <JsFile>();

            foreach (var group in jsFilesGroupList)
            {
                selectedJsFiles.AddRange(group.JsFiles.Where(jsFile => jsFile.Selected == true));
            }

            if (selectedJsFiles.Count == 0)
            {
                MessageBox.Show("Please select at least one month from the twitter archive",
                                "Twitter Archive Eraser", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            var settings = ApplicationSettings.GetApplicationSettings();

            settings.JsFiles = selectedJsFiles;

            DeleteTweets page = new DeleteTweets();

            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            page.ShowDialog();
            this.Show();
            //Application.Current.Shutdown();
        }
Пример #4
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            isQueryingTwitter  = false;
            btnFetch.IsEnabled = false;

            if (dmsTweetList.Count == 0 && favsTweetList.Count == 0)
            {
                MessageBox.Show("No tweets to delete! Please click start to fetch tweets.", "Twitter Archive Eraser");
                btnFetch.IsEnabled = true;
                return;
            }

            DeleteTweets page = new DeleteTweets();

            if (TweetsEraseType == ApplicationSettings.EraseTypes.Favorites)
            {
                page.SetTweetsList(favsTweetList.Select(t => new Tweet()
                {
                    ID       = t.StatusID.ToString(),
                    Username = "******" + t.User.Name,
                    Text     = t.Text,
                    ToErase  = true,
                    Type     = TweetType.Favorite,
                    Date     = DateTime.SpecifyKind(t.CreatedAt, DateTimeKind.Local)
                }));
            }

            if (TweetsEraseType == ApplicationSettings.EraseTypes.DirectMessages)
            {
                page.SetTweetsList(dmsTweetList.Select(t => new Tweet()
                {
                    ID       = t.IDResponse.ToString(),
                    Username = t.Type == DirectMessageType.SentBy ? "[To] @" + t.RecipientScreenName : "[From] @" + t.SenderScreenName,
                    Text     = t.Text,
                    ToErase  = true,
                    Type     = TweetType.DM,
                    Date     = DateTime.SpecifyKind(t.CreatedAt, DateTimeKind.Local)
                }));
            }

            // Free memory
            dmsTweetList.Clear();
            favsTweetList.Clear();
            dmsTweetList  = null;
            favsTweetList = null;

            page.areTweetsFetchedThroughAPI = true;

            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            ApplicationSettings.GetApplicationSettings().TotalRunningMillisec = stopWatch.ElapsedMilliseconds;

            stopWatch.Reset();

            page.ShowDialog();
            this.Show();
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            List<JsFile> selectedJsFiles = new List<JsFile>();
            foreach (var itemYear in yearsOfTweets)
            {
                selectedJsFiles.AddRange(itemYear.TweetJsFiles.Where(jsFile => jsFile.Selected == true));
            }

            if (selectedJsFiles.Count == 0)
            {
                MessageBox.Show("Please select at least one *.js file from the twitter archive",
                                "Twitter Archive Eraser", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            Application.Current.Properties["jsFiles"] = selectedJsFiles;

            WebUtils.ReportMonthsToDelete((string)Application.Current.Properties["userName"],
                                          (string)Application.Current.Properties["sessionGUID"],
                                          selectedJsFiles.Select(jsFile => String.Format("{0}_{1}", jsFile.TweetYear, jsFile.TweetMonth)).ToList());

            DeleteTweets page = new DeleteTweets();
            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            page.ShowDialog();
            this.Show();
            //Application.Current.Shutdown();
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            isQueryingTwitter = false;
            btnFetch.IsEnabled = false;

            if(dmsTweetList.Count == 0 && favsTweetList.Count == 0)
            {
                MessageBox.Show("No tweets to delete! Please click start to fetch tweets.", "Twitter Archive Eraser");
                btnFetch.IsEnabled = true;
                return;
            }

            DeleteTweets page = new DeleteTweets();

            if (TweetsEraseType == ApplicationSettings.EraseTypes.Favorites)
            {
                page.SetTweetsList(favsTweetList.Select(t => new Tweet()
                {
                    ID = t.StatusID.ToString(),
                    Username = "******" + t.User.Name,
                    Text = t.Text,
                    ToErase = true,
                    Type = TweetType.Favorite,
                    Date = DateTime.SpecifyKind(t.CreatedAt, DateTimeKind.Local)
                }));
            }

            if(TweetsEraseType == ApplicationSettings.EraseTypes.DirectMessages)
            {
                page.SetTweetsList(dmsTweetList.Select(t => new Tweet()
                {
                    ID = t.IDResponse.ToString(),
                    Username = t.Type == DirectMessageType.SentBy ? "[To] @" + t.RecipientScreenName : "[From] @" + t.SenderScreenName,
                    Text = t.Text,
                    ToErase = true,
                    Type = TweetType.DM,
                    Date = DateTime.SpecifyKind(t.CreatedAt, DateTimeKind.Local)
                }));
            }

            // Free memory
            dmsTweetList.Clear();
            favsTweetList.Clear();
            dmsTweetList = null;
            favsTweetList = null;

            page.areTweetsFetchedThroughAPI = true;

            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            ApplicationSettings.GetApplicationSettings().TotalRunningMillisec = stopWatch.ElapsedMilliseconds;

            stopWatch.Reset();

            page.ShowDialog();
            this.Show();
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            List<JsFile> selectedJsFiles = new List<JsFile>();
            foreach (var group in jsFilesGroupList)
            {
                selectedJsFiles.AddRange(group.JsFiles.Where(jsFile => jsFile.Selected == true));
            }

            if (selectedJsFiles.Count == 0)
            {
                MessageBox.Show("Please select at least one month from the twitter archive",
                                "Twitter Archive Eraser", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            var settings = ApplicationSettings.GetApplicationSettings();
            settings.JsFiles = selectedJsFiles;

            WebUtils.ReportMonthsToDelete(settings.Username,
                                          settings.SessionId.ToString(),
                                          selectedJsFiles.Select(jsFile => String.Format("{0}_{1}", jsFile.Year, jsFile.Month)).ToList());

            DeleteTweets page = new DeleteTweets();
            this.Hide();
            page.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            page.ShowDialog();
            this.Show();
            //Application.Current.Shutdown();
        }