public CategoryTabItem(string name, double headerWidth, double headerHeight, Brush headerTextBrush, TweetsPanelControl tweetsPanel)
            : base()
        {
            // keep references to useful fields
            _name = name;
            _tweetsPanel = tweetsPanel;

            // create tab's context menu
            ContextMenu = new ContextMenu();
            MenuItem edit = new MenuItem { Header = "Edit" };
            edit.Click += new RoutedEventHandler(OnEditClick);
            ContextMenu.Items.Add(edit);

            // setup tab header's grid
            Grid headerGrid = new Grid
            {
                Width = headerWidth,
                Height = headerHeight,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                Background = Brushes.Transparent,
                ToolTip = "Right click to edit"
            };
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) });
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

            // close category name button
            _closeButton = new Button
            {
                Content = new TextBlock { Text = "X", Foreground = headerTextBrush },
                Width = 15,
                Height = 15,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Center,
                Cursor = Cursors.Hand,
                ToolTip = "Remove Category"
            };
            _closeButton.Click += new RoutedEventHandler(OnClose);
            Grid.SetColumn(_closeButton, 1);

            // category name textblock
            TextBlock label = new TextBlock
            {
                Text = name,
                Foreground = headerTextBrush,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center
            };
            Grid.SetColumn(label, 0);

            // setup tab
            headerGrid.Children.Add(label);
            headerGrid.Children.Add(_closeButton);
            Header = headerGrid;
            Content = tweetsPanel;
        }
Example #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 14 "..\..\Window1.xaml"
     ((DigiFlare.DigiTweet.UI.Window1)(target)).Closed += new System.EventHandler(this.window_Closed);
     
     #line default
     #line hidden
     
     #line 15 "..\..\Window1.xaml"
     ((DigiFlare.DigiTweet.UI.Window1)(target)).StateChanged += new System.EventHandler(this.window_StateChanged);
     
     #line default
     #line hidden
     return;
     case 2:
     this.LoginView = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.ucLogin = ((DigiFlare.DigiTweet.UI.LoginControl)(target));
     return;
     case 4:
     this.MainView = ((System.Windows.Controls.Grid)(target));
     return;
     case 5:
     this.Background = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 6:
     this.MainPane = ((System.Windows.Controls.DockPanel)(target));
     return;
     case 7:
     this.HeaderPane = ((System.Windows.Controls.Grid)(target));
     return;
     case 8:
     this.HeaderBackg = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 9:
     this.HeaderBackgShd = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 10:
     this.Title = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 11:
     this.txtLoading = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 12:
     this.Home = ((System.Windows.Controls.Button)(target));
     
     #line 66 "..\..\Window1.xaml"
     this.Home.Click += new System.Windows.RoutedEventHandler(this.btnHome_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     this.Tweet = ((System.Windows.Controls.Button)(target));
     
     #line 73 "..\..\Window1.xaml"
     this.Tweet.Click += new System.Windows.RoutedEventHandler(this.btnTweet_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.Tweets = ((System.Windows.Controls.Button)(target));
     
     #line 78 "..\..\Window1.xaml"
     this.Tweets.Click += new System.Windows.RoutedEventHandler(this.btnTweets_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.Reply = ((System.Windows.Controls.Button)(target));
     
     #line 79 "..\..\Window1.xaml"
     this.Reply.Click += new System.Windows.RoutedEventHandler(this.btnReplies_Click);
     
     #line default
     #line hidden
     return;
     case 16:
     this.DM = ((System.Windows.Controls.Button)(target));
     
     #line 80 "..\..\Window1.xaml"
     this.DM.Click += new System.Windows.RoutedEventHandler(this.btnDirectMessages_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this.Profile = ((System.Windows.Controls.Button)(target));
     
     #line 81 "..\..\Window1.xaml"
     this.Profile.Click += new System.Windows.RoutedEventHandler(this.btnProfile_Click);
     
     #line default
     #line hidden
     return;
     case 18:
     this.btnRefresh = ((System.Windows.Controls.Button)(target));
     
     #line 85 "..\..\Window1.xaml"
     this.btnRefresh.Click += new System.Windows.RoutedEventHandler(this.btnRefresh_Click);
     
     #line default
     #line hidden
     return;
     case 19:
     this.Options = ((System.Windows.Controls.Button)(target));
     
     #line 86 "..\..\Window1.xaml"
     this.Options.Click += new System.Windows.RoutedEventHandler(this.btnOptions_Click);
     
     #line default
     #line hidden
     return;
     case 20:
     this.Logout = ((System.Windows.Controls.Button)(target));
     
     #line 87 "..\..\Window1.xaml"
     this.Logout.Click += new System.Windows.RoutedEventHandler(this.btnLogout_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this.SliderPane = ((System.Windows.Controls.Grid)(target));
     return;
     case 22:
     this.SlideLeftGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 23:
     this.txtTweet = ((System.Windows.Controls.TextBox)(target));
     
     #line 116 "..\..\Window1.xaml"
     this.txtTweet.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtTweet_KeyDown);
     
     #line default
     #line hidden
     return;
     case 24:
     this.txtUrl = ((System.Windows.Controls.TextBox)(target));
     return;
     case 25:
     this.btnTinyUrl = ((System.Windows.Controls.Button)(target));
     
     #line 125 "..\..\Window1.xaml"
     this.btnTinyUrl.Click += new System.Windows.RoutedEventHandler(this.btnTinyUrl_Click);
     
     #line default
     #line hidden
     return;
     case 26:
     this.btnTwitPic = ((System.Windows.Controls.Button)(target));
     
     #line 128 "..\..\Window1.xaml"
     this.btnTwitPic.Click += new System.Windows.RoutedEventHandler(this.btnTwitPic_Click);
     
     #line default
     #line hidden
     return;
     case 27:
     this.btnSend = ((System.Windows.Controls.Button)(target));
     
     #line 135 "..\..\Window1.xaml"
     this.btnSend.Click += new System.Windows.RoutedEventHandler(this.btnSend_Click);
     
     #line default
     #line hidden
     return;
     case 28:
     this.btnCloseSlider = ((System.Windows.Controls.Button)(target));
     
     #line 137 "..\..\Window1.xaml"
     this.btnCloseSlider.Click += new System.Windows.RoutedEventHandler(this.btnCloseSlider_Click);
     
     #line default
     #line hidden
     return;
     case 29:
     this.ContentPane = ((System.Windows.Controls.Grid)(target));
     return;
     case 30:
     this.ddphMain = ((Blacklight.Controls.DragDockPanelHost)(target));
     return;
     case 31:
     this.ddpAllTweets = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 32:
     this.txtTweetsLoading = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 33:
     this.icAllTweets = ((DigiFlare.DigiTweet.UI.TweetsPanelControl)(target));
     return;
     case 34:
     this.ddpReplies = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 35:
     this.txtRepliesLoading = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 36:
     this.icAllReplies = ((DigiFlare.DigiTweet.UI.TweetsPanelControl)(target));
     return;
     case 37:
     this.ddpDirectMessages = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 38:
     this.txtDirectMessagesLoading = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 39:
     this.icDirectMessages = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 44:
     this.ddpProfile = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 45:
     
     #line 327 "..\..\Window1.xaml"
     ((System.Windows.Controls.Image)(target)).ContextMenuOpening += new System.Windows.Controls.ContextMenuEventHandler(this.ProfileAvatar_ContextMenuOpening);
     
     #line default
     #line hidden
     return;
     case 46:
     this.btnFollow = ((System.Windows.Controls.Button)(target));
     
     #line 332 "..\..\Window1.xaml"
     this.btnFollow.Click += new System.Windows.RoutedEventHandler(this.btnFollow_Click);
     
     #line default
     #line hidden
     return;
     case 47:
     this.txtUserProfileUrl = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 48:
     this.icUserTweets = ((DigiFlare.DigiTweet.UI.TweetsPanelControl)(target));
     return;
     case 49:
     this.ddpCategories = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 50:
     this.tcCategories = ((System.Windows.Controls.TabControl)(target));
     return;
     case 51:
     this.txtFriendsLoading = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 52:
     this.icFriends = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 54:
     this.tabFavourites = ((System.Windows.Controls.TabItem)(target));
     return;
     case 55:
     this.icAllFavourites = ((DigiFlare.DigiTweet.UI.TweetsPanelControl)(target));
     return;
     case 56:
     this.tabEdit = ((System.Windows.Controls.TabItem)(target));
     return;
     case 57:
     this.txtCategoryName = ((System.Windows.Controls.TextBox)(target));
     return;
     case 58:
     this.lbFollowing = ((System.Windows.Controls.ListBox)(target));
     return;
     case 59:
     this.txtCategoryColor = ((System.Windows.Controls.TextBox)(target));
     return;
     case 60:
     this.btnColorPicker = ((System.Windows.Controls.Button)(target));
     
     #line 562 "..\..\Window1.xaml"
     this.btnColorPicker.Click += new System.Windows.RoutedEventHandler(this.btnColorPicker_Click);
     
     #line default
     #line hidden
     return;
     case 61:
     this.btnSaveCategory = ((System.Windows.Controls.Button)(target));
     
     #line 569 "..\..\Window1.xaml"
     this.btnSaveCategory.Click += new System.Windows.RoutedEventHandler(this.btnSaveCategory_Click);
     
     #line default
     #line hidden
     return;
     case 62:
     this.ddpSearch = ((Blacklight.Controls.DragDockPanel)(target));
     return;
     case 63:
     this.tbSearch = ((System.Windows.Controls.TextBox)(target));
     
     #line 594 "..\..\Window1.xaml"
     this.tbSearch.KeyDown += new System.Windows.Input.KeyEventHandler(this.tbSearch_KeyDown);
     
     #line default
     #line hidden
     return;
     case 64:
     this.btnSearch = ((System.Windows.Controls.Button)(target));
     
     #line 597 "..\..\Window1.xaml"
     this.btnSearch.Click += new System.Windows.RoutedEventHandler(this.btnSearch_Click);
     
     #line default
     #line hidden
     return;
     case 65:
     this.tcSearches = ((System.Windows.Controls.TabControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
 public void Dispose()
 {
     _tweetsPanel.Dispose();
     _tweetsPanel = null;
 }
Example #4
0
 private CategoryTabItem CreateCategoryTab(string name, TweetsPanelControl content)
 {
     CategoryTabItem tab = new CategoryTabItem(name, 90, 30, Brushes.White, content);
     tab.Style = FindResource("GenericTabItem") as Style;
     tab.CloseButtonStyle = FindResource("GenericButton") as Style;
     tab.EditClick += new RoutedEventHandler(tabEdit_Click);
     tab.Close += new RoutedEventHandler(tabClose_Click);
     return tab;
 }
Example #5
0
        private CategoryTabItem CreateCategory(string categoryName, IList<string> userNames, string color)
        {
            // init tweets panel control for category
            TweetsPanelControl tweetsPanel = new TweetsPanelControl();
            tweetsPanel.IsShowMoreButton = Visibility.Collapsed;
            tweetsPanel.AvatarClicked += new MouseButtonEventHandler(imgAvatar_MouseDown);
            tweetsPanel.TweetTextLoaded += new RoutedEventHandler(TextBlock_Loaded);
            tweetsPanel.ReplyClicked += new RoutedEventHandler(btnReply_Click);
            tweetsPanel.DirectMessageClicked += new RoutedEventHandler(btnDirectMessage_Click);
            tweetsPanel.RetweetClicked += new RoutedEventHandler(btnRetweet_Click);
            tweetsPanel.DeleteClicked += new RoutedEventHandler(btnDelete_Click);
            tweetsPanel.FavouriteClicked += new RoutedEventHandler(cbFavourite_Click);

            // init category items source
            tweetsPanel.ItemsSource = CategoriesManager.GetCategoryView(categoryName);
            CollectionViewSource.GetDefaultView(tweetsPanel.ItemsSource).Refresh();

            // create category tab
            return CreateCategoryTab(categoryName, tweetsPanel);
        }
Example #6
0
        void ucLogin_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            // retrieve logged in user
            ExtendedUser loggedInUser = e.LoggedInUser;

            // apply user settings after login completed
            UserSetting setting = ConfigurationManager.Default.GetUserSetting(loggedInUser.ScreenName);
            Left = setting.WindowLocation.X;
            Top = setting.WindowLocation.Y;
            Width = setting.WindowSize.Width;
            Height = setting.WindowSize.Height;
            _timerInterval = setting.RefreshTimerInterval;
            _isWebPagePreviewEnabled = setting.IsWebPagePreviewEnabled;

            // show twitter main view
            LoginView.Visibility = Visibility.Hidden;
            MainView.Visibility = Visibility.Visible;

            // init twitter application logic
            _twitter = new TwitterApp(e.Username, e.Password, loggedInUser);

            // hook up twitter app event handlers
            _twitter.TinyUrlCompleted += new TwitterApp.TinyUrlCompletedHandler(TinyUrlCompleted);
            _twitter.TwitPicCompleted += new TwitterApp.TwitPicCompletedHandler(TwitPicCompleted);
            _twitter.TweetsManager.TweetsManagerOperationCompleted += new TweetsManager.TweetsManagerCompletedHandler(TweetsManager_OperationCompleted);
            _twitter.TweetsManager.OperationError += new BaseCollectionManager<Status>.OperationErrorHandler(Twitter_OperationError);
            _twitter.RepliesManager.OperationCompleted += new BaseCollectionManager<Status>.OperationCompletedHandler(RepliesManager_OperationCompleted);
            _twitter.RepliesManager.OperationError += new BaseCollectionManager<Status>.OperationErrorHandler(Twitter_OperationError);
            _twitter.DirectMessageManager.OperationCompleted += new BaseCollectionManager<DirectMessage>.OperationCompletedHandler(DirectMessagesManager_OperationCompleted);
            _twitter.DirectMessageManager.OperationError += new BaseCollectionManager<DirectMessage>.OperationErrorHandler(Twitter_OperationError);
            _twitter.UserProfileManager.UserProfileOperationCompleted += new UserProfileManager.UserProfileOperationCompletedHandler(UserProfileOperationCompleted);
            _twitter.UserProfileManager.OperationError += new BaseManager.OperationErrorHandler(Twitter_OperationError);
            _twitter.FriendsManager.OperationCompleted += new BaseManager.OperationCompletedHandler(FriendsManager_OperationCompleted);
            _twitter.FriendsManager.OperationError += new BaseManager.OperationErrorHandler(Twitter_OperationError);
            //_twitter.SearchManager.OperationCompleted += new BaseManager.OperationCompletedHandler(SearchManager_OperationCompleted);
            //_twitter.SearchManager.OperationError += new BaseManager.OperationErrorHandler(SearchManager_OperationError);
            //_twitter.SavedSearchesManager.Initialize(
            //    ConfigurationManager.Default.SavedSearches,
            //    SearchManager_OperationCompleted,
            //    SearchManager_OperationError);
            _twitter.FavouritesManager.OperationCompleted += new BaseManager.OperationCompletedHandler(FavouritesManager_OperationCompleted);
            _twitter.FavouritesManager.OperationError += new BaseManager.OperationErrorHandler(FavouritesManager_OperationError);

            // create system tray icon
            _trayIcon = new System.Windows.Forms.NotifyIcon();
            _trayIcon.Icon = new System.Drawing.Icon(@"Images\tray.ico");
            _trayIcon.Click += new EventHandler(trayIcon_Click);
            _trayIcon.Visible = true;

            // set data context and data source
            SelectedUser = loggedInUser;
            ddpProfile.DataContext = this;
            icAllTweets.ItemsSource = AllTweets;
            icAllReplies.ItemsSource = AllReplies;
            icDirectMessages.ItemsSource = AllDirectMessages;
            icFriends.ItemsSource = AllFriends;
            icUserTweets.ItemsSource = SelectedUserTweets;
            icAllFavourites.ItemsSource = AllFavourites;
            lbFollowing.ItemsSource = AllFriends;

            // get data from twitter api
            _twitter.TweetsManager.RefreshAllAsync();
            _twitter.RepliesManager.RefreshAllAsync();
            _twitter.DirectMessageManager.RefreshAllAsync();
            _twitter.UserProfileManager.GetUserDetailsAsync(LoggedInUser.Id);
            _twitter.FriendsManager.GetFriendsAsync();
            _twitter.FavouritesManager.GetFavouritesAsync();

            // init categories manager and create tab for each categories
            CategoriesManager.Initialize(loggedInUser.ScreenName, AllTweets);
            foreach (string categoryName in CategoriesManager.GetCategoryNames())
            {
                // init tweets panel control for category
                TweetsPanelControl tweetsPanel = new TweetsPanelControl();
                tweetsPanel.ItemsSource = CategoriesManager.GetCategoryView(categoryName);
                tweetsPanel.IsShowMoreButton = Visibility.Collapsed;
                tweetsPanel.AvatarClicked += new MouseButtonEventHandler(imgAvatar_MouseDown);
                tweetsPanel.TweetTextLoaded += new RoutedEventHandler(TextBlock_Loaded);
                tweetsPanel.ReplyClicked += new RoutedEventHandler(btnReply_Click);
                tweetsPanel.DirectMessageClicked += new RoutedEventHandler(btnDirectMessage_Click);
                tweetsPanel.RetweetClicked += new RoutedEventHandler(btnRetweet_Click);
                tweetsPanel.DeleteClicked += new RoutedEventHandler(btnDelete_Click);
                tweetsPanel.FavouriteClicked += new RoutedEventHandler(cbFavourite_Click);

                // init tab for cateogry
                CategoryTabItem tab = CreateCategoryTab(categoryName, tweetsPanel);

                // add tab to tab host
                tcCategories.Items.Insert(tcCategories.Items.Count - 1, tab);
            }

            // load saved searches
            foreach (string keyword in ConfigurationManager.Default.SavedSearches)
            {
                TabItem searchTab = CreateSearch(keyword);
                tcSearches.Items.Add(searchTab);
                tcSearches.SelectedItem = searchTab;
            }
            tcSearches.SelectedIndex = 0;

            // init refresh timer
            _timer  = new Timer(
                new TimerCallback(RefreshTimer),
                null,
                TimeSpan.FromSeconds((double)_timerInterval),
                TimeSpan.FromSeconds((double)_timerInterval));

            // init notification window
            _notififcation = new AlertWindow();

            // init url preview control
            _browser = new WebPagePreviewControl();
            _browser.Owner = this;

            // make sure unhandled exceptions will not crash app
            Application.Current.Dispatcher.UnhandledException += new DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException);
        }
Example #7
0
        public CategoryTabItem(string name, double headerWidth, double headerHeight, Brush headerTextBrush, TweetsPanelControl tweetsPanel)
            : base()
        {
            // keep references to useful fields
            _name        = name;
            _tweetsPanel = tweetsPanel;

            // create tab's context menu
            ContextMenu = new ContextMenu();
            MenuItem edit = new MenuItem {
                Header = "Edit"
            };

            edit.Click += new RoutedEventHandler(OnEditClick);
            ContextMenu.Items.Add(edit);

            // setup tab header's grid
            Grid headerGrid = new Grid
            {
                Width  = headerWidth,
                Height = headerHeight,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                Background          = Brushes.Transparent,
                ToolTip             = "Right click to edit"
            };

            headerGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(4, GridUnitType.Star)
            });
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            // close category name button
            _closeButton = new Button
            {
                Content = new TextBlock {
                    Text = "X", Foreground = headerTextBrush
                },
                Width  = 15,
                Height = 15,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Center,
                Cursor  = Cursors.Hand,
                ToolTip = "Remove Category"
            };
            _closeButton.Click += new RoutedEventHandler(OnClose);
            Grid.SetColumn(_closeButton, 1);

            // category name textblock
            TextBlock label = new TextBlock
            {
                Text                = name,
                Foreground          = headerTextBrush,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center
            };

            Grid.SetColumn(label, 0);

            // setup tab
            headerGrid.Children.Add(label);
            headerGrid.Children.Add(_closeButton);
            Header  = headerGrid;
            Content = tweetsPanel;
        }
Example #8
0
 public void Dispose()
 {
     _tweetsPanel.Dispose();
     _tweetsPanel = null;
 }