void DisplayResult(bool result, string description) { if (result == true) { //ResultLabel.Text = "Got it, Thanks!"; ResultLabel.Text = description; // kick off a timer to allow the user to see the result System.Timers.Timer timer = new System.Timers.Timer(); timer.AutoReset = false; timer.Interval = 500; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { Parent.SetupComplete( ); }); }; timer.Start( ); } else { ResultLabel.Text = description; } ResultLabel.SizeToFit( ); View.SetNeedsLayout( ); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); Logo.Layer.Position = new CGPoint((View.Bounds.Width - Logo.Bounds.Width) / 2, 25); // Title RockUrlTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, View.Bounds.Height * .25f); // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it. RockUrlField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0); CGSize size = RockUrlField.SizeThatFits(new CGSize(RockUrlField.Bounds.Width, RockUrlField.Bounds.Height)); RockUrlField.Bounds = new CGRect(RockUrlField.Bounds.X, RockUrlField.Bounds.Y, RockUrlField.Bounds.Width, (float)System.Math.Ceiling(size.Height)); // center the rock URL field and title RockUrlField.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlTitle.Frame.Bottom + 5); // Title RockAuthKeyTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlField.Frame.Bottom + 20); // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it. RockAuthKeyField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0); size = RockAuthKeyField.SizeThatFits(new CGSize(RockAuthKeyField.Bounds.Width, RockAuthKeyField.Bounds.Height)); RockAuthKeyField.Bounds = new CGRect(RockAuthKeyField.Bounds.X, RockAuthKeyField.Bounds.Y, RockAuthKeyField.Bounds.Width, (float)System.Math.Ceiling(size.Height)); RockAuthKeyField.Layer.Position = new CGPoint((View.Bounds.Width - RockAuthKeyField.Bounds.Width) / 2, RockAuthKeyTitle.Frame.Bottom + 5); // Description RockUrlDesc.Layer.Position = new CGPoint(RockUrlField.Frame.Left, RockAuthKeyField.Frame.Bottom + 5); // set the blocker BlockerView.SetBounds(View.Bounds.ToRectF( )); // set the submit bounds and position Submit.SizeToFit( ); Submit.Bounds = new CGRect(0, 0, RockUrlField.Bounds.Width * .35f, Submit.Bounds.Height * 1.25f); Submit.Layer.Position = new CGPoint(RockUrlField.Frame.Left + ((RockUrlField.Bounds.Width - Submit.Bounds.Width) / 2), RockUrlDesc.Frame.Bottom + 60); // let the label stretch the entire width ResultLabel.Bounds = new CGRect(0, 0, View.Bounds.Width, 0); ResultLabel.SizeToFit( ); ResultLabel.Frame = new CGRect(0, Submit.Frame.Bottom + 30, View.Bounds.Width, ResultLabel.Bounds.Height); }
public void SetBounds(RectangleF containerBounds) { View.Bounds = containerBounds; // setup the background layers /*StatusBackground.Frame = new RectangleF( View.Frame.X, * View.Frame.Top + Rock.Mobile.Graphics.Util.UnitToPx( 10 ), * View.Frame.Width, * Rock.Mobile.Graphics.Util.UnitToPx( 44 ) );*/ /*ResultBackground.Frame = new RectangleF( View.Frame.X, * View.Frame.Height / 3, * View.Frame.Width, * Rock.Mobile.Graphics.Util.UnitToPx( 150 ) );*/ // and the labels StatusLabel.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); StatusLabel.SizeToFit( ); StatusLabel.Frame = new RectangleF((View.Frame.Width - StatusLabel.Frame.Width) / 2, View.Frame.Top + Rock.Mobile.Graphics.Util.UnitToPx(10), StatusLabel.Frame.Width, StatusLabel.Frame.Height); ResultSymbol.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); ResultSymbol.SizeToFit( ); float circleWidth = ResultSymbol.Frame.Width * 1.25f; ResultCircle.Frame = new RectangleF((View.Frame.Width - circleWidth) / 2, Rock.Mobile.Graphics.Util.UnitToPx(140), circleWidth, circleWidth); ResultSymbol.Frame = new RectangleF(ResultCircle.Frame.X + (ResultCircle.Frame.Width - ResultSymbol.Frame.Width) / 2, ResultCircle.Frame.Y + (ResultCircle.Frame.Height - ResultSymbol.Frame.Height) / 2, ResultSymbol.Frame.Width, ResultSymbol.Frame.Height); ResultLabel.Frame = new RectangleF(0, 0, View.Frame.Width - Rock.Mobile.Graphics.Util.UnitToPx(40), 0); ResultLabel.SizeToFit( ); ResultLabel.Frame = new RectangleF((View.Frame.Width - ResultLabel.Frame.Width) / 2, ResultCircle.Frame.Bottom + Rock.Mobile.Graphics.Util.UnitToPx(5), ResultLabel.Frame.Width, ResultLabel.Frame.Height); // lastly the button float doneWidth = Rock.Mobile.Graphics.Util.UnitToPx(122); DoneButton.Frame = new RectangleF((View.Frame.Width - doneWidth) / 2, ResultLabel.Frame.Bottom + Rock.Mobile.Graphics.Util.UnitToPx(10), doneWidth, DoneButton.Frame.Height); }