Ejemplo n.º 1
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            TKGaugeNeedle needle = this.radialGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;

            needle.SetValue(60, 0.5f, CAMediaTimingFunction.EaseInEaseOut);
            needle = this.linearGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;
            needle.SetValue(1.8f, 0.7f, CAMediaTimingFunction.EaseInEaseOut);
        }
Ejemplo n.º 2
0
        void SetNeedle(TKGaugeScale scale)
        {
            TKGaugeNeedle needle = new TKGaugeNeedle();

            needle.Value         = 36;
            needle.Length        = 0.5f;
            needle.Width         = 2;
            needle.TopWidth      = 2;
            needle.ShadowOpacity = 0.5f;
            scale.AddIndicator(needle);
        }
Ejemplo n.º 3
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            scale.Radius          = 0.76f;
            scale.Ticks.Position  = TKGaugeTicksPosition.Outer;
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset   = 0.15f;
            scale.Ticks.Offset    = 0.05f;

            this.radialGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.redValues[i], this.redValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.76f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.greenValues[i], this.greenValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.64f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.blueValues[i], this.blueValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.52f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[] { 0.76f, 0.64f, 0.52f };

            for (int i = 0; i < 3; i++)
            {
                TKGaugeNeedle needle = new TKGaugeNeedle();
                needle.Value  = this.r.Next(100);
                needle.Fill   = new TKSolidFill(UIColor.Gray);
                needle.Length = lengths[i];
                scale.AddIndicator(needle);
            }
        }
Ejemplo n.º 4
0
        public void SegmentTouched(UISegmentedControl source)
        {
            nfloat value = nfloat.Parse(this.segments[source.SelectedSegment]);

            TKGaugeNeedle needle = this.radialGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;

            needle.SetValue(value,
                            0.5f,
                            CAMediaTimingFunction.EaseInEaseOut);

            needle = this.linearGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;
            needle.SetValue((value / 180) * 7.0f, 0.5f, CAMediaTimingFunction.EaseInEaseOut);
        }
Ejemplo n.º 5
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            this.linearGauge.AddScale(scale);

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.redValues[i], this.redValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.55f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.greenValues[i], this.greenValues[i + 1]);
                segment.Fill     = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.67f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++)
            {
                TKGaugeSegment segment = new TKGaugeSegment(this.blueValues[i], this.blueValues[i + 1]);

                segment.Fill     = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.79f;
                segment.Cap      = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[] { 0.55f, 0.67f, 0.79f };

            for (int i = 0; i < 3; i++)
            {
                TKGaugeNeedle needle = new TKGaugeNeedle();
                needle.Value  = this.r.Next(100);
                needle.Fill   = new TKSolidFill(UIColor.Gray);
                needle.Length = 1 - lengths[i];
                scale.AddIndicator(needle);
            }
        }
Ejemplo n.º 6
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge();
            this.radialGauge.LabelSubtitle.Text = "km/h";
            this.radialGauge.LabelTitleOffset   = new CGPoint(0, 20);
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale();

            scale.Range                  = new TKRange(new NSNumber(0), new NSNumber(180));
            scale.Labels.Count           = 9;
            scale.Ticks.MajorTicksCount  = 18;
            scale.Ticks.MinorTicksCount  = 1;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.Offset           = 0.1f;
            scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.radialGauge.AddScale(scale);

            TKRange[] ranges = new TKRange[] { new TKRange(new NSNumber(0), new NSNumber(60)),
                                               new TKRange(new NSNumber(61), new NSNumber(120)),
                                               new TKRange(new NSNumber(121), new NSNumber(180)) };

            UIColor[] colors = new UIColor[] { new UIColor(0.522f, 0.522f, 0.522f, 1.00f),
                                               new UIColor(0.200f, 0.200f, 0.200f, 1.00f),
                                               new UIColor(0.886f, 0.329f, 0.353f, 1.00f) };
            nint i = 0;

            foreach (TKRange range in ranges)
            {
                TKGaugeSegment segment = new TKGaugeSegment(range);
                segment.Width = 0.02f;
                segment.Fill  = new TKSolidFill(colors[i]);
                scale.AddSegment(segment);
                i++;
            }

            TKGaugeNeedle needle = new TKGaugeNeedle();

            needle.Length        = 0.8f;
            needle.Width         = 3;
            needle.TopWidth      = 3;
            needle.ShadowOffset  = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius  = 1.5f;
            scale.AddIndicator(needle);
        }
Ejemplo n.º 7
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge();              //100 height
            this.linearGauge.LabelSubtitle.Text = "rpm x 1000";
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale();

            scale.Range  = new TKRange(new NSNumber(0), new NSNumber(8));
            scale.Offset = 0.55f;
            scale.Ticks.MinorTicksCount  = 1;
            scale.Ticks.MajorTicksCount  = 14;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.linearGauge.AddScale(scale);

            TKGaugeSegment segment = new TKGaugeSegment(new NSNumber(0), new NSNumber(5));

            segment.Fill     = new TKSolidFill(new UIColor(0.522f, 0.522f, 0.522f, 1.00f));
            segment.Location = 0.6f;
            segment.Width    = 0.01f;
            segment.Width2   = 0.01f;
            scale.AddSegment(segment);

            segment          = new TKGaugeSegment(new NSNumber(5.1), new NSNumber(8));
            segment.Fill     = new TKSolidFill(new UIColor(0.886f, 0.329f, 0.353f, 1.00f));
            segment.Location = 0.6f;
            segment.Width    = 0.01f;
            segment.Width2   = 0.01f;
            scale.AddSegment(segment);

            // >> gauge-needle-cs
            TKGaugeNeedle needle = new TKGaugeNeedle();

            needle.Width         = 3;
            needle.TopWidth      = 3;
            needle.Length        = 0.6f;
            needle.ShadowOffset  = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius  = 1.5f;
            scale.AddIndicator(needle);
            // << gauge-needle-cs
        }
Ejemplo n.º 8
0
		void CreateLinearGauge() {
			this.linearGauge = new TKLinearGauge (); //100 height
			this.linearGauge.LabelSubtitle.Text = "rpm x 1000";
			this.View.AddSubview(this.linearGauge);

			TKGaugeLinearScale scale = new TKGaugeLinearScale ();
			scale.Range = new TKRange (new NSNumber (0), new NSNumber (8));
			scale.Offset = 0.55f;
			scale.Ticks.MinorTicksCount = 1;
			scale.Ticks.MajorTicksCount = 14;
			scale.Ticks.MajorTicksLength = 4;
			scale.Ticks.MajorTicksStroke = new TKStroke(new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
			this.linearGauge.AddScale(scale);

			TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (5));
			segment.Fill = new TKSolidFill(new UIColor(0.522f, 0.522f, 0.522f, 1.00f));
			segment.Location = 0.6f;
			segment.Width = 0.01f;
			segment.Width2 = 0.01f;
			scale.AddSegment(segment);

			segment = new TKGaugeSegment (new NSNumber (5.1), new NSNumber (8));
			segment.Fill = new TKSolidFill(new UIColor(0.886f, 0.329f, 0.353f, 1.00f));
			segment.Location = 0.6f;
			segment.Width = 0.01f;
			segment.Width2 = 0.01f;
			scale.AddSegment(segment);

			TKGaugeNeedle needle = new TKGaugeNeedle();
			needle.Width = 3;
			needle.TopWidth = 3;
			needle.Length = 0.6f;
			needle.ShadowOffset = new CGSize(1, 1);
			needle.ShadowOpacity = 0.8f;
			needle.ShadowRadius = 1.5f;
			scale.AddIndicator(needle);

		}
Ejemplo n.º 9
0
		void SetNeedle(TKGaugeScale scale)
		{
			TKGaugeNeedle needle = new TKGaugeNeedle ();
			needle.Value = 36;
			needle.Length = 0.5f;
			needle.Width = 2;
			needle.TopWidth = 2;
			needle.ShadowOpacity = 0.5f;
			scale.AddIndicator(needle);
		}
Ejemplo n.º 10
0
        void CreateLinearGauge()
        {
            this.linearGauge = new TKLinearGauge ();
            this.View.AddSubview(this.linearGauge);

            TKGaugeLinearScale scale = new TKGaugeLinearScale ();
            this.linearGauge.AddScale (scale);

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.redValues[i], this.redValues[i+1]);
                segment.Fill = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.55f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.greenValues[i], this.greenValues[i+1]);
                segment.Fill = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.67f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.blueValues[i], this.blueValues[i+1]);

                segment.Fill = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.79f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[]{0.55f, 0.67f, 0.79f };

            for (int i = 0; i < 3 ; i++) {

                TKGaugeNeedle needle = new TKGaugeNeedle ();
                needle.Value = this.r.Next (100);
                needle.Fill = new TKSolidFill(UIColor.Gray);
                needle.Length =1 - lengths[i];
                scale.AddIndicator(needle);
            }
        }
Ejemplo n.º 11
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge ();
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale ();
            scale.Radius = 0.76f;
            scale.Ticks.Position = TKGaugeTicksPosition.Outer;
            scale.Labels.Position = TKGaugeLabelsPosition.Outer;
            scale.Labels.Offset = 0.15f;
            scale.Ticks.Offset = 0.05f;

            this.radialGauge.AddScale (scale);

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.redValues[i], this.redValues[i+1]);
                segment.Fill = new TKSolidFill(this.redColors[i]);
                segment.Location = 0.76f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.greenValues[i], this.greenValues[i+1]);
                segment.Fill = new TKSolidFill(this.greenColors[i]);
                segment.Location = 0.64f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            for (int i = 0; i < 3; i++) {
                TKGaugeSegment segment = new TKGaugeSegment (this.blueValues[i], this.blueValues[i+1]);
                segment.Fill = new TKSolidFill(this.blueColors[i]);
                segment.Location = 0.52f;
                segment.Cap = TKGaugeSegmentCap.Round;
                scale.AddSegment(segment);
            }

            nfloat[] lengths = new nfloat[]{ 0.76f, 0.64f, 0.52f };

            for (int i = 0; i < 3 ; i++) {
                TKGaugeNeedle needle = new TKGaugeNeedle ();
                needle.Value =  this.r.Next (100);
                needle.Fill = new TKSolidFill(UIColor.Gray);
                needle.Length =  lengths[i];
                scale.AddIndicator(needle);
            }
        }
Ejemplo n.º 12
0
        void CreateRadialGauge()
        {
            this.radialGauge = new TKRadialGauge ();
            this.radialGauge.LabelSubtitle.Text = "km/h";
            this.radialGauge.LabelOffset = new CGPoint(0, 20);
            this.View.AddSubview(this.radialGauge);

            TKGaugeRadialScale scale = new TKGaugeRadialScale ();
            scale.Range = new TKRange (new NSNumber(0), new NSNumber(180));
            scale.Labels.Count = 9;
            scale.Ticks.MajorTicksCount = 18;
            scale.Ticks.MinorTicksCount = 1;
            scale.Ticks.MajorTicksLength = 4;
            scale.Ticks.Offset = 0.1f;
            scale.Ticks.MajorTicksStroke =  new TKStroke( new UIColor(0.522f, 0.522f, 0.522f, 1.00f), 2);
            this.radialGauge.AddScale(scale);

            TKRange[] ranges = new TKRange[] { new TKRange(new NSNumber(0), new NSNumber(60)),
                                               new TKRange(new NSNumber(61), new NSNumber(120)),
                                                new TKRange(new NSNumber(121), new NSNumber(180))};

            UIColor[] colors = new UIColor[] {new UIColor(0.522f, 0.522f, 0.522f, 1.00f),
                new UIColor(0.200f, 0.200f, 0.200f, 1.00f),
                new UIColor(0.886f, 0.329f, 0.353f, 1.00f)};
            nint i = 0;
            foreach (TKRange range in ranges) {
                TKGaugeSegment segment = new TKGaugeSegment(range);
                segment.Width = 0.02f;
                segment.Fill = new TKSolidFill(colors[i]);
                scale.AddSegment(segment);
                i++;
            }

            TKGaugeNeedle needle = new TKGaugeNeedle();
            needle.Length = 0.8f;
            needle.Width = 3;
            needle.TopWidth = 3;
            needle.ShadowOffset = new CGSize(1, 1);
            needle.ShadowOpacity = 0.8f;
            needle.ShadowRadius = 1.5f;
            scale.AddIndicator(needle);
        }