Exemplo n.º 1
0
        private void AddGroupSelectMenuItem(ISpecialTimeLine t)
        {
            delMenuClicked showItemClicked = delegate()
            {
                ShowSpecialTimeLine(t, Yedda.Twitter.PagingMode.None);
            };

            GroupsMenuItem.Visible = true;
            FingerUI.Menu.SideMenuItem item = new FingerUI.Menu.SideMenuItem(showItemClicked, t.name, statList.LeftMenu, t.ListName);
            GroupsMenuItem.SubMenuItems.Add(item);
        }
Exemplo n.º 2
0
        private void SetFollowMenu()
        {
            if(ClientSettings.AccountsList.Count==1)
            {
                return;
            }
            StatusItem selectedItem = (StatusItem)statList.SelectedItem;
            if (selectedItem == null) { return; }
            if (selectedItem.Tweet.user == null) { return; }
            Yedda.Twitter Conn = GetMatchingConnection(selectedItem.Tweet.Account);

            FollowMenuItem.SubMenuItems.Clear();
            List<Yedda.Twitter.Account> MatchingAccounts = new List<Twitter.Account>();

            foreach (var account in ClientSettings.AccountsList)
            {
                if(account.Server==Conn.AccountInfo.Server)
                {
                    MatchingAccounts.Add(account);
                }
            }

            if (MatchingAccounts.Count > 1)
            {
                FollowMenuItem.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("Follow...");
                FollowMenuItem.ClickedMethod = null;
                foreach (var account in MatchingAccounts)
                {
                    var account1 = account;
                    delMenuClicked d = () => FollowUser(account1);
                    var item = new SideMenuItem(d, account.ToString(), statList.RightMenu);
                    FollowMenuItem.SubMenuItems.Add(item);
                }
                return;
            }

            delMenuClicked  followClicked = () => FollowUser(MatchingAccounts[0]);
            FollowMenuItem.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("Follow");
            FollowMenuItem.ClickedMethod = followClicked;
        }
Exemplo n.º 3
0
        private void AddAddUserToGroupMenuItem(UserGroupTimeLine t)
        {
            delMenuClicked copyItemClicked = () => AddUserToGroup(t, false);

            delMenuClicked moveItemClicked = () => AddUserToGroup(t, true);

            FingerUI.Menu.SideMenuItem copyitem = new FingerUI.Menu.SideMenuItem(copyItemClicked, t.name, statList.RightMenu);
            FingerUI.Menu.SideMenuItem moveitem = new FingerUI.Menu.SideMenuItem(moveItemClicked, t.name, statList.RightMenu);
            MoveToGroupMenuItem.SubMenuItems.Add(moveitem);
            CopyToGroupMenuItem.SubMenuItems.Add(copyitem);
        }
Exemplo n.º 4
0
        private void DrawSingleItem(int i, Graphics mBackBuffer, int offset, int currentTop, SideMenuItem item, Color menuLineColor, Color menuTextColor)
        {
            int leftPos = 0;
            string displayItem = item.Text;
            
            if (DetectDevice.DeviceType == DeviceType.Standard)
            {
                displayItem = i + ". " + displayItem;
            }

            if (_side == KListControl.SideShown.Left)
            {
                int textWidth = (int)mBackBuffer.MeasureString(displayItem, ClientSettings.MenuFont).Width + ClientSettings.Margin;
                leftPos = _width - (textWidth + 5 + offset);
            }
            else
            {
                leftPos = leftPos + ClientSettings.Margin + 5 + offset;
            }
            using (var whitePen = new Pen(menuLineColor))
            {
                Rectangle menuRect;
                menuRect = _side == KListControl.SideShown.Left ? new Rectangle(0, currentTop, _width - offset, ItemHeight) : new Rectangle(offset, currentTop, _width, ItemHeight);

                Color BackColor;
                Color GradColor;
                Color TextColor;
                if (item == SelectedItem)
                {
                    BackColor = ClientSettings.SelectedBackColor;
                    GradColor = ClientSettings.SelectedBackGradColor;
                    TextColor = ClientSettings.MenuSelectedTextColor;
                }
                else
                {
                    BackColor = ClientSettings.BackColor;
                    GradColor = ClientSettings.BackGradColor;
                    TextColor = menuTextColor;
                }
                try
                {
                    Gradient.GradientFill.Fill(mBackBuffer, menuRect, BackColor, GradColor, Gradient.GradientFill.FillDirection.TopToBottom);
                }
                catch
                {
                    using (Brush backBrush = new SolidBrush(ClientSettings.SelectedBackColor))
                    {
                        mBackBuffer.FillRectangle(backBrush, menuRect);
                    }
                }
                mBackBuffer.DrawLine(whitePen, menuRect.Left, menuRect.Top, menuRect.Right, menuRect.Top);
                using (Brush sBrush = new SolidBrush(TextColor))
                {
                    var sFormat = new StringFormat {LineAlignment = StringAlignment.Center};
                    int textTop = ((menuRect.Bottom - menuRect.Top) / 2) + menuRect.Top;
                    displayItem = displayItem.Replace("@User", "@" + _userName);
                    mBackBuffer.DrawString(displayItem, ClientSettings.MenuFont, sBrush, leftPos, textTop, sFormat);
                }
                mBackBuffer.DrawLine(whitePen, menuRect.Left, menuRect.Bottom, menuRect.Right, menuRect.Bottom);
            }
        }
Exemplo n.º 5
0
 private void DrawSubMenu(SideMenuItem item, Rectangle menuRect)
 {
     int i = 0;
     int offSet;
     if (_animationStep >= 0)
     {
         offSet = ClientSettings.TextSize - (_animationStep * _animationDelta);
     }
     else
     {
         offSet = ClientSettings.TextSize;
     }
     int itemsCount = item.SubMenuItems.Count;
     if (menuRect.Height > 0)
     {
         _topOfSubMenu = (((menuRect.Bottom - menuRect.Top) / 2) + menuRect.Top) - (itemsCount * ItemHeight / 2);
     }
     else
     {
         _topOfSubMenu = Height/2 - (itemsCount * ItemHeight / 2);
     }
     if (_topOfSubMenu < 0) { _topOfSubMenu = 0; }
     int backPedal = Height - (_topOfSubMenu + (item.SubMenuItems.Count * ItemHeight));
     if(backPedal<0)
     {
         _topOfSubMenu = _topOfSubMenu + backPedal;
     }
     int currentTop = _topOfSubMenu;
     int currentBottom = currentTop + ItemHeight;
     using (Graphics mBackBuffer = Graphics.FromImage(_rendered))
     {
         foreach (SideMenuItem subItem in item.SubMenuItems)
         {
             
             if (subItem.Visible)
             {
                 DrawSingleItem(i, mBackBuffer, offSet, currentTop, subItem, ClientSettings.LineColor, ClientSettings.MenuTextColor);
                 i++;
                 currentBottom = currentTop + ItemHeight;
                 currentTop = currentTop + ItemHeight;
                 
             }
         }
         using (var whitePen = new Pen(ClientSettings.LineColor))
         {
             if (_side == KListControl.SideShown.Left)
             {
                 mBackBuffer.DrawLine(whitePen, _width - offSet, _topOfSubMenu, _width - offSet, currentBottom);
             }
             else
             {
                 mBackBuffer.DrawLine(whitePen, offSet, _topOfSubMenu, offSet, currentBottom);
             }
         }
     }
 }
Exemplo n.º 6
0
 public void SelectUp()
 {
     List<SideMenuItem> itemsToUse = _items;
     if (ExpandedItem != null)
     {
         itemsToUse = ExpandedItem.SubMenuItems;
     }
     lock (itemsToUse)
     {
         int prevSelected = itemsToUse.IndexOf(SelectedItem);
         int nextSelected = prevSelected;
         do 
         {
             nextSelected = (nextSelected - 1) % itemsToUse.Count;
             _selectedItem = nextSelected >= 0 ? itemsToUse[nextSelected] : itemsToUse[itemsToUse.Count - 1];
             if (nextSelected == prevSelected) // we've gone all the way round without one that's visible
                 break;
         }
         while(!_selectedItem.Visible);
     }
     // stack overflow in some cases!
     /*if (!_selectedItem.Visible)
     {
         SelectUp();
     }*/
     IsDirty=true;
 }
Exemplo n.º 7
0
 public void ReplaceItem(SideMenuItem original, SideMenuItem @new)
 {
     lock (_items)
     {
         for (int i = 0; i < _items.Count; i++)
         {
             if (_items[i] == original)
             {
                 _items[i] = @new;
             }
         }
     }
     IsDirty=true;
 }
Exemplo n.º 8
0
 public void SelectUp()
 {
     List<SideMenuItem> itemsToUse = _items;
     if (ExpandedItem != null)
     {
         itemsToUse = ExpandedItem.SubMenuItems;
     }
     lock (itemsToUse)
     {
         int prevSelected = itemsToUse.IndexOf(SelectedItem);
         _selectedItem = prevSelected > 0 ? itemsToUse[prevSelected - 1] : itemsToUse[itemsToUse.Count - 1];
     }
     if (!_selectedItem.Visible)
     {
         SelectUp();
     }
     IsDirty=true;
 }
Exemplo n.º 9
0
        public void SelectByText(string itemToSelect)
        {
            List<SideMenuItem> itemsToUse = _items;
            if (ExpandedItem != null)
            {
                itemsToUse = ExpandedItem.SubMenuItems;
            }
            lock (itemsToUse)
            {
                foreach (SideMenuItem item in itemsToUse)
                {
                    if (item.Text == itemToSelect)
                    {
                        _selectedItem = item;
                        IsDirty = true;

                        break;
                    }
                }
            }
        }
Exemplo n.º 10
0
 public bool Contains(SideMenuItem itemToSeek)
 {
     lock (_items)
     {
         return _items.Contains(itemToSeek);
     }
 }
Exemplo n.º 11
0
 public void SelectDown()
 {
     List<SideMenuItem> itemsToUse = _items;
     if (ExpandedItem != null)
     {
         itemsToUse = ExpandedItem.SubMenuItems;
     }
     int prevSelected = itemsToUse.IndexOf(SelectedItem);
     lock (itemsToUse)
     {
         _selectedItem = prevSelected < itemsToUse.Count - 1 ? itemsToUse[prevSelected + 1] : itemsToUse[0];
     }
     if (!_selectedItem.Visible)
     {
         SelectDown();
     }
     IsDirty=true;
 }
Exemplo n.º 12
0
 public void RemoveItem(SideMenuItem oldItem)
 {
     lock (_items)
     {
         if (_items.Contains(oldItem))
         {
             oldItem.DoneWithClick -= ItemDoneWithClick;
             _items.Remove(oldItem);
         }
         SetMenuHeight();
     }
     IsDirty=true;
 }
Exemplo n.º 13
0
 void ItemMenuExpandedOrCollapsed(SideMenuItem sender, bool opened)
 {
     ExpandedItem = sender;
     IsDirty = true;
     NeedRedraw();
 }
Exemplo n.º 14
0
 public void InsertMenuItem(int index, SideMenuItem item)
 {
     lock (_items)
     {
         _items.Insert(index, item);
         SetMenuHeight();
     }
     IsDirty=true;
 }
Exemplo n.º 15
0
        private void CreateLeftMenu()
        {
            //BACK
            BackMenuItem = new FingerUI.Menu.SideMenuItem(this.GoBackInHistory, "Back", statList.LeftMenu);
            BackMenuItem.CanHide = true;

            //Friends
            FriendsTimeLineMenuItem = new FingerUI.Menu.SideMenuItem(this.ShowFriendsTimeLine, "Friends Timeline", statList.LeftMenu, "Friends_TimeLine");
            RefreshFriendsTimeLineMenuItem = new FingerUI.Menu.SideMenuItem(this.RefreshFriendsTimeLine, "Refresh Friends", statList.LeftMenu, "Friends_TimeLine");
            //Messages
            MessagesMenuItem = new FingerUI.Menu.SideMenuItem(this.ShowMessagesTimeLine, "Messages", statList.LeftMenu, "Messages_TimeLine");
            RefreshMessagesMenuItem = new FingerUI.Menu.SideMenuItem(this.RefreshMessagesTimeLine, "Refresh Messages", statList.LeftMenu, "Messages_TimeLine");
            //Groups
            GroupsMenuItem = new FingerUI.Menu.SideMenuItem(null, "Groups ...", statList.LeftMenu);
            GroupsMenuItem.Visible = false;

            //More
            SearchMenuItem = new FingerUI.Menu.SideMenuItem(this.TwitterSearch, "Search/Local", statList.LeftMenu);
            PublicMenuItem = new FingerUI.Menu.SideMenuItem(this.ShowPublicTimeLine, "Public Timeline", statList.LeftMenu);
            SendDirectMessagesMenuItem = new SideMenuItem(this.ShowSendDirectMessagesTimeLine, "Sent Direct Messages", statList.LeftMenu);
            ViewFavoritesMenuItem = new FingerUI.Menu.SideMenuItem(this.ShowFavorites, "View Favorites", statList.LeftMenu);
            FollowUserMenuItem = new SideMenuItem(this.FollowUserClicked, "Follow User", statList.LeftMenu);
            AboutMenuItem = new FingerUI.Menu.SideMenuItem(this.ShowAbout, "About/Feedback", statList.LeftMenu);

            OtherGlobalMenuItem = new FingerUI.Menu.SideMenuItem(null, "Other ...", statList.LeftMenu);
            OtherGlobalMenuItem.SubMenuItems.Add(SearchMenuItem);
            OtherGlobalMenuItem.SubMenuItems.Add(PublicMenuItem);
            OtherGlobalMenuItem.SubMenuItems.Add(SendDirectMessagesMenuItem);
            OtherGlobalMenuItem.SubMenuItems.Add(ViewFavoritesMenuItem);
            OtherGlobalMenuItem.SubMenuItems.Add(FollowUserMenuItem);
            OtherGlobalMenuItem.SubMenuItems.Add(AboutMenuItem);

            PostUpdateMenuItem = new FingerUI.Menu.SideMenuItem(this.SetStatus, "Post Update", statList.LeftMenu);

            delMenuClicked showAccounts = () => this.ChangeSettings(new AccountsForm());
            delMenuClicked showAdvanced = () => this.ChangeSettings(new SettingsHandler.AdvancedForm());
            delMenuClicked showAvatar = () => this.ChangeSettings(new AvatarSettings());
            delMenuClicked showNotification = () => this.ChangeSettings(new SettingsHandler.NotificationSettings());
            delMenuClicked showOther = () => this.ChangeSettings(new OtherSettings());
            delMenuClicked showUISettings = () => this.ChangeSettings(new UISettings());
            delMenuClicked showGroupSettings = () => this.ChangeSettings(new SettingsHandler.GroupManagement());
            delMenuClicked showMediaServiceSettings = () => this.ChangeSettings(new MediaService());

            WindowMenuItem = new FingerUI.Menu.SideMenuItem(null, "Window ...", statList.LeftMenu);

            FullScreenMenuItem = new FingerUI.Menu.SideMenuItem(ToggleFullScreen, "Toggle FullScreen", statList.LeftMenu);
            MinimizeMenuItem = new FingerUI.Menu.SideMenuItem(this.Minimize, "Minimize", statList.LeftMenu);
            ExitMenuItem = new FingerUI.Menu.SideMenuItem(this.ExitApplication, "Exit", statList.LeftMenu);

            WindowMenuItem.SubMenuItems.Add(FullScreenMenuItem);
            WindowMenuItem.SubMenuItems.Add(MinimizeMenuItem);

            //SettingsMenuItem = new FingerUI.Menu.SideMenuItem(this.ChangeSettings, "Settings", statList.LeftMenu);
            SettingsMenuItem = new FingerUI.Menu.SideMenuItem(null, "Settings...", statList.LeftMenu);
            AccountsSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showAccounts, "Accounts", statList.LeftMenu);
            AdvancedSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showAdvanced, "Advanced", statList.LeftMenu);
            AvatarSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showAvatar, "Avatar", statList.LeftMenu);
            GroupSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showGroupSettings, "Manage Groups", statList.LeftMenu);
            MediaServiceSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showMediaServiceSettings, "Media Service", statList.LeftMenu);
            NotificationSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showNotification, "Notifications", statList.LeftMenu);
            OtherSettingsMenuItem = new FingerUI.Menu.SideMenuItem(showOther, "Other", statList.LeftMenu);
            UISettingsMenuItem = new FingerUI.Menu.SideMenuItem(showUISettings, "UI", statList.LeftMenu);
            SettingsMenuItem.SubMenuItems.Add(AccountsSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(AvatarSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(GroupSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(MediaServiceSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(NotificationSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(UISettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(OtherSettingsMenuItem);
            SettingsMenuItem.SubMenuItems.Add(AdvancedSettingsMenuItem);

            foreach (ISpecialTimeLine t in SpecialTimeLinesRepository.GetList())
            {
                AddGroupSelectMenuItem(t);
            }

            statList.LeftMenu.ResetMenu(new FingerUI.Menu.SideMenuItem[]{BackMenuItem, FriendsTimeLineMenuItem,
                RefreshFriendsTimeLineMenuItem, MessagesMenuItem, RefreshMessagesMenuItem, GroupsMenuItem,
                OtherGlobalMenuItem, PostUpdateMenuItem, SettingsMenuItem,
                WindowMenuItem, ExitMenuItem});
        }
Exemplo n.º 16
0
 public void SelectByNumber(int number)
 {
     List<SideMenuItem> itemsToUse = _items;
     if (ExpandedItem != null)
     {
         itemsToUse = ExpandedItem.SubMenuItems;
     }
     lock (itemsToUse)
     {
         int realNum = 0;
         if (itemsToUse[0].Visible)
         {
             realNum = -1;
         }
         for (int i = 0; i < itemsToUse.Count; i++)
         {
             if (itemsToUse[i].Visible)
             {
                 realNum++;
             }
             if (realNum == number)
             {
                 _selectedItem = itemsToUse[i];
                 break;
             }
         }
     }
     IsDirty = true;
 }
Exemplo n.º 17
0
        private void CreateRightMenu()
        {
            /*
            if ((statList != null) && (statList.SelectedItem != null) && statList.SelectedItem.GetType() != typeof(StatusItem))
            {
                statList.RightMenu.ResetMenu(null);
                statList.SelectedItem.CreateRightMenu(statList.RightMenu);
                if (statList.RightMenu.Count == 0)
                    this.specificMenu.Enabled = false;
                else
                    this.specificMenu.Enabled = true;
                return;
            }
            */
            // "Show Conversation", "Reply @User", "Direct @User", "Quote",
            //   "Make Favorite", "@User TimeLine", "Profile Page", "Stop Following",
            // "Minimize"
            this.specificMenu.Enabled = true;
            ConversationMenuItem = new FingerUI.Menu.SideMenuItem(GetConversation, "Show Conversation", statList.RightMenu);
            ConversationMenuItem.CanHide = true;

            DeleteStatusMenuItem = new FingerUI.Menu.SideMenuItem(DeleteStatus, "Delete Tweet", statList.RightMenu);
            DeleteStatusMenuItem.CanHide = true;

            ResponsesMenuItem = new FingerUI.Menu.SideMenuItem(null, "Respond to @User...", statList.RightMenu);
            ResponsesMenuItem.CanHide = true;

            ReplyMenuItem = new FingerUI.Menu.SideMenuItem(SendReply, "Reply @User", statList.RightMenu);
            ReplyAllMenuItem = new FingerUI.Menu.SideMenuItem(SendReplyAll, "Reply All", statList.RightMenu);
            DirectMenuItem = new FingerUI.Menu.SideMenuItem(SendDirectMessage, "Direct @User", statList.RightMenu);

            ResponsesMenuItem.SubMenuItems.Add(ReplyMenuItem);
            ResponsesMenuItem.SubMenuItems.Add(ReplyAllMenuItem);
            ResponsesMenuItem.SubMenuItems.Add(DirectMenuItem);

            EmailMenuItem = new FingerUI.Menu.SideMenuItem(EmailThisItem, "Email Status", statList.RightMenu);
            QuoteMenuItem = new FingerUI.Menu.SideMenuItem(Quote, "Quote", statList.RightMenu);
            RetweetMenuItem = new FingerUI.Menu.SideMenuItem(Retweet, "Retweet", statList.RightMenu);
            ToggleFavoriteMenuItem = new FingerUI.Menu.SideMenuItem(ToggleFavorite, "Make Favorite", statList.RightMenu);
            UserTimelineMenuItem = new FingerUI.Menu.SideMenuItem(ShowUserTimeLine, "@User Timeline", statList.RightMenu);
            ProfilePageMenuItem = new FingerUI.Menu.SideMenuItem(ShowProfile, "@User Profile", statList.RightMenu);
            FollowMenuItem = new FingerUI.Menu.SideMenuItem(ToggleFollow, "Follow @User", statList.RightMenu);

            SendToGroupMenuItem = new FingerUI.Menu.SideMenuItem(null, "Send to Group...", statList.RightMenu);
            MoveToGroupMenuItem = new FingerUI.Menu.SideMenuItem(null, "Move to Group...", statList.RightMenu);
            CopyToGroupMenuItem = new FingerUI.Menu.SideMenuItem(null, "Copy to Group...", statList.RightMenu);

            SendToGroupMenuItem.SubMenuItems.Add(MoveToGroupMenuItem);
            SendToGroupMenuItem.SubMenuItems.Add(CopyToGroupMenuItem);

            delMenuClicked copyItemClicked = () => CreateNewGroup(false);

            delMenuClicked moveItemClicked = () => CreateNewGroup(true);

            CopyNewGroupMenuItem = new FingerUI.Menu.SideMenuItem(copyItemClicked, "New Group", statList.RightMenu);
            MoveNewGroupMenuItem = new FingerUI.Menu.SideMenuItem(moveItemClicked, "New Group", statList.RightMenu);
            MoveToGroupMenuItem.SubMenuItems.Add(MoveNewGroupMenuItem);
            CopyToGroupMenuItem.SubMenuItems.Add(CopyNewGroupMenuItem);
            foreach (UserGroupTimeLine t in SpecialTimeLinesRepository.GetList(SpecialTimeLinesRepository.TimeLineType.UserGroup))
            {
                AddAddUserToGroupMenuItem(t);
            }

            statList.RightMenu.ResetMenu(new FingerUI.Menu.SideMenuItem[]{ConversationMenuItem, DeleteStatusMenuItem, ResponsesMenuItem, QuoteMenuItem, RetweetMenuItem, EmailMenuItem, ToggleFavoriteMenuItem,
                UserTimelineMenuItem, ProfilePageMenuItem, FollowMenuItem, SendToGroupMenuItem});
        }
Exemplo n.º 18
0
 public void SelectDown()
 {
     List<SideMenuItem> itemsToUse = _items;
     if (ExpandedItem != null)
     {
         itemsToUse = ExpandedItem.SubMenuItems;
     }
     lock (itemsToUse)
     {
         int prevSelected = itemsToUse.IndexOf(SelectedItem);
         int nextSelected = prevSelected;
         do
         {
             nextSelected = (nextSelected + 1) % itemsToUse.Count;
             _selectedItem = itemsToUse[nextSelected];
             if (nextSelected == prevSelected)
                 break;
         }
         while (!_selectedItem.Visible);
     }
     /*if (!_selectedItem.Visible)
     {
         SelectDown();
     }*/
     IsDirty=true;
 }