Ejemplo n.º 1
0
        public void Reflow( )
        {
            // Create the buttons for each site.
            List<SiteButton> newLayout = new List<SiteButton>( );
            int x = Padding.Left, y = Padding.Top;
            foreach ( Website site in getSortedList( ) )
            {
                SiteButton button = new SiteButton( site );
                button.ContextMenuStrip = siteButtonMenu;

                // Start a new row if needed.
                if ( x + button.Width > Width - Padding.Right )
                {
                    x = Padding.Left;
                    y += button.Height + 10;
                }

                button.Left = x;
                button.Top = y;

                x += button.Width + 10;
                newLayout.Add( button );
            }

            if ( isLayoutDifferent( newLayout ) )
            {
                foreach ( SiteButton b in Buttons )
                    Controls.Remove( b );

                Buttons = newLayout;

                foreach ( SiteButton b in Buttons )
                    Controls.Add( b );

            }
        }
Ejemplo n.º 2
0
 public void Remove( SiteButton button )
 {
     Configuration.Instance.Sites.Remove( button.Website );
     Reflow( );
 }