Exemplo n.º 1
0
 public new void GetIsTooltipRequired(GoogleDesktopDisplayTarget target,
 Int32 dc,
 ref GoogleDesktopDisplayLib.tagRECT bounds, out bool isRequired)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
 public new void onGetIsTooltipRequired(GoogleDesktopDisplayTarget target,
     Int32 dc,
     ref GoogleDesktopDisplayLib.tagRECT bounds, out bool isRequired)
 {
     isRequired = true;
 }
Exemplo n.º 3
0
 public new void DrawItem(GoogleDesktopDisplayTarget target,
 Int32 dc,
 ref GoogleDesktopDisplayLib.tagRECT bounds)
 {
     throw new NotImplementedException();
       // Comment above and uncomment the code below to do custom drawing on your item.
       /*
       Graphics g = Graphics.FromHdc((IntPtr)dc);
       g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
       Rectangle rc = new Rectangle(bounds.left, bounds.top,
     bounds.right - bounds.left, bounds.bottom - bounds.top);
       Font font = new Font("Tahoma", 8);
       Brush brush = Brushes.Black;
       g.DrawString(heading, font, brush, rc);
       */
 }
Exemplo n.º 4
0
        public void DrawItem(GoogleDesktopDisplayTarget target,
            int dc,
            ref GoogleDesktopDisplayLib.tagRECT bounds)
        {
            //Log.Debug("Called DrawItem");
            //throw new NotImplementedException();
            Graphics g = Graphics.FromHdc((IntPtr)dc);

            Font font = null;
            Rectangle rc;
            Brush brush = null;
            IGoogleDesktopDisplayContentItem helper = (IGoogleDesktopDisplayContentItem)this;

            if (this.snippet == "MESSAGE")
            {
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                rc = new Rectangle(bounds.left, bounds.top,
                    bounds.right - bounds.left, bounds.bottom-bounds.top );
                font = new Font("Tahoma", 8);
                brush = Brushes.Black;
                g.DrawString(heading, font, brush, rc);
                return;
            }
            if (target == GoogleDesktopDisplayTarget.GDD_TARGET_SIDEBAR)
            {

                int left = bounds.left;
                if (this.image != null)
                {
                    g.DrawImage( ImageConverter.IpictureToImage(this.image), bounds.left, bounds.top, 16, 16 );
                    left += 16;
                }
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                rc = new Rectangle(left, bounds.top,
                    bounds.right - left, bounds.bottom-bounds.top-12 );
                font = new Font("Tahoma", 8);
                brush = Brushes.Black;
                g.DrawString(heading, font, brush, rc);

                rc = new Rectangle(left, bounds.top + 12,
                    bounds.right - left, bounds.bottom - bounds.top );
                String text;
                if (this.source == "0,0,0")
                {
                    text = "Offline";
                    brush = Brushes.DarkRed;
                }
                else
                {
                    String[] data = this.source.Split( ((String)",").ToCharArray() );
                    text = ""+data[0]+"ms ("+data[1]+"/"+data[2]+")";
                    int ping = Int32.Parse(data[0]);
                    if (ping < 80)
                    {
                        brush = Brushes.DarkGreen;
                    }
                    else if (ping < 100)
                    {
                        brush = Brushes.Green;
                    }
                    else if (ping < 150)
                    {
                        brush = Brushes.Orange;
                    }
                    else if (ping < 200)
                    {
                        brush = Brushes.DarkOrange;
                    }
                    else if (ping < 250)
                    {
                        brush = Brushes.Red;
                    }
                    else
                    {
                        brush = Brushes.DarkRed;
                    }
                }
                g.DrawString(text, font, brush, rc);
            }
            else if (target == GoogleDesktopDisplayTarget.GDD_TARGET_NOTIFIER)
            {
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                rc = new Rectangle(bounds.left, bounds.top,
                    bounds.right - bounds.left, bounds.bottom-bounds.top );
                font = new Font("Tahoma", 8);
                brush = Brushes.Black;
                g.DrawString(heading, font, brush, rc);
            }

            //Log.Debug("Executed DrawItem");
        }