private void CreateTweetView(string tweet) { var boxWidth = View.Bounds.Width - 30 - PadX * 2; var tweetRect = new RectangleF(PadX, 0, boxWidth, 100); var tweetView = new TweetView(tweetRect, tweet, (t) => { string url = t.Value; switch (t.Type) { case TweetView.TweetType.Url: break; case TweetView.TweetType.Mention: url = "http://twitter.com/" + t.Value; break; case TweetView.TweetType.Hashtag: url = "http://twitter.com/search/" + Uri.EscapeDataString(t.Value); break; } WebViewController.OpenUrl(this, url, true /* enableTitle */); }, null); _tweetBox = new UIViewElement("Twitter", tweetView, false); }
private void TogglePicker(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var sectionAndIndex = GetMySectionAndIndex(dvc); if (sectionAndIndex.Key != null) { Section section = sectionAndIndex.Key; int index = sectionAndIndex.Value; var cell = tableView.CellAt(path); if (isPickerPresent) { // Remove the picker. cell.DetailTextLabel.TextColor = UIColor.Gray; section.Remove(datePickerContainer); isPickerPresent = false; } else { // Show the picker. cell.DetailTextLabel.TextColor = UIColor.Red; datePickerContainer = new UIViewElement(string.Empty, datePicker, false); section.Insert(index + 1, UITableViewRowAnimation.Bottom, datePickerContainer); isPickerPresent = true; } } }
Section CreateButtonSection(float labelHeight, float containerWidth) { Section buttonSection = new Section(); GlassButton button = new GlassButton(new RectangleF(0, 0, containerWidth, labelHeight)); button.SetTitleColor(UIColor.FromRGBA(255, 255, 0, 255), UIControlState.Normal); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.SetTitle("Create Dataset", UIControlState.Normal); button.TouchUpInside += (o, e) => { string name = _name.Summary(); if (string.IsNullOrEmpty(name)) { //show an alert if data is not filled new UIAlertView(string.Empty, "Enter a name", null, "OK", null).Show(); } else { // navigate to next screen MXTouchContainer.Navigate("Dashboard/CreateData/" + name); } }; UIViewElement imageElement = new UIViewElement(string.Empty, button, true); imageElement.Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent; buttonSection.Add(imageElement); return(buttonSection); }
Section CreateNoDataImageSection(float labelHeight, float containerWidth) { //Section w/ a the No Data image var imageSection = new Section(); var loc = new PointF(0, 10); var size = new SizeF(containerWidth, 130); var viewRect = new RectangleF(loc, size); UIView containingView = new UIView(viewRect); containingView.Layer.CornerRadius = 15f; containingView.BackgroundColor = UIColor.White; containingView.Layer.BorderWidth = 5.0f; containingView.Layer.BorderColor = new CGColor(0.5f, 1.0f); float centering = (containerWidth - 86) / 2; var imgNoData = new UIImageView(new RectangleF(centering, 10, 86, 75)); imgNoData.Image = UIImage.FromFile("images/WarningIcon.png"); containingView.Add(imgNoData); var noDataLabel = new UILabel(new RectangleF(0, 76, containerWidth, labelHeight)); noDataLabel.Text = "No Data Available"; noDataLabel.BackgroundColor = UIColor.Clear; noDataLabel.TextAlignment = UITextAlignment.Center; containingView.Add(noDataLabel); UIViewElement warningImageElement = new UIViewElement(string.Empty, containingView, true); warningImageElement.Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent; imageSection.Add(warningImageElement); return(imageSection); }
void InitializeContent() { if (authMethod == "Firebase") { txtEmail = new EntryElement("Email", string.Empty, user.Email); lblEmailVerified = new StyledStringElement(string.Empty) { Alignment = UITextAlignment.Center, Font = UIFont.FromName("System-Bold", 13), BackgroundColor = UIColor.White }; txtPassword = new EntryElement("Password", string.Empty, string.Empty, true); txtPasswordVerify = new EntryElement("Password Verify", string.Empty, string.Empty, true); } lblProvider = new StringElement("Provider", user.ProviderId); lblUid = new StringElement("UID", user.Uid); txtName = new EntryElement("Name", string.Empty, user.DisplayName); txtPhotoUrl = new EntryElement("Photo Url", string.Empty, user.PhotoUrl?.AbsoluteString); photo = new UIImageView(new CGRect(0, 0, 128, 128)) { ContentMode = UIViewContentMode.ScaleAspectFit, Image = UIImage.FromFile("user.png") }; imgPhotoContainer = new UIViewElement(string.Empty, photo, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent }; indicatorView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { Frame = new CGRect(0, 0, 128, 128), BackgroundColor = UIColor.FromRGBA(127, 127, 127, 127), HidesWhenStopped = true, TranslatesAutoresizingMaskIntoConstraints = false }; }
public void DemoInsets() { var uiView = new UIViewElement("", new UIView(new RectangleF(0, 0, 20, 20)) { BackgroundColor = UIColor.Red }, false); var root = new RootElement("UIViewElement Inset") { new Section("Simple Rectangle") { uiView, new StringElement("Pad Left", delegate { var i = uiView.Insets; i.Left += 10; uiView.Insets = i; }), new StringElement("Pad Top", delegate { var i = uiView.Insets; i.Top += 10; uiView.Insets = i; }), new StringElement("Pad Bottom", delegate { var i = uiView.Insets; i.Bottom += 10; uiView.Insets = i; }) } }; var dv = new DialogViewController(root, true); navigation.PushViewController(dv, true); }
private DialogViewController GetDialog(Listing item) { var prRow = new StyledStringElement( string.Format("Make: {0}", item.make), string.Format("${0}", item.price.ToString()), UITableViewCellStyle.Value1 ); var mileSource = new StyledStringElement( string.Format("Mileage : {0} mi", item.mileage.ToString()), string.Format("source: {0}", item.source), UITableViewCellStyle.Subtitle ); var line = new UIViewElement("", new UIView(new RectangleF(10, 0, ContentView.Bounds.Size.Width - 20, 1)) { BackgroundColor = UIColor.DarkGray }, false); //var desc = new MultilineElement ("", item.description); //svar carImg = new UIViewElement ("",img,false); var root = new RootElement("RootCell") { new Section() { prRow, mileSource, line, } }; var vc = new DialogViewController(root); vc.View.Frame = new RectangleF(0, 200, ContentView.Bounds.Size.Width, 200); return(vc); }
public static Element CreateGlassButtonElement(GlassButton button) { UIViewElement imageElement = new UIViewElement(null, button, true); imageElement.Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent; return imageElement; }