private void ShowSecretsView() { var secret = currentSecret; RootElement root = CreateRootElement(); rootDVC = new StyledDialogViewController(root, null, backgroundColor) { Autorotate = true, HidesBottomBarWhenPushed = true }; rootDVC.ViewAppearing += (sender, e) => { server.Abort(); currentSecret = null; NSError err; Analytics.SharedTracker.TrackPageView("/secrets", out err); ReOrderSecrets(); }; var aboutButton = UIHelper.CreateInfoButton(40f, 60f); aboutButton.TouchDown += (sender, e) => { ShowAboutView(); }; rootDVC.View.AddSubview(aboutButton); navigation = new UINavigationController(); Flurry.LogAllPageViews(navigation); navigation.SetNavigationBarHidden(true, false); navigation.PushViewController(rootDVC, false); window.RootViewController = navigation; if (ResharedItem != null) { var sbounds = UIScreen.MainScreen.Bounds; var btnCancel = UIButton.FromType(UIButtonType.RoundedRect); btnCancel.Tag = CANCEL_BUTTON_TAG; btnCancel.Frame = new RectangleF( 10, sbounds.Height - 60f, 100, 30 ); btnCancel.SetTitle("Cancel", UIControlState.Normal); btnCancel.SetTitleColor(UIColor.Black, UIControlState.Normal); btnCancel.TouchDown += delegate { ResharedItem = null; if (rootDVC.View.ViewWithTag(CANCEL_BUTTON_TAG) != null) { rootDVC.View.ViewWithTag(CANCEL_BUTTON_TAG).RemoveFromSuperview(); } UpdateSecretsViewLabel(WELCOME_LABEL_TEXT); DisplaySecretDetail(secret); }; rootDVC.View.AddSubview(btnCancel); UpdateSecretsViewLabel(String.Format(SHARE_LABEL_TEXT, UrlHelper.GetFileName(ResharedItem.ItemPath))); } }
private void ShowAboutView() { var captionLabel = UIHelper.CreateLabel( "about", true, 32, 32, UITextAlignment.Center, UIColor.Black ); captionLabel.Frame = new Rectangle(0, 10, 320, 40); UIView header = new UIView(new Rectangle(0, 0, 300, 40)); header.AddSubviews(captionLabel); var closeButton = new StyledStringElement("Close"); closeButton.BackgroundColor = UIColor.LightGray; closeButton.Alignment = UITextAlignment.Center; closeButton.Tapped += delegate { navigation.DismissModalViewControllerAnimated(true); }; var root = new RootElement("About") { new Section(header), new Section(UIHelper.CreateHtmlView("About.html", 290f, 300f)), new Section() { closeButton } }; root.UnevenRows = true; var dvc = new StyledDialogViewController(root, null, backgroundColor) { Autorotate = true, }; navigation.PresentModalViewController(dvc, true); }
private void DisplaySecretDetail(Secret s) { NSError error; Analytics.SharedTracker.TrackPageView("/session", out error); var subRoot = new RootElement(s.Phrase) { (shareSection = new Section("Keep on server (1 min)") { (pickPhoto = new StyledStringElement("Photo", delegate { ShowImagePicker(); })), (dataEntry = new AdvancedEntryElement("Text", "your message", null)) }), (entriesSection = new Section("History")) }; pickPhoto.Accessory = UITableViewCellAccessory.DisclosureIndicator; dataEntry.ShouldReturn += delegate { UIApplication.SharedApplication.InvokeOnMainThread(delegate { dataEntry.GetContainerTableView().EndEditing(true); } ); server.Send(dataEntry.Value.Trim()); return(true); }; dataEntry.ReturnKeyType = UIReturnKeyType.Send; entriesSection.Elements.AddRange( from d in s.DataItems select((Element)CreateDataItemElement(d)) ); subRoot.UnevenRows = true; sectionDVC = new StyledDialogViewController( subRoot, true, null, backgroundColor ); sectionDVC.HidesBottomBarWhenPushed = false; navigation.SetNavigationBarHidden(false, true); navigation.PushViewController(sectionDVC, true); server.CurrentSecret = s; currentSecret = s; server.Listen(); currentSecret.WatchEvent += (secret) => { int count = secret.ListenersCount - 1; string pattern = "Keep on server (1 min)"; if (count > 0) { pattern = (count) > 1 ? "Share with {0} devices" : "Share with {0} device"; } UIApplication.SharedApplication.InvokeOnMainThread(delegate { shareSection.Caption = string.Format(pattern, count); if (sectionDVC != null) { sectionDVC.ReloadData(); } } ); }; sectionDVC.ViewAppearing += delegate { if (navigation.View.ViewWithTag(SHARE_BUTTON_TAG) != null) { navigation.View.ViewWithTag(SHARE_BUTTON_TAG).RemoveFromSuperview(); } }; if (ResharedItem != null) { ReshareData(); } }