Example #1
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            Point mouseLocation = new Point(e.X, e.Y);
            Point itemLocation  = Point.Empty;
            Size  itemSize      = Size.Empty;

            ServerListItem item = GetItemAt(e.X, e.Y, out itemLocation, out itemSize);

            if (item != null)
            {
                bool clicked = false;
                int  startY  = 10;

                for (int j = 0; j < item.Buttons.Count && !clicked; j++)
                {
                    Rectangle buttonBounds = item.Buttons[j].GetBounds(itemLocation, itemSize);
                    buttonBounds.Y += startY;
                    clicked         = buttonBounds.Contains(mouseLocation);

                    if (clicked)
                    {
                        item.Buttons[j].OnClick(_kernel);
                    }

                    startY += 15;
                }
            }

            SelectedItem = item;
        }
Example #2
0
        private ServerListItem CreateServerListItem(Server server)
        {
            ServerListItem item = new ServerListItem(this, server);

            AddServerItemButtons(item);

            return(item);
        }
Example #3
0
        protected override void AddServerItemButtons(ServerListItem item)
        {
            item.Buttons.Add(new PlayShardListItemButton(item));
            item.Buttons.Add(new EditLocalShardListItemButton(item));
            item.Buttons.Add(new RemoveCustomShardListItemButton(item));

            if (item.Server.HasPatches)
            {
                item.Buttons.Add(new ResetPatchesListItemButton(item));
            }
        }
Example #4
0
        protected override void AddServerItemButtons(ServerListItem item)
        {
            item.Buttons.Add(new PlayShardListItemButton(item));
            item.Buttons.Add(new RemoveFavoriteShardListItemButton(item));
            item.Buttons.Add(new WebsiteListItemButton(item));

            if (item.Server.HasPatches)
            {
                item.Buttons.Add(new ResetPatchesListItemButton(item));
            }
        }
        protected override void AddServerItemButtons(ServerListItem item)
        {
            item.Buttons.Add(new PlayShardListItemButton(item));
            item.Buttons.Add(new EditLocalShardListItemButton(item));
            item.Buttons.Add(new RemoveCustomShardListItemButton(item));

            if (item.Server.HasPatches)
            {
                item.Buttons.Add(new ResetPatchesListItemButton(item));
            }
        }
Example #6
0
 public ServerListItemButton(
     string text,
     ServerListItem item,
     int pixelsFromLeft,
     int pixelsFromTop,
     Size size)
 {
     this.text = text;
     this.item = item;
     this.locationFromRight = new Point(pixelsFromLeft, pixelsFromTop);
     this.size = size;
 }
 public ServerListItemButton(
     string text, 
     ServerListItem item,
     int pixelsFromLeft,
     int pixelsFromTop, 
     Size size)
 {
     this.text = text;
     this.item = item;
     this.locationFromRight = new Point(pixelsFromLeft, pixelsFromTop);
     this.size = size;
 }
Example #8
0
        protected virtual void DrawButtons(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            int startY = 10;

            for (int i = 0; i < shardListItem.Buttons.Count; i++)
            {
                ServerListItemButton button       = shardListItem.Buttons[i];
                Rectangle            buttonBounds = button.GetBounds(bounds.Location, bounds.Size);

                buttonBounds.Y += startY;

                Color textColor;

                bool mouseDown = button.IsMouseDown;
                bool mouseOver = button.IsMouseOver;

                if (mouseDown && mouseOver)
                {
                    textColor = DefaultTextColorMouseOverSelected;
                }
                else if (mouseDown || shardListItem.IsSelected)
                {
                    textColor = DefaultTextColorSelected;
                }
                else if (mouseOver)
                {
                    textColor = DefaultTextColorMouseOver;
                }
                else
                {
                    textColor = DefaultTextColor;
                }

                g.DrawImage(mouseOver ? Properties.Resources.ArrowSelected : Properties.Resources.Arrow, new Rectangle(
                                new Point(bounds.Width - button.LocationFromRight.X - 5, bounds.Y + startY + 3),
                                new Size(5, 7)));

                Font font = new Font("Verdana", 10, FontStyle.Regular, GraphicsUnit.Pixel);

                TextFormatFlags flags = TextFormatFlags.Left |
                                        TextFormatFlags.VerticalCenter |
                                        TextFormatFlags.Internal |
                                        TextFormatFlags.WordBreak |
                                        TextFormatFlags.WordEllipsis |
                                        TextFormatFlags.GlyphOverhangPadding;

                TextRenderer.DrawText(g, button.Text, font, buttonBounds, textColor, flags);

                startY += 15;
            }
        }
Example #9
0
        public virtual void DrawServer(Graphics g, ServerListItem shardListItem, Rectangle bounds)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;

            DrawBackground(g, bounds, shardListItem);
            DrawIcon(g, bounds, shardListItem);
            DrawText(g, bounds, shardListItem);
            DrawButtons(g, bounds, shardListItem);

            if (shardListItem.Server.Public) //Favorites, Public
            {
                DrawExtendedInformation(g, bounds, shardListItem);
            }
        }
Example #10
0
        protected virtual void DrawIcon(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Image icon = DefaultShardIcon;

            if (shardListItem.Server.Public)
            {
                Server server     = shardListItem.Server;
                Image  statusIcon = null;

                //if (_storageService.WorkState == WorkState.Online)
                //{
                statusIcon = ((Status)server.Status == Status.Active) ? DefaultUpIcon : DefaultDownIcon;
                //}
                //else
                //{
                //    statusIcon = DefaultUnknownIcon;
                //}

                if (statusIcon != null)
                {
                    g.DrawImage(statusIcon, new Rectangle(bounds.Width - 21, bounds.Y + 5, 16, 16));
                }

                if (server.Data != null)
                {
                    MemoryStream ms = new MemoryStream(server.Data);
                    icon = Bitmap.FromStream(ms);
                    ms.Close();
                    ms.Dispose();
                }
            }

            if (shardListItem.Server.HasPatches)
            {
                g.DrawImage(Properties.Resources.Patch, new Rectangle(bounds.Width - 40, bounds.Y + 5, 16, 16));
            }

            icon = CreateReflection(icon, Properties.Resources.Shadow, 90, true);

            int size = shardListItem.IsSelected ? 64 : shardListItem.IsMouseOver ? 58 : 50;
            int x    = (shardListItem.IsSelected ? 72 : shardListItem.IsMouseOver ? 69 : 65) - size;

            int width  = (int)((float)icon.Width * ((float)size / (float)Math.Max(icon.Width, icon.Height)));
            int height = (int)((float)icon.Height * ((float)size / (float)Math.Max(icon.Width, icon.Height)));

            if (icon != null)
            {
                g.DrawImage(icon, new Rectangle(x, bounds.Y + bounds.Height / 2 - (size / 2), width, height));
            }
        }
Example #11
0
        protected virtual void DrawBackground(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Color color1, color2;

            bool selected  = shardListItem.IsSelected;
            bool mouseOver = shardListItem.IsMouseOver;

            if (selected && mouseOver)
            {
                color1 = FillColorTopMouseOverSelected;
                color2 = FillColorBottomMouseOverSelected;
            }
            else if (selected)
            {
                color1 = FillColorTopSelected;
                color2 = FillColorBottomSelected;
            }
            else if (mouseOver)
            {
                color1 = FillColorTopMouseOver;
                color2 = FillColorBottomMouseOver;
            }
            else
            {
                color1 = FillColorTop;
                color2 = FillColorBottom;
            }

            using (LinearGradientBrush fillBrush =
                       new LinearGradientBrush(new Point(bounds.X, bounds.Y),
                                               new Point(bounds.X, bounds.Y + bounds.Height), color1, color2))
            {
                bounds.Inflate(new Size((int)(bounds.Width * -0.005), (int)(bounds.Height * -0.025)));

                int arcSize = ArcSize;

                GraphicsPath path = new GraphicsPath();

                AddRoundedRectangle(path, bounds, arcSize);

                g.FillPath(fillBrush, path);

                using (Pen pen = new Pen(BorderPenColor))
                {
                    g.DrawPath(pen, path);
                }

                path.Dispose();
            }
        }
Example #12
0
        protected virtual void DrawExtendedInformation(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Server shard = shardListItem.Server as Server;

            if (shard != null)
            {
                Color textColor;

                bool mouseDown = shardListItem.IsSelected;
                bool mouseOver = shardListItem.IsMouseOver;

                if (mouseDown && mouseOver)
                {
                    textColor = TextStrongColorMouseOverSelected;
                }
                else if (mouseDown || shardListItem.IsSelected)
                {
                    textColor = TextStrongColorSelected;
                }
                else if (mouseOver)
                {
                    textColor = TextStrongColorMouseOver;
                }
                else
                {
                    textColor = TextStrongColor;
                }

                TextFormatFlags flags = TextFormatFlags.Left |
                                        TextFormatFlags.Top |
                                        TextFormatFlags.Internal |
                                        TextFormatFlags.WordBreak |
                                        TextFormatFlags.EndEllipsis |
                                        TextFormatFlags.WordEllipsis |
                                        TextFormatFlags.GlyphOverhangPadding;

                Rectangle textBounds = new Rectangle(bounds.X + 75, bounds.Y + bounds.Height - 17, bounds.Width - 170, 12);

                Font   font         = new Font("Verdana", 8.25f, FontStyle.Regular, GraphicsUnit.Pixel);
                string extendedInfo = String.Format("Online: {0} | Max: {1} | Avg: {2} | Type: {3} | Language: {4} | Era: {5} | UpTime: {6}% | Client Version: {7}",
                                                    shard.CurOnline, shard.MaxOnline, shard.AvgOnline, (ShardType)shard.ShardType, (Lang)shard.Lang, (Era)shard.Era,
                                                    (int)(shard.UpTime * 100), string.IsNullOrEmpty(shard.ServerClientVersion) ? "Unknown" : shard.ServerClientVersion);

                TextRenderer.DrawText(g, extendedInfo, font, textBounds, textColor, flags);

                font.Dispose();
            }
        }
        protected override void AddServerItemButtons(ServerListItem item)
        {
            item.Buttons.Add(new PlayShardListItemButton(item));

            if (!item.Server.Favorite)
            {
                item.Buttons.Add(new AddToFavoritesShardListItemButton(item));
            }

            item.Buttons.Add(new WebsiteListItemButton(item));

            if (item.Server.HasPatches)
            {
                item.Buttons.Add(new ResetPatchesListItemButton(item));
            }
        }
Example #14
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            Point mouseLocation = PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));

            Point itemLocation = Point.Empty;
            Size  itemSize     = Size.Empty;

            ServerListItem item = GetItemAt(mouseLocation.X, mouseLocation.Y, out itemLocation, out itemSize);

            SetAllItemsMouseOverFalse();

            Cursor = Cursors.Default;

            if (item != null)
            {
                item.IsMouseOver = true;
                int startY = 10;

                for (int j = 0; j < item.Buttons.Count; j++)
                {
                    Rectangle buttonBounds = item.Buttons[j].GetBounds(itemLocation, itemSize);
                    buttonBounds.Y += startY;

                    if (buttonBounds.Contains(mouseLocation))
                    {
                        Cursor = Cursors.Hand;
                        item.Buttons[j].IsMouseOver = true;

                        if (ControlHelper.IsMouseDown(MouseButtons.Left))
                        {
                            item.Buttons[j].IsMouseDown = true;
                        }
                    }

                    startY += 15;
                }
            }

            Invalidate();
        }
Example #15
0
        public void RefreshDataSource()
        {
            int scrollPos = _vScrollBar.Value;

            Server[] servers        = GetServers();
            Server   selectedServer = SelectedItem == null ? null : SelectedItem.Server;

            Items.Clear();

            _comparer.OrderBy = _orderBy;
            _comparer.Reverse = _orderByReversed;

            Array.Sort(servers, _comparer);

            for (int i = 0; i < servers.Length; i++)
            {
                Server shard = servers[i];

                if (string.IsNullOrEmpty(_filterText) ||
                    (shard.Name.ToLower().Contains(_filterText.ToLower()) || shard.Description.ToLower().Contains(_filterText.ToLower())))
                {
                    ServerListItem item = CreateServerListItem(shard);

                    Items.Add(item);

                    if (selectedServer != null && selectedServer is Server)
                    {
                        if (shard.Id == selectedServer.Id)
                        {
                            SelectedItem = item;
                        }
                    }
                }
            }

            ScrollPosition = scrollPos;
        }
Example #16
0
        protected virtual void DrawText(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Color color;
            Color nameColor;

            bool selected  = shardListItem.IsSelected;
            bool mouseOver = shardListItem.IsMouseOver;

            float nameFontSize        = FontSizeName;
            float descriptionFontSize = FontSizeDescription;

            if (selected && mouseOver)
            {
                color     = DefaultTextColorMouseOverSelected;
                nameColor = TextNameColorMouseOverSelected;
            }
            else if (selected)
            {
                color     = DefaultTextColorSelected;
                nameColor = TextNameColorMouseOver;
            }
            else if (mouseOver)
            {
                color     = DefaultTextColorMouseOver;
                nameColor = TextNameColorSelected;
            }
            else
            {
                color     = DefaultTextColor;
                nameColor = TextNameColor;
            }

            TextFormatFlags flags = TextFormatFlags.Left |
                                    TextFormatFlags.Top |
                                    TextFormatFlags.Internal |
                                    TextFormatFlags.WordBreak |
                                    TextFormatFlags.EndEllipsis |
                                    TextFormatFlags.WordEllipsis |
                                    TextFormatFlags.GlyphOverhangPadding;


            Rectangle nameBounds = new Rectangle(bounds.X + 75, (int)((float)bounds.Height * 0.075f + bounds.Y),
                                                 bounds.Width - 170, (int)(nameFontSize * 2));
            Rectangle descriptionBounds = new Rectangle(bounds.X + 75,
                                                        (int)((float)bounds.Height * 0.1f + nameFontSize + bounds.Y),
                                                        bounds.Width - 170,
                                                        (int)(descriptionFontSize * 3.85f));

            if (shardListItem.IsSelected)
            {
                SizeF descSize = MeasureDescription(g, shardListItem.Server.Description, bounds.Width);
                descriptionBounds.Height += (int)descSize.Height;
            }

            Font nameFont        = new Font("Verdana", nameFontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            Font descriptionFont = new Font("Verdana", descriptionFontSize, FontStyle.Regular, GraphicsUnit.Pixel);

            TextRenderer.DrawText(g, shardListItem.Server.Name, nameFont, nameBounds, nameColor, flags);
            TextRenderer.DrawText(g, shardListItem.Server.Description, descriptionFont, descriptionBounds, color, flags);

            nameFont.Dispose();
            descriptionFont.Dispose();
        }
 public ResetPatchesListItemButton(ServerListItem item)
     : base("Reset Patches", item, 85, 55, new Size(60, 12))
 {
 }
Example #18
0
 public ShardListItemButtonClickedEventArgs(ServerListItem item, ServerListItemButton button)
 {
     this.item   = item;
     this.button = button;
 }
        protected virtual void DrawIcon(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Image icon = DefaultShardIcon;

            if (shardListItem.Server.Public)
            {
                Server server = shardListItem.Server;
                Image statusIcon = null;

                //if (_storageService.WorkState == WorkState.Online)
                //{
                statusIcon = ((Status)server.Status == Status.Active) ? DefaultUpIcon : DefaultDownIcon;
                //}
                //else
                //{
                //    statusIcon = DefaultUnknownIcon;
                //}

                if (statusIcon != null)
                    g.DrawImage(statusIcon, new Rectangle(bounds.Width - 21, bounds.Y + 5, 16, 16));

                if (server.Data != null)
                {
                    MemoryStream ms = new MemoryStream(server.Data);
                    icon = Bitmap.FromStream(ms);
                    ms.Close();
                    ms.Dispose();
                }
            }

            if (shardListItem.Server.HasPatches)
            {
                g.DrawImage(Properties.Resources.Patch, new Rectangle(bounds.Width - 40, bounds.Y + 5, 16, 16));
            }

            icon = CreateReflection(icon, Properties.Resources.Shadow, 90, true);

            int size = shardListItem.IsSelected ? 64 : shardListItem.IsMouseOver ? 58 : 50;
            int x = (shardListItem.IsSelected ? 72 : shardListItem.IsMouseOver ? 69 : 65) - size;

            int width = (int)((float)icon.Width * ((float)size / (float)Math.Max(icon.Width, icon.Height)));
            int height = (int)((float)icon.Height * ((float)size / (float)Math.Max(icon.Width, icon.Height)));

            if (icon != null)
            {
                g.DrawImage(icon, new Rectangle(x, bounds.Y + bounds.Height / 2 - (size / 2), width, height));
            }
        }
        public virtual void DrawServer(Graphics g, ServerListItem shardListItem, Rectangle bounds)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;

            DrawBackground(g, bounds, shardListItem);
            DrawIcon(g, bounds, shardListItem);
            DrawText(g, bounds, shardListItem);
            DrawButtons(g, bounds, shardListItem);

            if (shardListItem.Server.Public) //Favorites, Public
            {
                DrawExtendedInformation(g, bounds, shardListItem);
            }
        }
Example #21
0
 public HideListItemButton(ServerListItem item)
     : base("Hide", item, 85, 55, new Size(60, 12))
 {
 }
Example #22
0
 public RemoveFavoriteShardListItemButton(ServerListItem item)
     : base("Remove", item, 85, 25, new Size(60, 12))
 {
 }
 protected abstract void AddServerItemButtons(ServerListItem server);
Example #24
0
 public ResetPatchesListItemButton(ServerListItem item)
     : base("Reset Patches", item, 85, 55, new Size(60, 12))
 {
 }
Example #25
0
 protected abstract void AddServerItemButtons(ServerListItem server);
        protected virtual void DrawButtons(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            int startY = 10;

            for(int i = 0; i < shardListItem.Buttons.Count; i++)
            {
                ServerListItemButton button = shardListItem.Buttons[i];
                Rectangle buttonBounds = button.GetBounds(bounds.Location, bounds.Size);

                buttonBounds.Y += startY;

                Color textColor;

                bool mouseDown = button.IsMouseDown;
                bool mouseOver = button.IsMouseOver;

                if (mouseDown && mouseOver)
                    textColor = DefaultTextColorMouseOverSelected;
                else if (mouseDown || shardListItem.IsSelected)
                    textColor = DefaultTextColorSelected;
                else if (mouseOver)
                    textColor = DefaultTextColorMouseOver;
                else
                    textColor = DefaultTextColor;

                g.DrawImage(mouseOver ? Properties.Resources.ArrowSelected : Properties.Resources.Arrow, new Rectangle(
                    new Point(bounds.Width - button.LocationFromRight.X - 5, bounds.Y + startY + 3),
                    new Size(5, 7)));

                Font font = new Font("Verdana", 10, FontStyle.Regular, GraphicsUnit.Pixel);

                TextFormatFlags flags = TextFormatFlags.Left |
                                        TextFormatFlags.VerticalCenter |
                                        TextFormatFlags.Internal |
                                        TextFormatFlags.WordBreak |
                                        TextFormatFlags.WordEllipsis |
                                        TextFormatFlags.GlyphOverhangPadding;

                TextRenderer.DrawText(g, button.Text, font, buttonBounds, textColor, flags);

                startY += 15;
            }
        }
 public WebsiteListItemButton(ServerListItem item)
     : base("Website", item, 85, 55, new Size(60, 12))
 {
 }
 public PlayShardListItemButton(ServerListItem item)
     : base("Play", item, 85, 10, new Size(60, 12))
 {
 }
        protected virtual void DrawText(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Color color;
            Color nameColor;

            bool selected = shardListItem.IsSelected;
            bool mouseOver = shardListItem.IsMouseOver;

            float nameFontSize = FontSizeName;
            float descriptionFontSize = FontSizeDescription;

            if (selected && mouseOver)
            {
                color = DefaultTextColorMouseOverSelected;
                nameColor = TextNameColorMouseOverSelected;
            }
            else if (selected)
            {
                color = DefaultTextColorSelected;
                nameColor = TextNameColorMouseOver;
            }
            else if (mouseOver)
            {
                color = DefaultTextColorMouseOver;
                nameColor = TextNameColorSelected;
            }
            else
            {
                color = DefaultTextColor;
                nameColor = TextNameColor;
            }

            TextFormatFlags flags = TextFormatFlags.Left |
                                    TextFormatFlags.Top |
                                    TextFormatFlags.Internal |
                                    TextFormatFlags.WordBreak |
                                    TextFormatFlags.EndEllipsis |
                                    TextFormatFlags.WordEllipsis |
                                    TextFormatFlags.GlyphOverhangPadding;

            Rectangle nameBounds = new Rectangle(bounds.X + 75, (int)((float)bounds.Height * 0.075f + bounds.Y),
                                                 bounds.Width - 170, (int)(nameFontSize * 2));
            Rectangle descriptionBounds = new Rectangle(bounds.X + 75,
                                                        (int)((float)bounds.Height * 0.1f + nameFontSize + bounds.Y),
                                                        bounds.Width - 170,
                                                        (int)(descriptionFontSize * 3.85f));
            if (shardListItem.IsSelected)
            {
                SizeF descSize = MeasureDescription(g, shardListItem.Server.Description, bounds.Width);
                descriptionBounds.Height += (int)descSize.Height;
            }

            Font nameFont = new Font("Verdana", nameFontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            Font descriptionFont = new Font("Verdana", descriptionFontSize, FontStyle.Regular, GraphicsUnit.Pixel);

            TextRenderer.DrawText(g, shardListItem.Server.Name, nameFont, nameBounds, nameColor, flags);
            TextRenderer.DrawText(g, shardListItem.Server.Description, descriptionFont, descriptionBounds, color, flags);

            nameFont.Dispose();
            descriptionFont.Dispose();
        }
Example #30
0
 public PlayShardListItemButton(ServerListItem item)
     : base("Play", item, 85, 10, new Size(60, 12))
 {
 }
 public HideListItemButton(ServerListItem item)
     : base("Hide", item, 85, 55, new Size(60, 12))
 {
 }
 public RemoveFavoriteShardListItemButton(ServerListItem item)
     : base("Remove", item, 85, 25, new Size(60, 12))
 {
 }
Example #33
0
 public EditLocalShardListItemButton(ServerListItem item)
     : base("Edit", item, 85, 40, new Size(60, 12))
 {
 }
Example #34
0
 public AddToFavoritesShardListItemButton(ServerListItem item)
     : base("Favorite", item, 85, 25, new Size(60, 12))
 {
 }
        protected virtual void DrawBackground(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Color color1, color2;

            bool selected = shardListItem.IsSelected;
            bool mouseOver = shardListItem.IsMouseOver;

            if (selected && mouseOver)
            {
                color1 = FillColorTopMouseOverSelected;
                color2 = FillColorBottomMouseOverSelected;
            }
            else if (selected)
            {
                color1 = FillColorTopSelected;
                color2 = FillColorBottomSelected;
            }
            else if (mouseOver)
            {
                color1 = FillColorTopMouseOver;
                color2 = FillColorBottomMouseOver;
            }
            else
            {
                color1 = FillColorTop;
                color2 = FillColorBottom;
            }

            using (LinearGradientBrush fillBrush =
                new LinearGradientBrush(new Point(bounds.X, bounds.Y),
                                        new Point(bounds.X, bounds.Y + bounds.Height), color1, color2))
            {
                bounds.Inflate(new Size((int)(bounds.Width * -0.005), (int)(bounds.Height * -0.025)));

                int arcSize = ArcSize;

                GraphicsPath path = new GraphicsPath();

                AddRoundedRectangle(path, bounds, arcSize);

                g.FillPath(fillBrush, path);

                using (Pen pen = new Pen(BorderPenColor))
                {
                    g.DrawPath(pen, path);
                }

                path.Dispose();
            }
        }
 public ShardListItemButtonClickedEventArgs(ServerListItem item, ServerListItemButton button)
 {
     this.item = item;
     this.button = button;
 }
        protected virtual void DrawExtendedInformation(Graphics g, Rectangle bounds, ServerListItem shardListItem)
        {
            Server shard = shardListItem.Server as Server;

            if (shard != null)
            {
                Color textColor;

                bool mouseDown = shardListItem.IsSelected;
                bool mouseOver = shardListItem.IsMouseOver;

                if (mouseDown && mouseOver)
                    textColor = TextStrongColorMouseOverSelected;
                else if (mouseDown || shardListItem.IsSelected)
                    textColor = TextStrongColorSelected;
                else if (mouseOver)
                    textColor = TextStrongColorMouseOver;
                else
                    textColor = TextStrongColor;

                TextFormatFlags flags = TextFormatFlags.Left |
                                        TextFormatFlags.Top |
                                        TextFormatFlags.Internal |
                                        TextFormatFlags.WordBreak |
                                        TextFormatFlags.EndEllipsis |
                                        TextFormatFlags.WordEllipsis |
                                        TextFormatFlags.GlyphOverhangPadding;

                Rectangle textBounds = new Rectangle(bounds.X + 75, bounds.Y + bounds.Height - 17, bounds.Width - 170, 12);

                Font font = new Font("Verdana", 8.25f, FontStyle.Regular, GraphicsUnit.Pixel);
                string extendedInfo = String.Format("Online: {0} | Max: {1} | Avg: {2} | Type: {3} | Language: {4} | Era: {5} | UpTime: {6}% | Client Version: {7}",
                    shard.CurOnline, shard.MaxOnline, shard.AvgOnline, (ShardType)shard.ShardType, (Lang)shard.Lang, (Era)shard.Era,
                    (int)(shard.UpTime * 100), string.IsNullOrEmpty(shard.ServerClientVersion) ? "Unknown" : shard.ServerClientVersion);

                TextRenderer.DrawText(g, extendedInfo, font, textBounds, textColor, flags);

                font.Dispose();
            }
        }
 public EditLocalShardListItemButton(ServerListItem item)
     : base("Edit", item, 85, 40, new Size(60, 12))
 {
 }
 public AddToFavoritesShardListItemButton(ServerListItem item)
     : base("Favorite", item, 85, 25, new Size(60, 12))
 {
 }
        private ServerListItem CreateServerListItem(Server server)
        {
            ServerListItem item = new ServerListItem(this, server);

            AddServerItemButtons(item);

            return item;
        }
Example #41
0
 public WebsiteListItemButton(ServerListItem item)
     : base("Website", item, 85, 55, new Size(60, 12))
 {
 }