Beispiel #1
0
 private void OnClickAll()
 {
     if (GraphContainer.IsShownById(_graphId))
     {
         GraphContainer.HideGraphById(_graphId);
     }
     else
     {
         GraphContainer.ShowGraphById(_graphId);
         CurrentData.ForceUpdateData();
     }
 }
Beispiel #2
0
        public override void Draw(Cairo.Context surface, int x, int y)
        {
            X = x;
            Y = y;
            int waveTops    = Radius / 3;
            int waveBottoms = Radius / 2;
            int waveDepths  = Radius / 6;

            WaterTemperature = CurrentData.GetCurrentValueByIdFloat(XIVELY_DATA_STREAM_ID);
            //WaterTemperature = WaterTemperature / 100;


            // CIRCLE
            surface.SetSourceRGBA(1, 1, 1, 0.3);
            surface.Arc(X, Y, Radius, 0, Math.PI * 2);
            surface.Fill();

            surface.SetSourceRGBA(1, 1, 1, WaterLight);
            surface.Arc(X, Y, Radius + 5, 0, Math.PI * 2);
            surface.Stroke();
            surface.Fill();

            // WAVEFORMED CIRCLE
            surface.CurveTo(X - Radius, Y - waveDepths, X - waveBottoms, Y + waveDepths, X - waveTops, Y - waveDepths);
            surface.CurveTo(X - waveTops, Y - waveDepths, X, Y + waveDepths, X + waveTops, Y - waveDepths);
            surface.CurveTo(X + waveTops, Y - waveDepths, X + waveBottoms, Y + waveDepths, X + Radius, Y - waveDepths);
            surface.SetSourceRGBA(colorWater[0], colorWater[1], colorWater[2], alphaChannel);
            surface.Arc(X, Y, Radius, 0, Math.PI * 1);
            surface.Fill();

            // TEXT
            surface.SetSourceRGBA(1, 1, 1, 0.1);
            surface.MoveTo(X, Y);
            surface.SetFontSize(Radius / 2);
            string widgetText = Convert.ToString(WaterTemperature);

            Cairo.TextExtents text = surface.TextExtents(widgetText);
            surface.MoveTo(X - (text.Width / 2), Y + (text.Height / 2));
            surface.ShowText(widgetText);
            surface.Fill();
        }
Beispiel #3
0
        protected void OnSaveButtonClicked(object sender, EventArgs e)
        {
            // save entryToSave value into system settings
            if (impKeyEntry.Text != "")
            {
                UserSettings.ImpKey = impKeyEntry.Text;
            }
            if (xivelyApiKeyEntry.Text != "")
            {
                UserSettings.XivelyApiKey = xivelyApiKeyEntry.Text;
            }
            if (xivelyFeedIdEntry.Text != "")
            {
                UserSettings.XivelyFeedId = xivelyFeedIdEntry.Text;
            }
            if (rEntry.Text != "")
            {
                UserSettings.BgColorR = (float)Convert.ToDouble(rEntry.Value);
            }
            if (gEntry.Text != "")
            {
                UserSettings.BgColorG = (float)Convert.ToDouble(gEntry.Value);
            }
            if (bEntry.Text != "")
            {
                UserSettings.BgColorB = (float)Convert.ToDouble(bEntry.Value);
            }

            UserSettings.Save();



            // display status in statusLael
            statusLabel.Text = "Stored!";

            CurrentData.ForceUpdateData();

            Console.WriteLine(UserSettings.CorrectKey);

            UserSettings.UserSetupCompleted = true;
        }
Beispiel #4
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();
            }
        }
Beispiel #5
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);
        }
Beispiel #6
0
        public override void Draw(Cairo.Context surface, int x, int y)
        {
            X = x;

            Y = y;

            double StartAngle = (1 / 8) * Math.PI;
            double EndAngle   = 2 * Math.PI - ((1 / 8) * Math.PI);

            lightValue = CurrentData.GetCurrentValueByIdFloat("LIGHT");


            //LIGHTBULB ALL THE WAY BABY

            surface.MoveTo(X - 100 * scaleFactor, Y + 200 * scaleFactor);
            surface.LineTo(X - 100 * scaleFactor, Y - 100 * scaleFactor);
            surface.Arc(X, Y - 100 * scaleFactor, 200 * scaleFactor, StartAngle, EndAngle);
            surface.MoveTo(X + 100 * scaleFactor, Y - 100 * scaleFactor);
            surface.LineTo(X + 100 * scaleFactor, Y + 200 * scaleFactor);
            surface.LineTo(X - 100 * scaleFactor, Y + 200 * scaleFactor);

            surface.SetSourceRGBA(1, 1, 0, 0.20 + normalizingLightValue());
            surface.Fill();

            if (_showText == true)
            {
                widgetText = lightValue + "";
                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);
            }
        }
Beispiel #7
0
        public override void Draw(Cairo.Context surface, int x, int y)
        {
            if (0 == CurrentData.GetCurrentValueByIdFloat(XIVELY_DATA_STREAM_ID))
            {
                pumpON = false;
            }
            else
            {
                pumpON = true;
            }


            X = x;
            Y = y;
            int rectSideWidth  = Radius / 20;
            int rectSideLenght = Radius;
            int pumphead       = Radius / 5;

            surface.SetSourceRGB(0.3, 0.3, 0.3);
            surface.Arc(X, Y, Radius, 0, Math.PI * 2);
            surface.Fill();

            surface.SetSourceRGBA(1, 1, 1, pumpLight);
            surface.Arc(X, Y, Radius + 5, 0, Math.PI * 2);
            surface.Stroke();
            surface.Fill();

            surface.SetSourceRGB(0.5, 0.5, 0.5);
            surface.Rectangle(X - (Radius / 2), Y - (Radius / 2), rectSideLenght, rectSideLenght);                                      // Middle
            surface.Fill();

            surface.SetSourceRGB(0, 0, 0);
            surface.Rectangle(X - (Radius / 2), Y - (Radius / 2), rectSideWidth, rectSideLenght);                       // Left
            surface.Rectangle(X + (Radius / 2) - rectSideWidth, Y - (Radius / 2), rectSideWidth, rectSideLenght);       // Right
            surface.Rectangle(X - (Radius / 2), Y - (Radius / 2), rectSideLenght, rectSideWidth);                       // Top
            surface.Rectangle(X - (Radius / 2), Y + (Radius / 2) - rectSideWidth, rectSideLenght, rectSideWidth);       // Bottom
            surface.Fill();

            surface.Rectangle(X - (Radius / 2) - pumphead, Y, pumphead, pumphead);
            surface.Fill();

            surface.SetSourceRGB(0.5, 0.5, 0.5);
            surface.Rectangle(X - (Radius / 2) - pumphead, Y + (pumphead / 2 / 2), (pumphead * 2), (pumphead / 2));
            surface.Fill();

            surface.SetSourceRGB(0, 0, 0);
            surface.Rectangle(X, Y - (Radius / 2) - pumphead, pumphead, pumphead);
            surface.Fill();

            surface.SetSourceRGB(0.5, 0.5, 0.5);
            surface.Rectangle(X + (pumphead / 2 / 2), Y - (Radius / 2) - (pumphead), (pumphead / 2), (pumphead * 2));
            surface.Fill();


            // - ON / OFF
            surface.SetSourceRGB(0.1, 0.1, 0.1);
            surface.Arc(X + Radius / 4, Y + Radius / 4, Radius / 10, 0, Math.PI * 2);
            surface.Stroke();
            if (pumpON == true)
            {
                surface.SetSourceRGB(0, 0.5, 0);
            }
            else
            {
                surface.SetSourceRGB(0.5, 0, 0);
            }


            surface.Arc(X + Radius / 4, Y + Radius / 4, Radius / 10, 0, Math.PI * 2);
            surface.Fill();
        }
Beispiel #8
0
        public override void Draw(Cairo.Context surface, int x, int y)
        {
            //PHValue = CurrentData.GetCurrentValueByIdFloat("ph");

            PHValue = CurrentData.GetCurrentValueByIdFloat(XIVELY_DATA_STREAM_ID);
            PHValue = PHValue % 14;

            X = x;
            Y = y;
            int barHeight = Radius / 2;
            //int barLength = Radius + (Radius / 2);
            int sectionSize      = Radius / 5;
            int pushLength       = sectionSize + 1;
            int amountOfSections = 8;

            int selectwidth  = Radius / 10;
            int selectHeight = Radius / 2;

            float phSelect      = (((float)sectionSize * (float)amountOfSections) / 14.0f) * PHValue;
            int   distanceOnBar = X - ((sectionSize * amountOfSections) / 2) + (int)phSelect;

            // CIRCLE
            surface.SetSourceRGBA(1, 1, 1, 0.3);
            surface.Arc(X, Y, Radius, 0, Math.PI * 2);
            surface.Fill();

            surface.SetSourceRGBA(1, 1, 1, PHLight);
            surface.Arc(X, Y, Radius + 5, 0, Math.PI * 2);
            surface.Stroke();
            surface.Fill();

            // WAVEFORMED CIRCLE
            surface.SetSourceRGB(0.8, 0.0, 0.0);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.6, 0.0, 0.0);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.4, 0.0, 0.0);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 2), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.3, 0.0, 0.0);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 3), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.0, 0.0, 0.3);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 4), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.0, 0.0, 0.4);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 5), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.0, 0.0, 0.6);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 6), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            surface.SetSourceRGB(0.0, 0.0, 0.8);
            surface.Rectangle(X - ((1 + sectionSize) * amountOfSections / 2) + (pushLength * 7), Y - (barHeight / 2), (sectionSize), barHeight);
            surface.Fill();

            // TEXT
            surface.SetSourceRGBA(1, 1, 1, 0.5);
            surface.MoveTo(X, Y);
            surface.SetFontSize(Radius / 2);
            string widgetText = Convert.ToString(PHValue);

            Cairo.TextExtents text = surface.TextExtents(widgetText);
            surface.MoveTo(distanceOnBar - (text.Width / 2), Y + (text.Height / 2) - barHeight);
            surface.ShowText(widgetText);
            surface.Fill();

            surface.SetSourceRGB(1, 1, 1);
            surface.Rectangle(distanceOnBar - (selectwidth / 2), Y - barHeight / 2, selectwidth, selectHeight);
            surface.Stroke();
            surface.Fill();
        }