public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); dvc = new DialogViewController ( new RootElement ("Root") { new Section ("Main") { (button = new GlassButton (new RectangleF (0, 0, window.Bounds.Width - 20, 60))), (upper = new StringElement ("this should become uppercased")), (lower = new StringElement ("THIS SHOULD BECOME LOWERCASED")), } } ); button.SetTitle ("Test", UIControlState.Normal); button.Tapped += (obj) => { button.Enabled = false; Test (); }; window.RootViewController = dvc; window.MakeKeyAndVisible (); return true; }
private GlassButton GetGlassButton(float buttonYposition) { var buttonWidth = 300f; var center = (View.Frame.Width / 2) - (buttonWidth / 2); var frame = new RectangleF(center,buttonYposition,300f,50f); var glassBtn = new GlassButton(frame); glassBtn.SetTitle("Use",UIControlState.Normal); glassBtn.TouchDown += AddProgressIndicator; glassBtn.TouchUpInside += HandleLoginButtonTouchUpInside; return glassBtn; }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(Key); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, Key); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, tv.Frame.Width, cell.Frame.Height); } else { RemoveTag(cell, 1); } if (button == null) { RectangleF frame = cell.Frame; // after the first run the Y offset of the cell is unknown, frame.Y = 0; frame.Inflate(-8, 0); button = new GlassButton(frame); button.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; button.Font = UIFont.BoldSystemFontOfSize(22); button.TouchUpInside += (o, e) => tapped.Invoke(); } else { button.RemoveFromSuperview(); } button.SetTitle(this.Caption, UIControlState.Normal); button.SetTitleColor(UIColor.White, UIControlState.Normal); button.BackgroundColor = UIColor.Clear; button.HighlightedColor = this.HighlightedColor; button.NormalColor = this.NormalColor; button.DisabledColor = this.DisabledColor; // note: button is a child of the sell itself instead of the content area so the borders of the button don't // do weird visual tricks with the borders of the table section cell.Add(button); return(cell); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = ScreenResolutionMatcher.BackgroundColorFromImage(); _nameLabel = new UILabel{ TextAlignment = UITextAlignment.Right, Frame = new RectangleF(10,40,300,40), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(24), BackgroundColor = UIColor.Clear }; View.AddSubview(_nameLabel); _nicknameLabel = new UILabel{ TextAlignment = UITextAlignment.Right, Frame = new RectangleF(10,90,300,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(14), BackgroundColor = UIColor.Clear }; View.AddSubview(_nicknameLabel); var logoutButton = new GlassButton(new RectangleF (10, ScreenResolutionMatcher.PushedToBottomButtonY(), 300, 40)) { NormalColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f), HighlightedColor = UIColor.Black }; logoutButton.SetTitle("Cerrar Sesión", UIControlState.Normal); logoutButton.Font = UIFont.BoldSystemFontOfSize(14); logoutButton.Tapped += delegate { AppManager.Current.Logout(); }; View.AddSubview(logoutButton); // View.AddSubview( // new UILabel{ // Text = "Al cerrar la sesión, la próxima vez que abras esta aplicación, deberás volver a ingresar tu usuario y contraseña", // TextAlignment = UITextAlignment.Center, // Frame = new RectangleF(15,340,290,80), // Lines = 3, // TextColor = UIColor.White, // Font = UIFont.SystemFontOfSize(12), // BackgroundColor = UIColor.Clear // }); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = ScreenResolutionMatcher.BackgroundColorFromImage(); View.AddSubviews( new UILabel{ Text = "Comunidad Prode", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(0,0,320,60), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(19), BackgroundColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f) }, new UILabel{ Text = "todavía no sos usuario?", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(0,235,320,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(13), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "registrate en www.comunidadprode.com.ar!", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(0,255,320,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(13), BackgroundColor = UIColor.Clear } ); var loginButton = new GlassButton(new RectangleF (50, 185, 220, 40)) { NormalColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f), HighlightedColor = UIColor.Black }; loginButton.SetTitle("Ingresar", UIControlState.Normal); loginButton.Font = UIFont.BoldSystemFontOfSize(14); loginButton.Tapped += _Login; View.AddSubview(loginButton); }
// Create view public override void ViewDidLoad() { base.ViewDidLoad (); image = UIImage.FromFile("image.jpg"); imageView = new GPUImageView(new RectangleF(0,0,480,320)); imageView.ContentMode = UIViewContentMode.ScaleToFill; View = imageView; // Trick to display the image initially // TODO: Have the right size applySepiaFilter(0f); UIButton button = new GlassButton(new RectangleF(0,0,96,32)); button.SetTitle("Sepia!", UIControlState.Normal); button.TouchUpInside += (object sender, EventArgs e) => { applySepiaFilter(0.9f); }; View.AddSubview (button); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(Key); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, Key); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, tv.Frame.Width, cell.Frame.Height); } else { RemoveTag(cell, 1); } if (button == null) { RectangleF frame = cell.Frame; frame.Inflate(-10, 0); button = new GlassButton(frame); button.TouchUpInside += (o, e) => tapped.Invoke(); button.Font = UIFont.BoldSystemFontOfSize(22); } else { button.RemoveFromSuperview(); } button.SetTitle(this.Caption, UIControlState.Normal); button.SetTitleColor(UIColor.White, UIControlState.Normal); button.BackgroundColor = UIColor.Clear; button.HighlightedColor = this.HighlightedColor; button.NormalColor = this.NormalColor; button.DisabledColor = this.DisabledColor; cell.Add(button); return(cell); }
private UIView CreateGlassButtonView() { var view = new UIView(); view.BackgroundColor = UIColor.White; var button = new MonoTouch.Dialog.GlassButton(new RectangleF(0, 0, 300, 60)) { NormalColor = UIColor.FromRGB(216, 59, 84), HighlightedColor = UIColor.Blue, DisabledColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(19) }; button.SetTitle("Scan barcode", UIControlState.Normal); button.TouchUpInside += delegate(object sender, EventArgs e) { ScanClicked(sender, e); }; return(button); }
UIView CreateHeaderView (Dictionary<string, RectangleF> dicRect, int iViewHeight) { UIView uiView = new UIView (new RectangleF (0, 0, this.View.Bounds.Width, iViewHeight)); uiView.MultipleTouchEnabled = true; //subscribe GlassButton gbSubs = new GlassButton (dicRect["subscribe"]); gbSubs.Font = font13; gbSubs.SetTitle ("Subscribe", UIControlState.Normal); gbSubs.Enabled = true; gbSubs.Tapped += delegate{Subscribe();}; uiView.AddSubview (gbSubs); //publish GlassButton gbPublish = new GlassButton (dicRect["publish"]); gbPublish.Font = font13; gbPublish.SetTitle ("Publish", UIControlState.Normal); gbPublish.Enabled = true; gbPublish.Tapped += delegate{Publish();}; uiView.AddSubview (gbPublish); //presence GlassButton gbPresence = new GlassButton (dicRect["presence"]); gbPresence.Font = font13; gbPresence.SetTitle ("Presence", UIControlState.Normal); gbPresence.Enabled = true; gbPresence.Tapped += delegate{Presence();}; uiView.AddSubview (gbPresence); //Detailed History GlassButton gbDetailedHis = new GlassButton (dicRect["detailedhis"]); gbDetailedHis.Font = font13; gbDetailedHis.SetTitle ("Detailed History", UIControlState.Normal); gbDetailedHis.Enabled = true; gbDetailedHis.Tapped += delegate{DetailedHistory();}; uiView.AddSubview (gbDetailedHis); //Here Now GlassButton gbHereNow = new GlassButton (dicRect["herenow"]); gbHereNow.Font = font13; gbHereNow.SetTitle ("Here Now", UIControlState.Normal); gbHereNow.Enabled = true; gbHereNow.Tapped += delegate{HereNow();}; uiView.AddSubview (gbHereNow); //Time GlassButton gbTime = new GlassButton (dicRect["time"]); gbTime.Font = font13; gbTime.SetTitle ("Time", UIControlState.Normal); gbTime.Enabled = true; gbTime.Tapped += delegate{GetTime();}; uiView.AddSubview (gbTime); //Unsubscribe GlassButton gbUnsub = new GlassButton (dicRect["unsub"]); gbUnsub.Font = font13; gbUnsub.SetTitle ("Unsubscribe", UIControlState.Normal); gbUnsub.Enabled = true; gbUnsub.Tapped += delegate{Unsub();}; uiView.AddSubview (gbUnsub); //Unsubscribe-Presence GlassButton gbUnsubPres = new GlassButton (dicRect["unsubpres"]); gbUnsubPres.Font = font13; gbUnsubPres.SetTitle ("Unsubscribe-Presence", UIControlState.Normal); gbUnsubPres.Enabled = true; gbUnsubPres.Tapped += delegate{UnsubPresence();}; uiView.AddSubview (gbUnsubPres); return uiView; }
UIView CreateTextView(UITextField textField, string placeholderText, string text, RectangleF rectF, GetLocationActions locActions){ UIView uiView = new UIView (rectF); uiView.MultipleTouchEnabled = true; textField.Frame = new RectangleF (20, 0, this.View.Bounds.Width-110, 30); textField.Font = font12; textField.Placeholder = placeholderText; textField.Text = text; textField.BorderStyle = UITextBorderStyle.RoundedRect; textField.Enabled = true; uiView.AddSubview (textField); GlassButton gbLoc = new GlassButton (new RectangleF (textField.Bounds.Width + 20 + 5, 0, 80, 30)); if (locActions != GetLocationActions.None) { gbLoc.Font = font10; gbLoc.NormalColor = UIColor.Brown; gbLoc.SetTitle ("Use Location", UIControlState.Normal); gbLoc.Enabled = true; gbLoc.Tapped += delegate { textField.Enabled = false; if (locActions == GetLocationActions.UpdateTraffic) { gbBlocked.Enabled = false; gbHeavy.Enabled = false; gbNormal.Enabled = false; gbLow.Enabled = false; } else if (locActions == GetLocationActions.SetOrigin) { gbViewTraffic.Enabled = false; } else if (locActions == GetLocationActions.SetDestination) { gbViewTraffic.Enabled = false; } GetLocation (locActions, textField); }; uiView.AddSubview (gbLoc); } return uiView; }
UIView CreateButtonView(RectangleF rectF){ UIView uiView = new UIView (rectF); uiView.MultipleTouchEnabled = true; gbViewTraffic = new GlassButton (new RectangleF ((this.View.Bounds.Width-100)/2, 0, 100, 35)); gbViewTraffic.Font = font12; gbViewTraffic.NormalColor = UIColor.Blue; gbViewTraffic.SetTitle ("View Traffic", UIControlState.Normal); gbViewTraffic.Enabled = true; gbViewTraffic.Tapped += delegate{new TrafficViewDialogViewController(tu, tfOrigin.Text, tfDestination.Text);}; uiView.AddSubview (gbViewTraffic); return uiView; }
UIView CreateHeaderView (Dictionary<string, RectangleF> dicRect, int iViewHeight) { UIView uiView = new UIView (new RectangleF (0, 0, this.View.Bounds.Width, iViewHeight)); uiView.MultipleTouchEnabled = true; gbBlocked = new GlassButton (dicRect["blocked"]); gbBlocked.Font = font12; gbBlocked.SetTitle ("Blocked", UIControlState.Normal); gbBlocked.NormalColor = UIColor.Red; gbBlocked.Enabled = true; gbBlocked.Tapped += delegate{ CheckChannel(TrafficUpdates.TrafficMessage.Blocked); }; uiView.AddSubview (gbBlocked); gbHeavy = new GlassButton (dicRect["heavy"]); gbHeavy.Font = font12; gbHeavy.SetTitle ("Heavy", UIControlState.Normal); gbHeavy.Enabled = true; gbHeavy.NormalColor = UIColor.Orange; gbHeavy.Tapped += delegate{ CheckChannel(TrafficUpdates.TrafficMessage.Heavy); }; uiView.AddSubview (gbHeavy); gbNormal = new GlassButton (dicRect["normal"]); gbNormal.Font = font12; gbNormal.NormalColor = UIColor.FromRGB(0, 255, 0); gbNormal.SetTitle ("Normal", UIControlState.Normal); gbNormal.Enabled = true; gbNormal.Tapped += delegate{ CheckChannel(TrafficUpdates.TrafficMessage.Normal); }; uiView.AddSubview (gbNormal); gbLow = new GlassButton (dicRect["low"]); gbLow.Font = font12; gbLow.NormalColor = UIColor.Purple; gbLow.SetTitle ("Low", UIControlState.Normal); gbLow.Enabled = true; gbLow.Tapped += delegate{ CheckChannel(TrafficUpdates.TrafficMessage.Low); }; uiView.AddSubview (gbLow); return uiView; }
public UIViewController GetPage(int i) { var card = _GetOrderedCardByIndex(i); UIViewController viewController = new ScrollableViewController(); viewController.View.BackgroundColor = ScreenResolutionMatcher.BackgroundColorFromImage(); _scrollView = new UIScrollView() { Frame = ScreenResolutionMatcher.FullViewFrame(), ContentSize = ScreenResolutionMatcher.ViewFrame(), ScrollEnabled = true }; _scrollView.AddSubview(new CardView(card)); var matchDetailView = new MatchDetailView(); int verticalOffset = 68 + ScreenResolutionMatcher.ContentViewStartingY(); int offset = (card.Matches.Count <= 10) ? 28 : 26; if (card.IsEditable()) { var sorted_matches = card.Matches.OrderBy(m => m.MatchId); foreach (var match in sorted_matches) { UIView[] matches; if (card.IsKnockout) { if (match.IsEditable ()) matches = matchDetailView.BuildForEdit (match, verticalOffset); else if (match.HasRealScore()) matches = matchDetailView.BuildForPublished(match, verticalOffset); else matches = matchDetailView.BuildForReadOnly(match, verticalOffset); } else matches = matchDetailView.BuildForEdit(match, verticalOffset); verticalOffset += offset; _scrollView.AddSubviews(matches); } var submitCardButton = new GlassButton(new RectangleF (10, ScreenResolutionMatcher.PushedToBottomButtonY(), 300, 40)) { NormalColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f), HighlightedColor = UIColor.Black }; submitCardButton.SetTitle("Guardar Tarjeta", UIControlState.Normal); submitCardButton.Font = UIFont.BoldSystemFontOfSize(14); submitCardButton.Tapped += delegate(GlassButton button) { var firstResponder = button.Superview.FindFirstResponder(); if (firstResponder != null) firstResponder.ResignFirstResponder(); //app could have been open for a while, and card might no longer be editable if (card.IsEditable()) { if (card.IsKnockout) { card = StripOverdueMatches(card); } AppManager.Current.CardsService.SubmitCard(card); } else new UIAlertView(Constants.APP_TITLE, "La fecha ya ha cerrado.", null, "Ok").Show(); }; _scrollView.AddSubview(submitCardButton); } else if (card.IsPublished()) { foreach (var match in card.Matches) { var matches = matchDetailView.BuildForPublished(match, verticalOffset); verticalOffset += offset; _scrollView.AddSubviews(matches); } _scrollView.AddSubview( new UILabel{ Text = string.Format("Fecha cerrada. Obtuviste {0} puntos!", card.Points), TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,ScreenResolutionMatcher.PushedToBottomButtonY(),300,40), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(17), BackgroundColor = UIColor.Clear }); } else { foreach (var match in card.Matches) { var matches = matchDetailView.BuildForReadOnly(match, verticalOffset); verticalOffset += offset; _scrollView.AddSubviews(matches); } _scrollView.AddSubview( new UILabel{ Text = "Fecha cerrada. Pronto sabrás tus puntos!", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,ScreenResolutionMatcher.PushedToBottomButtonY(),300,40), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(15), BackgroundColor = UIColor.Clear }); } if (card.IsKnockout) { _scrollView.AddSubview( new UILabel{ Text = string.Format("Total tarjeta Brasil 2014: {0} puntos!", card.Points), TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,ScreenResolutionMatcher.PushedToBottomButtonY()-40,300,40), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(17), BackgroundColor = UIColor.Clear }); } viewController.View.AddSubview(_scrollView); // viewController.View.AddSubview(new UIImageView() { // Frame = new RectangleF(5,0,16,30), // Image = UIImage.FromFile("Images/Arrow.png") // }); return viewController; }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = ScreenResolutionMatcher.BackgroundColorFromImage(); View.AddSubviews( new UILabel{ Text = "Bienvenido a ComunidadProde!!", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(0,0,320,50), Lines = 1, TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(18), BackgroundColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f) }, new UILabel{ Text = "Estas viendo esta guía porque vemos que aún no has comenzado a jugar.", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,60,300,40), Lines = 2, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(15), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "Para ello, simplemente entrá en www.comunidadprode.com.ar, y dentro de 'Mis Tarjetas', guardá tu primer tarjeta en el torneo que desees", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,120,300,80), Lines = 4, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(15), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "Si tenes preguntas, podes visitar la ayuda en la web, o bien contactarnos por las redes sociales!", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,220,300,60), Lines = 3, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(15), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "@comunidadprode", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,280,300,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(12), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "facebook.com/comuprode", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,300,300,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(12), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "*****@*****.**", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,320,300,20), TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(12), BackgroundColor = UIColor.Clear }, new UILabel{ Text = "Gracias por ser parte de la comunidad!!", TextAlignment = UITextAlignment.Center, Frame = new RectangleF(10,360,300,40), Lines = 2, TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(18), BackgroundColor = UIColor.Clear } ); var logoutButton = new GlassButton(new RectangleF (10, 410, 300, 40)) { NormalColor = UIColor.FromRGBA(222/255f, 222/255f, 225/255f, 0.25f), HighlightedColor = UIColor.Black }; logoutButton.SetTitle("Cerrar Sesión", UIControlState.Normal); logoutButton.Font = UIFont.BoldSystemFontOfSize(14); logoutButton.Tapped += delegate { AppManager.Current.Logout(); }; View.AddSubview(logoutButton); }