Ejemplo n.º 1
0
        public ClockWidget()
        {
            _graphId = GraphContainer.AssignAndGetGraphId();

            Alpha = 0.6f;
            Name  = "";

            R = 0.98f;
            G = 0.96f;
            B = 0.88f;
        }
Ejemplo n.º 2
0
 private void OnClickAll()
 {
     if (GraphContainer.IsShownById(_graphId))
     {
         GraphContainer.HideGraphById(_graphId);
     }
     else
     {
         GraphContainer.ShowGraphById(_graphId);
         CurrentData.ForceUpdateData();
     }
 }
Ejemplo n.º 3
0
        public override void OnAllClick()
        {
            if (_showText)
            {
                _showText = false;
            }
            else
            {
                _showText = true;
            }

            if (GraphContainer.IsShownById(_graphId))
            {
                GraphContainer.HideGraphById(_graphId);
            }
            else
            {
                GraphContainer.ShowGraphById(_graphId);
                CurrentData.ForceUpdateData();
            }
        }
Ejemplo n.º 4
0
        public override void Draw(Cairo.Context surface, int x, int y)
        {
            _humidityValue = CurrentData.GetCurrentValueByIdString(XIVELY_DATA_STREAM_ID);

            GraphContainer.AssignXivelyDatastreamStringById(_graphId, XIVELY_DATA_STREAM_ID);

            GraphContainer.SetGraphColorById(_graphId, G, R, 0.4f);

            X = x;
            Y = y;

            surface.SetSourceRGBA(R, B, G, Alpha);
            surface.Arc(X, Y, Radius, 0, Math.PI * 2);
            surface.Fill();

            surface.SetSourceRGB(R, G, B);
            surface.Arc(X, Y, Radius + 5, 0, Math.PI * 2);
            surface.Stroke();

            string widgetText = _humidityValue + "%";

            surface.SetFontSize(15);
            Cairo.TextExtents text = surface.TextExtents(widgetText);

            surface.SetSourceRGBA(1, 1, 1, Alpha);
            surface.MoveTo(X - (text.Width / 2), Y + (text.Height / 2));

            surface.ShowText(widgetText);

            widgetText = "Humidity";
            surface.SetFontSize(13);
            text = surface.TextExtents(widgetText);

            surface.SetSourceRGBA(0.98f, 0.5f, 0.4f, Alpha);
            surface.MoveTo(X - (text.Width / 2), Y + (text.Height / 2) + 15);

            surface.ShowText(widgetText);
        }
Ejemplo n.º 5
0
        public override void Draw(Cairo.Context surface, int PositionX, int PositionY)
        {
            GraphContainer.AssignXivelyDatastreamStringById(_graphId, XIVELY_DATA_STREAM_ID);

            GraphContainer.SetGraphColorById(_graphId, R, G, B);

            X = PositionX;
            Y = PositionY;

            double clockDegree  = (Math.PI * 2) / 60;
            double angleSeconds = clockDegree * DateTime.Now.Second;
            double angleMinute  = clockDegree * DateTime.Now.Minute;
            double angleHour    = ((Math.PI * 2) / 12) * DateTime.Now.Hour % 12;
            bool   minutes      = true;


            surface.MoveTo(PositionX - Radius, PositionY);
            surface.SetSourceRGBA(R, G, B, Alpha);
            //context.MoveTo (x, y);
            surface.Arc(PositionX, PositionY, Radius, -Math.PI, Math.PI);
            surface.Stroke();

            surface.SetSourceRGBA(R, 0.5f, 0.4f, 0.5f);
            surface.Arc(X, Y, Radius + 5, 0, Math.PI * 2);
            surface.Stroke();

            // digital time
            surface.SetFontSize(12);
            TextExtents text = surface.TextExtents(DateTime.Now.ToString("HH:mm:ss"));

            surface.MoveTo(PositionX - text.Width / 2, PositionY + text.Height / 2 + Radius / 2 - 10);
            surface.SetSourceRGBA(0.8, 0.4, 0.4, Alpha);
            surface.ShowText(DateTime.Now.ToString("HH:mm:ss"));

            // name
            surface.SetFontSize(10);
            text = surface.TextExtents(Name);
            surface.MoveTo(PositionX - text.Width / 2, PositionY + text.Height / 2 + Radius / 2);
            surface.SetSourceRGBA(R, G, B, Alpha);
            surface.ShowText(Name);

            // seconds line
            surface.SetSourceRGB(0.8, 0.4, 0.4);
            surface.MoveTo(PositionX, PositionY);
            surface.LineTo(PositionX - Radius * Math.Cos(angleSeconds + Math.PI / 2), PositionY - Radius * Math.Sin(angleSeconds + Math.PI / 2));
            surface.Stroke();

            if (minutes)
            {
                // minutes line
                surface.SetSourceRGB(0.4, 0.4, 0.4);
                surface.MoveTo(PositionX, PositionY);
                surface.LineTo(PositionX - (Radius - 10) * Math.Cos(angleMinute + Math.PI / 2), PositionY - (Radius - 10) * Math.Sin(angleMinute + Math.PI / 2));
                surface.Stroke();
            }

            // hour line
            surface.SetSourceRGB(0.4, 0.4, 0.4);
            surface.MoveTo(PositionX, PositionY);
            surface.LineTo(PositionX - (Radius / 2) * Math.Cos(angleHour + Math.PI / 2), PositionY - (Radius / 2) * Math.Sin(angleHour + Math.PI / 2));
            surface.Stroke();

//			if (_showText) {
//
//				// name
//				surface.SetFontSize(30);
//				text = surface.TextExtents("Kevins Mom");
//				surface.MoveTo(PositionX - text.Width/2, PositionY + text.Height/2 + Radius/2);
//				surface.SetSourceRGBA (1,0,1, 1);
//				surface.ShowText ("Kevins Mom");
//
//			}
        }
Ejemplo n.º 6
0
 public HumidityWidget()
 {
     _graphId = GraphContainer.AssignAndGetGraphId();
 }