コード例 #1
0
        private void ConfigureStarCircularProgress()
        {
            var frame = new CGRect(201, 200, 200, 200);

            starProgress        = new iOS.CircularProgress(frame);
            starProgress.Colors = new[]
            {
                UIColor.Purple.CGColor,
                ColorExtension.RgbaColor(0xFFF77A55).CGColor,
                UIColor.Orange.CGColor
            };

            starProgress.LineWidth = 3.0;

            var path = new UIBezierPath();

            path.MoveTo(new CGPoint(50.0, 2.0));
            path.AddLineTo(new CGPoint(84.0, 86.0));
            path.AddLineTo(new CGPoint(6.0, 33.0));
            path.AddLineTo(new CGPoint(96.0, 33.0));
            path.AddLineTo(new CGPoint(17.0, 86.0));
            path.ClosePath();
            starProgress.Path = path;


            View.AddSubview(starProgress);
        }
コード例 #2
0
        private void ConfigureFourColorCircularProgress()
        {
            var frame = new CGRect(0, 0, 200, 200);

            fourColorCircularProgress              = new iOS.CircularProgress(frame);
            fourColorCircularProgress.StartAngle   =
                fourColorCircularProgress.EndAngle =
                    -90;

            fourColorCircularProgress.Colors = new[]
            {
                ColorExtension.RgbaColor(0xA6E39D11).CGColor,
                ColorExtension.RgbaColor(0xAEC1E355).CGColor,
                ColorExtension.RgbaColor(0xAEC1E3AA).CGColor,
                ColorExtension.RgbaColor(0xF3C0ABFF).CGColor
            };

            View.AddSubview(fourColorCircularProgress);
        }
コード例 #3
0
        private void ConfigureHalfCircularProgress()
        {
            var frame = new CGRect(0, 301, View.Frame.Width, View.Frame.Height / 2);

            halfCircularProgress = new iOS.CircularProgress(frame, true);

            var center = new CGPoint(160, 200);
            var bezier = new UIBezierPath();

            bezier.AddArc(center, halfCircularProgress.Frame.Width / 3, (nfloat)Math.PI, (nfloat)0.0, true);
            halfCircularProgress.Path = bezier;

            halfCircularProgress.Colors = new []
            {
                ColorExtension.RgbaColor(0xA6E39DAA).CGColor,
                ColorExtension.RgbaColor(0xAEC1E3AA).CGColor,
                ColorExtension.RgbaColor(0xAEC1E3AA).CGColor,
                ColorExtension.RgbaColor(0xF3C0ABAA).CGColor
            };

            halfCircularProgress.LineWidth          = 8.0;
            halfCircularProgress.ProgressGuideColor = new UIColor((nfloat)0.1, (nfloat)0.1, (nfloat)0.1, (nfloat)0.7);
            textLabel = new UILabel(new CGRect(halfCircularProgress.Frame.X + 120.0, 170.0, 80, 32));
            textLabel.TextAlignment = UITextAlignment.Center;
            textLabel.TextColor     = UIColor.Green;
            textLabel.Font          = UIFont.FromName("HelveticaNeue-UltraLight", 20f);
            textLabel.Alpha         = (System.nfloat) 0.5;
            textLabel.Text          = "";

            halfCircularProgress.AddSubview(textLabel);

            halfCircularProgress.ProgressUpdated += (sender, e) => {
                BeginInvokeOnMainThread(() => textLabel.Text = string.Format("{0}%", (int)(e.Progress * 100)));
            };

            View.AddSubview(halfCircularProgress);
        }