public FlyOutNavigationController() { navigation = new DialogViewController(UITableViewStyle.Plain,null); navigation.OnSelection = NavigationItemSelected; var navFrame = navigation.View.Frame; navFrame.Width = menuWidth; navigation.View.Frame = navFrame; this.View.AddSubview(navigation.View); SearchBar = new UISearchBar (new RectangleF (0, 0, navigation.TableView.Bounds.Width, 44)) { //Delegate = new SearchDelegate (this), TintColor = this.TintColor }; TintColor = UIColor.Black; //navigation.TableView.TableHeaderView = SearchBar; navigation.TableView.TableFooterView = new UIView(new RectangleF(0,0,100,100)){BackgroundColor = UIColor.Clear}; navigation.TableView.ScrollsToTop = false; shadowView = new UIView(); shadowView.BackgroundColor = UIColor.White; shadowView.Layer.ShadowOffset = new System.Drawing.SizeF(-5,-1); shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowOpacity = .75f; closeButton = new UIButton(); closeButton.TouchDown += delegate { HideMenu(); }; }
public TestCaseElement (TestMethod testCase, TouchRunner runner) : base (testCase, runner) { Caption = testCase.Name; Value = "NotExecuted"; this.Tapped += async delegate { if (!Runner.OpenWriter (Test.FullName)) return; var suite = (testCase.Parent as TestSuite); var context = TestExecutionContext.CurrentContext; context.TestObject = Reflect.Construct (testCase.Method.ReflectedType, null); await suite.GetOneTimeSetUpCommand ().Execute (context); await Run (); await suite.GetOneTimeTearDownCommand ().Execute (context); Runner.CloseWriter (); // display more details on (any) failure (but not when ignored) if ((TestCase.RunState == RunState.Runnable) && !Result.IsSuccess ()) { var root = new RootElement ("Results") { new Section () { new TestResultElement (Result) } }; var dvc = new DialogViewController (root, true) { Autorotate = true }; runner.NavigationController.PushViewController (dvc, true); } else if (GetContainerTableView () != null) { var root = GetImmediateRootElement (); root.Reload (this, UITableViewRowAnimation.Fade); } }; }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { Value = !Value; var cell = tableView.CellAt (path); ConfigCell (cell); base.Selected (dvc, tableView, path); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { _window = new UIWindow (UIScreen.MainScreen.Bounds); _quantityGroup = new RadioGroup("Qty", 0); _fromUnitGroup = new RadioGroup("FromU", 0); _toUnitGroup = new RadioGroup("ToU", 0); var quantityRootElement = new RootElement("Quantity", _quantityGroup) { new Section() }; quantityRootElement[0].AddAll(QuantityCollection.Quantities.Select(qty => { var elem = new EventHandlingRadioElement(qty.Quantity.DisplayName, "Qty"); elem.OnSelected += OnQuantitySelected; return elem as Element; })); _rootElement = new RootElement ("Unit Converter") { new Section() { quantityRootElement }, new Section("From") { new EntryElement("Amount", string.Empty, string.Empty), new RootElement("Unit", _fromUnitGroup) { new Section() } }, new Section("To") { new EntryElement("Amount", string.Empty, string.Empty), new RootElement("Unit", _toUnitGroup) { new Section() } } }; _rootVC = new DialogViewController(_rootElement); _nav = new UINavigationController(_rootVC); _window.RootViewController = _nav; _window.MakeKeyAndVisible(); return true; }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { Value = !Value; InitializeCell(tableView); base.Selected(dvc, tableView, path); }
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; } } }
public UIViewController GetViewController () { var network = new BooleanElement ("Remote Server", EnableNetwork); var host = new EntryElement ("Host Name", "name", HostName); host.KeyboardType = UIKeyboardType.ASCIICapable; var port = new EntryElement ("Port", "name", HostPort.ToString ()); port.KeyboardType = UIKeyboardType.NumberPad; var root = new RootElement ("Options") { new Section () { network, host, port } }; var dv = new DialogViewController (root, true) { Autorotate = true }; dv.ViewDissapearing += delegate { EnableNetwork = network.Value; HostName = host.Value; ushort p; if (UInt16.TryParse (port.Value, out p)) HostPort = p; else HostPort = -1; var defaults = NSUserDefaults.StandardUserDefaults; defaults.SetBool (EnableNetwork, "network.enabled"); defaults.SetString (HostName ?? String.Empty, "network.host.name"); defaults.SetInt (HostPort, "network.host.port"); }; return dv; }
public override void ViewDidLoad () { if (!this.propertiesAssigned) { return; } base.ViewDidLoad (); // speakers tab if (AppDelegate.IsPhone) { this.speakersScreen = this.ObjectFactory.Create<PatientListViewController>(new NamedParameterOverloads { { "patientSplitViewController", null } }); this.speakerNav = this.ObjectFactory.Create<UINavigationController>(); this.speakerNav.TabBarItem = new UITabBarItem("Patients" , UIImage.FromBundle("Images/Tabs/speakers.png"), 1); this.speakerNav.PushViewController ( this.speakersScreen, false ); } else { this.speakersSplitView = this.ObjectFactory.Create<PatientSplitViewController>(); this.speakersSplitView.TabBarItem = new UITabBarItem("Patients" , UIImage.FromBundle("Images/Tabs/speakers.png"), 1); } // about tab this.aboutScreen = new AboutView(); this.aboutScreen.TabBarItem = new UITabBarItem("About Xamarin" , UIImage.FromBundle("Images/Tabs/about.png"), 8); UIViewController[] viewControllers; // create our array of controllers if (AppDelegate.IsPhone) { viewControllers = new UIViewController[] { this.speakerNav, this.aboutScreen }; } else { // IsPad viewControllers = new UIViewController[] { this.speakersSplitView, this.aboutScreen }; } // attach the view controllers this.ViewControllers = viewControllers; // tell the tab bar which controllers are allowed to customize. // if we don't set it assumes all controllers are customizable. // if we set to empty array, NO controllers are customizable. this.CustomizableViewControllers = new UIViewController[] {}; // set our selected item if (AppDelegate.IsPhone) { this.SelectedViewController = this.speakerNav; } else { this.SelectedViewController = this.speakersSplitView; } }
// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching (UIApplication app, NSDictionary options) { var Last = new DateTime (2010, 10, 7); Console.WriteLine (Last); window.AddSubview (navigation.View); var menu = new RootElement ("Demos"){ new Section ("Element API"){ new StringElement ("iPhone Settings Sample", DemoElementApi), new StringElement ("Dynamically load data", DemoDynamic), new StringElement ("Add/Remove demo", DemoAddRemove), new StringElement ("Assorted cells", DemoDate), }, new Section ("Auto-mapped", footer){ new StringElement ("Reflection API", DemoReflectionApi) }, new Section ("Other"){ new StringElement ("Headers and Footers", DemoHeadersFooters) } }; var dv = new DialogViewController (menu); navigation.PushViewController (dv, true); window.MakeKeyAndVisible (); return true; }
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; }
public PickerElement (string caption, object[] Items , string DisplayMember, DialogViewController dvc) : base (caption, null, null) { this.Dvc = dvc; this.ComboBox = new UIComboBox(RectangleF.Empty); this.ComboBox.Items = Items; this.ComboBox.DisplayMember = DisplayMember; this.ComboBox.TextAlignment = UITextAlignment.Right; this.ComboBox.BorderStyle = UITextBorderStyle.None; this.ComboBox.PickerClosed += delegate { if (Dvc != null && doneButtonVisible) { Dvc.NavigationItem.RightBarButtonItem = oldRightBtn; doneButtonVisible = false; } RestoreTableView(); }; this.ComboBox.ValueChanged += delegate { Value = ComboBox.Text; RefreshValue(); if (ValueChanged != null) { ValueChanged(this, null); } }; this.ComboBox.PickerFadeInDidFinish += delegate { if (modifiedHeightOffset == 0f && !ComboBox.IsHiding) { // adjust size. var ff = Dvc.TableView.Frame; modifiedHeightOffset = 200f; Dvc.TableView.Frame = new RectangleF(ff.X, ff.Y, ff.Width, ff.Height - modifiedHeightOffset); Dvc.TableView.ScrollToRow (IndexPath, UITableViewScrollPosition.Middle, true); } }; Value = ComboBox.Text; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); var root = new RootElement("MBProgressHUD") { new Section ("Samples") { new StringElement ("Simple indeterminate progress", ShowSimple), new StringElement ("With label", ShowWithLabel), new StringElement ("With details label", ShowWithDetailsLabel), new StringElement ("Determinate mode", ShowWithLabelDeterminate), new StringElement ("Annular determinate mode", ShowWIthLabelAnnularDeterminate), new StringElement ("Custom view", ShowWithCustomView), new StringElement ("Mode switching", ShowWithLabelMixed), new StringElement ("Using handlers", ShowUsingHandlers), new StringElement ("On Window", ShowOnWindow), new StringElement ("NSURLConnection", ShowUrl), new StringElement ("Dim background", ShowWithGradient), new StringElement ("Text only", ShowTextOnly), new StringElement ("Colored", ShowWithColor), } }; dvcDialog = new DialogViewController(UITableViewStyle.Grouped, root, false); navController = new UINavigationController(dvcDialog); window.RootViewController = navController; window.MakeKeyAndVisible (); return true; }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); InitListOfImages (); var root = new RootElement ("SDWebImage Sample") { new Section () }; int count = 0; foreach (var item in objects) { count++; string url = item; var imgElement = new ImageLoaderStringElement ( caption: string.Format ("Image #{0}", count), tapped: () => { HandleTapped (url); }, imageUrl: new NSUrl (url), placeholder: UIImage.FromBundle ("placeholder") ); root[0].Add (imgElement); } dvcController = new DialogViewController (UITableViewStyle.Plain, root); dvcController.NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Clear Cache", UIBarButtonItemStyle.Plain, ClearCache); navController = new UINavigationController (dvcController); window.RootViewController = navController; window.MakeKeyAndVisible (); return true; }
public PopoverContentViewController(SizeF contentSizeForViewInPopover) { _contentSizeForViewInPopover = contentSizeForViewInPopover; QuickFillCore quickFillCore = QuickFillManager.GetQuickFillCore (); var quickFillNames = quickFillCore.QuickFillNames; var styleHeaderElement = new Section ("Style Header") { new RootElement ("Manual Entry", rt => GetNewDialog(StyleEntityManager.GetManualEntry())) }; var quickFillElement = new Section ("Quick Fill"); var quickFills = StyleEntityManager.GetQuickFills (quickFillCore); var styleDialogs = new List<RootElement> (); for (int i = 0; i < quickFillNames.Count; i++) { var style = GetNewDialog (quickFills [i]); var rootElement = new RootElement (quickFillNames [i], rt => style); styleDialogs.Add (rootElement); } quickFillElement.AddAll (styleDialogs); var rootStyles = new RootElement ("Add New Styles"); rootStyles.Add (new [] { styleHeaderElement, quickFillElement }); var rootDialog = new DialogViewController (rootStyles); rootDialog.NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, HandlePopoverCancelledEvent), true); this.SetViewControllers (new [] { rootDialog }, true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); var web = new WebElement (); web.HtmlFile = "instructions"; var root = new RootElement ("Kannada Keyboard") { new Section{ new UIViewElement("Instruction", web.View, false) } }; var dv = new DialogViewController (root) { Autorotate = true }; var navigation = new UINavigationController (); navigation.PushViewController (dv, true); window = new UIWindow (UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible (); window.AddSubview (navigation.View); return true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { exampleInfoList = ExampleLibrary.Examples.GetList(); // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); navigation = new UINavigationController(); var root = new RootElement ("OxyPlot Demo") { new Section() { from e in exampleInfoList group e by e.Category into g orderby g.Key select (Element)new StyledStringElement (g.Key, delegate { DisplayCategory(g.Key); }) { Accessory = UITableViewCellAccessory.DisclosureIndicator } } }; var dvc = new DialogViewController (root, true); navigation.PushViewController(dvc, true); window.RootViewController = navigation; // make the window visible window.MakeKeyAndVisible (); return true; }
public RepMaxView(Exercise exerciseToShow) : base("RepMaxView", null) { this._exercise = exerciseToShow; this._share = new RMShare(this); largestRMValue = 0.0; string dbname = "onerm.db"; string documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // This goes to the documents directory for your app string dbPath = Path.Combine (documents, dbname); db = new SQLiteConnection (dbPath); this.LoadRecords(); this._logRoot = new RootElement ("Records"); this._dvc = new DialogViewController (UITableViewStyle.Plain, this._logRoot, false); // load data from list this._logSect = new Section (); foreach (RmLog rm in this._rms) { StringElement recordString = new StringElement (rm.Weight.ToString(), rm.DateLogged.ToShortDateString()); this._logSect.Add(recordString); } this._logRoot.Add(this._logSect); }
public void EchoDicomServer() { RootElement root = null; Section resultSection = null; var hostEntry = new EntryElement("Host", "Host name of the DICOM server", "server"); var portEntry = new EntryElement("Port", "Port number", "104"); var calledAetEntry = new EntryElement("Called AET", "Called application AET", "ANYSCP"); var callingAetEntry = new EntryElement("Calling AET", "Calling application AET", "ECHOSCU"); var echoButton = new StyledStringElement("Click to test", delegate { if (resultSection != null) root.Remove(resultSection); string message; var echoFlag = DoEcho(hostEntry.Value, Int32.Parse(portEntry.Value), calledAetEntry.Value, callingAetEntry.Value, out message); var echoImage = new ImageStringElement(String.Empty, echoFlag ? new UIImage("yes-icon.png") : new UIImage("no-icon.png")); var echoMessage = new StringElement(message); resultSection = new Section(String.Empty, "C-ECHO result") { echoImage, echoMessage }; root.Add(resultSection); }) { Alignment = UITextAlignment.Center, BackgroundColor = UIColor.Blue, TextColor = UIColor.White }; root = new RootElement("Echo DICOM server") { new Section { hostEntry, portEntry, calledAetEntry, callingAetEntry}, new Section { echoButton }, }; var dvc = new DialogViewController (root, true) { Autorotate = true }; navigation.PushViewController (dvc, true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); root = new RootElement ("To Do List"){new Section()}; rootVC = new DialogViewController (root); nav = new UINavigationController(rootVC); btnAdd = new UIBarButtonItem (UIBarButtonSystemItem.Add); rootVC.NavigationItem.RightBarButtonItem = btnAdd; btnAdd.Clicked += (sender, e) => { ++n; var task = new Task{Name = "task" + n, DueDate = DateTime.Now}; var taskElement = new RootElement(task.Name){ new Section (){ new EntryElement (task.Name, "Enter task description", task.Description) }, new Section(){ new DateElement("Due Date", task.DueDate) } }; root[0].Add (taskElement); }; viewController = new to_do_listViewController (); window.RootViewController = nav; window.MakeKeyAndVisible (); return true; }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { base.Selected(dvc, tableView, path); if (Tapped != null) Tapped(); tableView.DeselectRow (path, true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { exampleInfoList = ExampleLibrary.Examples.GetList(); // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); navigation = new UINavigationController(); var root = new RootElement ("OxyPlot Example Browser"); var section = new Section (); section.AddAll (exampleInfoList .GroupBy (e => e.Category) .OrderBy (g => g.Key) .Select (g => (Element)new StyledStringElement (g.Key, delegate { DisplayCategory (g.Key); }) { Accessory = UITableViewCellAccessory.DisclosureIndicator })); root.Add (section); var dvc = new DialogViewController (root, true); navigation.PushViewController(dvc, true); window.RootViewController = navigation; // make the window visible window.MakeKeyAndVisible (); return true; }
public void DemoElementApi () { var root = CreateRoot (); var dv = new DialogViewController (root, true); navigation.PushViewController (dv, true); }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (IsReadonly) { base.Selected (dvc, tableView, path); return; } var controller = new UIViewController (); UITextView disclaimerView = new UITextView (controller.View.Frame); // disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0); // disclaimerView.TextColor = UIColor.White; // disclaimerView.TextAlignment = UITextAlignment.Left; if (!string.IsNullOrWhiteSpace (Value)) disclaimerView.Text = Value; else disclaimerView.Text = string.Empty; disclaimerView.Font = UIFont.SystemFontOfSize (16f); disclaimerView.Editable = true; controller.View.AddSubview (disclaimerView); controller.NavigationItem.Title = Caption; controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => { if (OnSave != null) OnSave (this, EventArgs.Empty); controller.NavigationController.PopViewControllerAnimated (true); Value = disclaimerView.Text; }); dvc.ActivateController (controller); }
public LoginPageRenderer() { dialog = new DialogViewController(new RootElement("Login")); window = new UIWindow(UIScreen.MainScreen.Bounds); window.RootViewController = new UINavigationController(dialog); window.MakeKeyAndVisible(); if (App.IsGoogleLogin && !App.IsLoggedIn) { var myAuth = new GoogleAuthenticator("730990345527-h7r23gcdmdllgke4iud4di76b0bmpnbb.apps.googleusercontent.com", "https://www.googleapis.com/auth/userinfo.email", "https://accounts.google.com/o/oauth2/auth", "https://www.googleapis.com/plus/v1/people/me"); UIViewController vc = myAuth.authenticator.GetUI(); myAuth.authenticator.Completed += async (object sender, AuthenticatorCompletedEventArgs eve) => { //dialog.DismissViewController(true, null); window.Hidden = true; dialog.Dispose(); window.Dispose(); if (eve.IsAuthenticated) { var user = await myAuth.GetProfileInfoFromGoogle(eve.Account.Properties["access_token"].ToString()); await App.SaveUserData(user,true); //dialog.DismissViewController(true, null); App.IsLoggedIn = true; App.SuccessfulLoginAction.Invoke(); } }; dialog.PresentViewController(vc, true, null); } }
public DateTimeElement2 (string caption, DateTime date, DialogViewController dvc) : base (caption, null, null) { this.Dvc = dvc; DateValue = date; // create picker elements datePicker = CreatePicker (); datePicker.Mode = UIDatePickerMode.DateAndTime; datePicker.ValueChanged += delegate { DateValue = datePicker.Date; Value = FormatDate(DateValue); RefreshValue(); if (DateSelected != null) DateSelected (this); }; //datePicker.Frame = PickerFrameWithSize (datePicker.SizeThatFits (SizeF.Empty)); closeBtn = new UIButton(new RectangleF(0,0,31,32)); closeBtn.SetImage(UIImage.FromFile("Images/closebox.png"),UIControlState.Normal); closeBtn.TouchDown += delegate { HidePicker(); }; datePicker.AddSubview(closeBtn); Value = FormatDate (date); this.Alignment = UITextAlignment.Left; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); root = new RootElement ("Dropbox Chooser Demo") { new Section{ new StringElement("Preview", delegate { ChooseFile(DBChooserLinkType.Preview); }), new StringElement("Direct Dowload", delegate { ChooseFile(DBChooserLinkType.Direct); }) }, //This section is used to show results metadata new Section("Metadata"), //This section used to show link and thumbnails new Section("Links and Thumbnails") }; var dv = new DialogViewController (root); navigation = new UINavigationController (); navigation.PushViewController (dv, true); if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0)) window.RootViewController = navigation; else window.AddSubview (navigation.View); window.MakeKeyAndVisible (); return true; }
public override void PushViewController() { var root = CreateRoot(); var dv = new DialogViewController(root,true); PushViewController(dv,true); StopAnimatingHud(); }
public FlyoutNavigationController(UITableViewStyle navigationStyle = UITableViewStyle.Plain) { navigation = new DialogViewController(navigationStyle,null); navigation.OnSelection += NavigationItemSelected; var navFrame = navigation.View.Frame; navFrame.Width = menuWidth; navigation.View.Frame = navFrame; this.View.AddSubview (navigation.View); SearchBar = new UISearchBar (new RectangleF (0, 0, navigation.TableView.Bounds.Width, 44)) { //Delegate = new SearchDelegate (this), TintColor = this.TintColor }; TintColor = UIColor.Black; //navigation.TableView.TableHeaderView = SearchBar; navigation.TableView.TableFooterView = new UIView (new RectangleF (0, 0, 100, 100)){BackgroundColor = UIColor.Clear}; navigation.TableView.ScrollsToTop = false; shadowView = new UIView (); shadowView.BackgroundColor = UIColor.White; shadowView.Layer.ShadowOffset = new System.Drawing.SizeF (-5, -1); shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowOpacity = .75f; closeButton = new UIButton (); closeButton.TouchDown += delegate { HideMenu (); }; AlwaysShowLandscapeMenu = true; this.View.AddGestureRecognizer (new OpenMenuGestureRecognizer (this, new Selector ("panned"), this)); ShouldAutoPushFirstView = true; }
public void DemoHeadersFooters () { var section = new Section () { HeaderView = new UIImageView (UIImage.FromFile ("caltemplate.png")), #if !__TVOS__ FooterView = new UISwitch (new RectangleF (0, 0, 80, 30)), #endif // !__TVOS__ }; // Fill in some data var linqRoot = new RootElement ("LINQ source"){ from x in new string [] { "one", "two", "three" } select new Section (x) { from y in "Hello:World".Split (':') select (Element) new StringElement (y) } }; section.Add (new RootElement ("Desert", new RadioGroup ("desert", 0)){ new Section () { new RadioElement ("Ice Cream", "desert"), new RadioElement ("Milkshake", "desert"), new RadioElement ("Chocolate Cake", "desert") }, }); var root = new RootElement ("Headers and Footers") { section, new Section () { linqRoot } }; var dvc = new DialogViewController (root, true); navigation.PushViewController (dvc, true); }
public override MonoTouch.UIKit.UITableViewCell GetCell(DialogViewController dvc, MonoTouch.UIKit.UITableView tv) { var cell = base.GetCell (dvc, tv); cell.ImageView.Image = ImageStore.GetLocalProfilePicture(Friend.ID); cell.DetailTextLabel.Text = "Shot Count: " + Friend.HitCount; return cell; }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (Url == null) { base.Selected(dvc, tableView, path); return; } tableView.DeselectRow(path, false); if (loading) { return; } var cell = GetActiveCell(); var spinner = StartSpinner(cell); loading = true; var wc = new WebClient(); wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e){ dvc.BeginInvokeOnMainThread(delegate { loading = false; spinner.StopAnimating(); spinner.RemoveFromSuperview(); if (e.Result != null) { try { var obj = JsonValue.Load(new StringReader(e.Result)) as JsonObject; if (obj != null) { var root = JsonElement.FromJson(obj); var newDvc = new DialogViewController(root, true) { Autorotate = true }; PrepareDialogViewController(newDvc); dvc.ActivateController(newDvc); return; } } catch (Exception ee) { Console.WriteLine(ee); } } var alert = new UIAlertView("Error", "Unable to download data", null, "Ok"); alert.Show(); }); }; wc.DownloadStringAsync(new Uri(Url)); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath) { if (Tapped != null) { Tapped(); } base.Selected(dvc, tableView, indexPath); if (DeselectAutomatically) { tableView.DeselectRow(indexPath, true); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow(path, true); if (Animating) { return; } if (Tapped != null) { Animating = true; Tapped(this); } }
/// <summary> /// Creates the UIViewController that will be pushed by this RootElement /// </summary> protected virtual UIViewController MakeViewController() { if (createOnSelected != null) { return(createOnSelected(this)); } var dvc = new DialogViewController(this, true) { Autorotate = true }; ; return(dvc); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (Url == null) { base.Selected(dvc, tableView, path); return; } tableView.DeselectRow(path, false); if (loading) { return; } var cell = GetActiveCell(); var spinner = StartSpinner(cell); loading = true; var request = new NSUrlRequest(new NSUrl(Url), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60); /*var connection = */ new NSUrlConnection(request, new ConnectionDelegate((data, error) => { loading = false; spinner.StopAnimating(); spinner.RemoveFromSuperview(); if (error == null) { try { var obj = JsonValue.Load(new StreamReader(data)) as JsonObject; if (obj != null) { var root = JsonElement.FromJson(obj); var newDvc = new DialogViewController(root, true) { Autorotate = true }; PrepareDialogViewController(newDvc); dvc.ActivateController(newDvc); return; } } catch (Exception ee) { Console.WriteLine(ee); } } var alertController = UIAlertController.Create("Error", "Unable to download data", UIAlertControllerStyle.Alert); alertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) => { })); UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertController, true, () => { }); })); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { // Lazy load it if (leaderboardController == null) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); }; dvc.PresentModalViewController(leaderboardController, true); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (!Url.StartsWith("http:")) { tableView.DeselectRow(path, false); UIApplication.SharedApplication.OpenUrl(nsUrl); return; } var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; web = new UIWebView(UIScreen.MainScreen.ApplicationFrame) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) { web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); } }; vc.NavigationItem.Title = Caption; vc.View = web; dvc.ActivateController(vc, dvc); web.LoadRequest(NSUrlRequest.FromUrl(nsUrl)); }
/// <summary> /// Creates the UIViewController that will be pushed by this RootElement /// </summary> protected virtual UIViewController MakeViewController() { if (createOnSelected != null) { return(createOnSelected(this)); } var dvc = new DialogViewController(this, true) { Autorotate = true }; if (ToolbarButtons != null) { dvc.SetToolbarItems(ToolbarButtons.ToArray(), true); } // dvc.EditButtonItem = EditButton; return(dvc); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (picker == null) { picker = new UIImagePickerController(); } picker.Delegate = new ImagePickerControllerDelegate(this, tableView, path); switch (UIDevice.CurrentDevice.UserInterfaceIdiom) { case UIUserInterfaceIdiom.Pad: popover = new UIPopoverController(picker); popover.PresentFromRect(rect, dvc.View, UIPopoverArrowDirection.Any, true); break; default: case UIUserInterfaceIdiom.Phone: dvc.ActivateController(picker, dvc); break; } currentController = dvc; }
/// <summary> /// Activates a nested view controller from the DialogViewController. /// If the view controller is hosted in a UINavigationController it /// will push the result. Otherwise it will show it as a modal /// dialog /// </summary> public void ActivateController(UIViewController controller, DialogViewController oldController) { dirty = true; var parent = ParentViewController; var nav = parent as UINavigationController; if (typeof(DialogViewController) == controller.GetType()) { var dialog = (DialogViewController)controller; dialog.TableView.BackgroundColor = oldController.TableView.BackgroundColor; } // We can not push a nav controller into a nav controller if (nav != null && !(controller is UINavigationController)) { nav.PushViewController(controller, true); } else { PresentModalViewController(controller, true); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow(path, true); LoadMore(); }
public SizingSource(DialogViewController controller) : base(controller) { }
public Source(DialogViewController container) { this.Container = container; Root = container.root; }
public SearchDelegate(DialogViewController container) { this.container = container; }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new MapKitViewController(this) { Autorotate = dvc.Autorotate }; if (MapView == null) { MapView = new MKMapView() { BackgroundColor = UIColor.White, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; } MapView.Frame = new CGRect(UIScreen.MainScreen.ApplicationFrame.Left, UIScreen.MainScreen.ApplicationFrame.Top - 20, UIScreen.MainScreen.ApplicationFrame.Right, UIScreen.MainScreen.ApplicationFrame.Bottom - 20); if (mkHandleGetViewForAnnotation != null) { MapView.GetViewForAnnotation = delegate(MKMapView mapView, IMKAnnotation annotation) { return(mkHandleGetViewForAnnotation(mapView, annotation)); }; } if (mkHandleMapViewCalloutAccessoryControlTapped != null) { MapView.CalloutAccessoryControlTapped += mkHandleMapViewCalloutAccessoryControlTapped; } if (mkHandleMapViewDidSelectAnnotationView != null) { MapView.DidSelectAnnotationView += mkHandleMapViewDidSelectAnnotationView; } if (mkAnnotationObjects != null) { MapView.AddAnnotations(mkAnnotationObjects); } MapView.WillStartLoadingMap += delegate(object sender, EventArgs e) { NetworkActivity = true; }; MapView.MapLoaded += delegate(object sender, EventArgs e) { NetworkActivity = false; }; MapView.LoadingMapFailed += delegate(object sender, NSErrorEventArgs e) { // Display an error of sorts }; if (ReverseGeocoderDelegate != null) { if (MapView != null) { MapView.DidUpdateUserLocation += delegate(object sender, MKUserLocationEventArgs e) { if (MapView != null) { var ul = MapView.UserLocation.Location; if (ul != null) // May be null if user has not given permission { var gc = new MKReverseGeocoder(ul.Coordinate); gc.Delegate = ReverseGeocoderDelegate; gc.Start(); } } }; } } MapView.ShowsUserLocation = true; vc.NavigationItem.Title = Caption; vc.View.AddSubview(MapView); dvc.ActivateController(vc); }
public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.EndEditing(true); tableView.CellAt(path).BecomeFirstResponder(); }
public virtual void AccessorySelected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { }
public Source(DialogViewController container) { this.container = new WeakReference <DialogViewController> (container); Root = container.root; }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath) { BecomeFirstResponder(true); tableView.DeselectRow(indexPath, true); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.SelectRow(path, false, UITableViewScrollPosition.None); ((EntryElementCell)tableView.CellAt(path)).BecomeFirstResponder(); }