public override void ViewDidLoad() { base.ViewDidLoad (); // Configure the page view controller and add it as a child view controller. PageViewController = new UIPageViewController (UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min); PageViewController.WeakDelegate = this; var startingViewController = ModelController.GetViewController (0, Storyboard); var viewControllers = new UIViewController[] { startingViewController }; PageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null); PageViewController.WeakDataSource = ModelController; AddChildViewController (PageViewController); View.AddSubview (PageViewController.View); // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages. var pageViewRect = View.Bounds; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) pageViewRect = new CGRect (pageViewRect.X + 20, pageViewRect.Y + 20, pageViewRect.Width - 40, pageViewRect.Height - 40); PageViewController.View.Frame = pageViewRect; PageViewController.DidMoveToParentViewController (this); // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily. View.GestureRecognizers = PageViewController.GestureRecognizers; }
public void RecordVideoToPath(UIViewController ViewController, string VideoPath) { // setup capture device AVCaptureDevice videoRecordingDevice = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video); NSError error; AVCaptureDeviceInput videoInput = new AVCaptureDeviceInput(videoRecordingDevice, out error); // create and assign a capture session AVCaptureSession captureSession = new AVCaptureSession(); captureSession.SessionPreset = AVCaptureSession.Preset1280x720; captureSession.AddInput(videoInput); // Create capture device output AVCaptureVideoDataOutput videoOutput = new AVCaptureVideoDataOutput(); captureSession.AddOutput(videoOutput); videoOutput.VideoSettings.PixelFormat = CVPixelFormatType.CV32BGRA; videoOutput.MinFrameDuration = new CMTime(1, 30); videoOutput.SetSampleBufferDelegatequeue(captureVideoDelegate, System.IntPtr.Zero); // create a delegate class for handling capture captureVideoDelegate = new CaptureVideoDelegate(ViewController); // Start capture session captureSession.StartRunning(); }
public virtual bool WillFinishLaunching (UIApplication application, MonoTouch.Foundation.NSDictionary launchOptions){ UIViewController leftSideDrawerViewController = new MMExampleLeftSideDrawerViewController (); UIViewController centerViewController = new MMExampleCenterTableViewController (); UIViewController rightSideDrawerViewController = new UIViewController ();// new MMExampleRightSideDrawerViewController (); UINavigationController navigationController = new MMNavigationController (); navigationController.ViewControllers = new UIViewController[]{ centerViewController }; navigationController.RestorationIdentifier = "MMExampleCenterNavigationControllerRestorationKey"; UINavigationController leftSideNavController = new MMNavigationController (); leftSideNavController.ViewControllers = new UIViewController[]{ leftSideDrawerViewController }; leftSideNavController.RestorationIdentifier = "MMExampleLeftNavigationControllerRestorationKey"; this.DrawerController = new MMDrawerController.MMDrawerController (); DrawerController.CenterViewController = navigationController; DrawerController.LeftDrawerViewController = leftSideNavController; DrawerController.RestorationIdentifier = "MMDrawer"; DrawerController.MaximumRightDrawerWidth = 200.0F; DrawerController.OpenDrawerGestureModeMask = MMOpenDrawerGestureMode.BezelPanningCenterView; DrawerController.CloseDrawerGestureModeMask = MMCloseDrawerGestureMode.BezelPanningCenterView; //DrawerController.DrawerVisualStateBlock = new Action (DrawerAction (DrawerController, new MMDrawerSide(), 100F)); this.Window = new UIWindow (UIScreen.MainScreen.Bounds); UIColor tintColor = new UIColor (29.0F / 255.0F, 173.0F / 255.0F, 234.0F / 255.0F, 1.0F); this.Window.TintColor = tintColor; this.Window.RootViewController = this.DrawerController; return true; }
public ByInvestmentTableViewSource (UIViewController tvc, BalanceInfo balanceData) { Data = BalanceUtil.TransformBalanceData (balanceData); maxSourceRow = Data.Max (vm => vm.SourceAmounts.Count); maxViewModel = Data.First (vm => vm.SourceAmounts.Count == maxSourceRow); sourceNames = maxViewModel.SourceAmounts.Select (s => s.Key).ToList(); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new UIViewController(); var view = new UIView (UIScreen.MainScreen.Bounds); view.BackgroundColor = UIColor.White; controller.View = view; controller.NavigationItem.Title = "SignalR Client"; var textView = new UITextView(new CGRect(0, 0, 320, view.Frame.Height - 0)); view.AddSubview (textView); navController = new UINavigationController (controller); window.RootViewController = navController; window.MakeKeyAndVisible(); if (SIGNALR_DEMO_SERVER == "http://YOUR-SERVER-INSTANCE-HERE") { textView.Text = "You need to configure the app to point to your own SignalR Demo service. Please see the Getting Started Guide for more information!"; return true; } var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView); var client = new CommonClient(traceWriter); client.RunAsync(SIGNALR_DEMO_SERVER); return true; }
public StartMapViewController (UIViewController msp, IMapLocationRequest maplocationRequest) : base("StartMapViewController", null) { _MaplocationRequest = maplocationRequest; _MSP = msp; _list = new List<ImageInfo> (); }
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForPresentedController(UIViewController presented, UIViewController presenting, UIViewController source) { var controller = new ModalMenuPickerAnimatedTransitioning(); controller.IsPresenting = true; return controller; }
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForDismissedController(UIViewController dismissed) { var controller = new ModalMenuPickerAnimatedDismissed(); controller.IsPresenting = false; return controller; }
/// <summary> /// Presents a destructive alert (such as delete a file). /// </summary> /// <returns>The <c>UIAlertController</c> for the alert.</returns> /// <param name="title">The alert's title.</param> /// <param name="description">The alert's description.</param> /// <param name="destructiveAction">The title for the destructive action's button (such as delete).</param> /// <param name="controller">The View Controller that will present the alert.</param> /// <param name="action">The <c>AlertOKCancelDelegate</c> use to respond to the user's action.</param> public static UIAlertController PresentDestructiveAlert(string title, string description, string destructiveAction, UIViewController controller, AlertOKCancelDelegate action) { // No, inform the user that they must create a home first UIAlertController alert = UIAlertController.Create(title, description, UIAlertControllerStyle.Alert); // Add cancel button alert.AddAction(UIAlertAction.Create("Cancel",UIAlertActionStyle.Cancel,(actionCancel) => { // Any action? if (action!=null) { action(false); } })); // Add ok button alert.AddAction(UIAlertAction.Create(destructiveAction,UIAlertActionStyle.Destructive,(actionOK) => { // Any action? if (action!=null) { action(true); } })); // Display the alert controller.PresentViewController(alert,true,null); // Return created controller return alert; }
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); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="menuController">the controller to use for the menu</param> public KSDrawerMenuController(UIViewController menuController) : base() { this.menuController = menuController; this.EnablePanGesture = true; this.EnableSwipeGesture = true; }
//UINavigationController ; public override void ViewDidLoad() { base.ViewDidLoad (); qrReader = new QrScannerViewController(); qrReader.Title = "Scan"; attendees = new AttendeeController(); attendees.Title = "Attendees"; history = new HistoryController(); history.Title = "History"; var u = new UIViewController[] { attendees, qrReader, history }; SelectedIndex = 0; ViewControllers = u; CustomizableViewControllers = new UIViewController[]{}; }
public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button) { _pc = null; _lefty = null; ReplaceDetailNavigationViewController(); }
public static void SelectPicture (UIViewController parent, Action<NSDictionary> callback) { Init (); picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; _callback = callback; parent.PresentModalViewController (picker, true); }
public Task SaveAndLaunchFile(Stream stream, string fileType) { if (OriginView == null) return Task.FromResult(true); var data = NSData.FromStream(stream); var width = 824; var height = 668; var popoverView = new UIView(new RectangleF(0, 0, width, height)); popoverView.BackgroundColor = UIColor.White; var webView = new UIWebView(); webView.Frame = new RectangleF(0, 45, width, height - 45); var b = new UIButton(UIButtonType.RoundedRect); b.SetTitle("Done", UIControlState.Normal); b.Frame = new RectangleF(10,10, 60, 25); b.TouchUpInside += (o, e) => _popoverController.Dismiss(true); popoverView.AddSubview(b); popoverView.AddSubview(webView); var bundlePath = NSBundle.MainBundle.BundlePath; System.Diagnostics.Debug.WriteLine(bundlePath); webView.LoadData(data, "application/pdf", "utf-8", NSUrl.FromString("http://google.com")); var popoverContent = new UIViewController(); popoverContent.View = popoverView; _popoverController = new UIPopoverController(popoverContent); _popoverController.PopoverContentSize = new SizeF(width, height); _popoverController.PresentFromRect(new RectangleF(OriginView.Frame.Width/2, 50, 1, 1), OriginView, UIPopoverArrowDirection.Any, true); _popoverController.DidDismiss += (o, e) => _popoverController = null; return Task.FromResult(true); }
private void SetTitleAndTabBarItem(UIViewController screen, string title, string imageName) { screen.Title = ViewModel.TextSource.GetText(title); screen.TabBarItem = new UITabBarItem(title, UIImage.FromBundle("Images/Tabs/" + imageName + ".png"), _createdSoFarCount); _createdSoFarCount++; }
public void Title() { string text = "MyTitle"; var controller = new UIViewController(); controller.Title = text; Assert.AreEqual(text, controller.Title); }
public void RenderStream (Stream stream) { var reader = new StreamReader (stream); InvokeOnMainThread (delegate { button1.Enabled = true; var view = new UIViewController (); var handler = new UILabel (new CGRect (20, 20, 300, 40)) { Text = "HttpClient is using " + HandlerType?.Name }; var label = new UILabel (new CGRect (20, 20, 300, 80)) { Text = "The HTML returned by the server:" }; var tv = new UITextView (new CGRect (20, 100, 300, 400)) { Text = reader.ReadToEnd () }; if (HandlerType != null) view.Add (handler); view.Add (label); view.Add (tv); if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) { view.EdgesForExtendedLayout = UIRectEdge.None; } navigationController.PushViewController (view, true); }); }
public mCodePicker(UIViewController ViewController,float uWidth,List<CodePickerModel> ds ) : base("mCodePicker", null) { uvWidth = uWidth; this.ViewController=ViewController; DataSource = ds; }
public void NewObject() { var obj = new UIViewController(); Assert.AreNotEqual(IntPtr.Zero, obj.ClassHandle); Assert.AreNotEqual(IntPtr.Zero, obj.Handle); }
public async void BeginDownloadingPOC (UIViewController controller, UIImageView imageView, UIActivityIndicatorView acIndicator, string imagePath, bool isCache) { if (acIndicator != null) acIndicator.StartAnimating (); UIImage data = null; if (imagePath != null) data = await GetImageData (imagePath, isCache); CGPoint center = imageView.Center; UIImage finalImage = null; if (data != null) { finalImage = MUtils.scaledToWidth (data, imageView.Frame.Width * 2); imageView.Frame = new CGRect (0.0f, 0.0f, finalImage.Size.Width / 2, finalImage.Size.Height / 2); } imageView.Image = getImageFrom (finalImage, "noimage.png"); imageView.Center = center; if (acIndicator != null) { acIndicator.StopAnimating (); acIndicator.Color = UIColor.Clear; } }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); root = new UIViewController (); vc1 = new ViewController1 (); root.View.AddSubview (vc1.View); vc1.InitialActionCompleted += (object sender, EventArgs e) => { vc1.View.RemoveFromSuperview (); tabController = new UITabBarController (); vc2 = new ViewController2 (); vc3 = new ViewController3 (); tabController.ViewControllers = new UIViewController[] { vc1, vc2, vc3 }; tabController.ViewControllers [0].TabBarItem.Title = "One"; tabController.ViewControllers [1].TabBarItem.Title = "Two"; tabController.ViewControllers [2].TabBarItem.Title = "Three"; root.AddChildViewController (tabController); root.Add (tabController.View); }; window.RootViewController = root; window.MakeKeyAndVisible (); return true; }
public override bool PresentModalViewController(UIViewController viewController, bool animated) { if (_window.RootViewController == null) return false; _window.RootViewController.PresentViewController(viewController, true, null); return true; }
public static void Present(UIViewController controller) { UIApplication.SharedApplication.Windows [0].InvokeOnMainThread (delegate { UINavigationController navcontroller = (UINavigationController)UIApplication.SharedApplication.Windows[0].RootViewController; navcontroller.PresentViewController(controller,true,null); }); }
internal async static Task<string> DownloadInvoiceAsync(int employeeId, UIViewController context) { var myFiles = await GetDefaultDocumentFiles(context); var invoiceFile = myFiles.FirstOrDefault(file => file.Name.Equals(String.Format("invoice_{0}.pdf", employeeId))); var actualInvoiceFile = invoiceFile as Microsoft.Office365.SharePoint.File; if (actualInvoiceFile == null) { return null; } var invoiceStream = await actualInvoiceFile.DownloadAsync(); var invoicePath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Personal), invoiceFile.Name); using (var invoiceFileStream = System.IO.File.Create(invoicePath)) { await invoiceStream.CopyToAsync(invoiceFileStream); } return invoicePath; }
public BigItemMasterView() : base() { masterView = new BigItemsScreen(); detailview = new BigItemDetailScreen(); masterView.ActivateDetail += (object sender, BigItemDetailClickedEventArgs e) => detailview.ShowDetails (e.lagerobject); detailview.BigItemSaved += (object sender, BigItemSavedEventArgs e) => masterView.Refresh (); // detailview.Derezzy += (object sender, DerezLargeObjectEventArgs e) => { // detailnav.PopViewControllerAnimated(true); // masterView.Refresh(); // }; detailview.GotPicture += (object sender, GotPictureEventArgs e) => masterView.Refresh (); masternav = new UINavigationController(); masternav.PushViewController(masterView, false); detailnav = new UINavigationController(); detailnav.PushViewController(detailview, false); //always last ViewControllers = new UIViewController[] {masternav, detailnav}; }
public TabBarController () { tabFirst = new UIViewController(); tabFirst.Title = "Purple"; //tabFirst.TabBarItem = new UITabBarItem (UITabBarSystemItem.Favorites, 0); tabFirst.View.BackgroundColor = UIColor.Purple; tabSecond = new UIViewController(); tabSecond.Title = "Black"; //tabSecond.TabBarItem = new UITabBarItem (); //tabSecond.TabBarItem.Image = UIImage.FromFile ("second.png"); tabSecond.View.BackgroundColor = UIColor.Black; tabThird = new UIViewController(); tabThird.Title = "Blue"; //tabThird.TabBarItem.BadgeValue = "New"; tabThird.View.BackgroundColor = UIColor.Blue; var tabs = new UIViewController[] { tabFirst, tabSecond, tabThird }; ViewControllers = tabs; }
public RootTabBarController(){ //- Set Tab Bar Background Color this.TabBar.BackgroundColor = UIColor.FromRGBA(255,0,0,0); //this.TabBar.BarTintColor = UIColor.Red; this.TabBar.ItemPositioning = UITabBarItemPositioning.Fill; //this.TabBar.Center = new CoreGraphics.CGPoint (0, 10); //- Settings _settingsTab = new IdeaBag.Client.iOS.Views.IdeasViewController(); _settingsTab.TabBarItem = new UITabBarItem("", UIImage.FromBundle("settings-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIImage.FromBundle("settings-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ); //- Ideas _ideasTab = new UIViewController(); _ideasTab.View.BackgroundColor = UIColor.White; _ideasTab.TabBarItem = new UITabBarItem("", UIImage.FromBundle("ideas-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIImage.FromBundle("ideas-tab-selected").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ); _ideasTab.TabBarItem.ImageInsets = new UIEdgeInsets (4, 0, -4, 0); //- Notifications _notificationsTab = new NotificationsViewController(); _notificationsTab.TabBarItem = new UITabBarItem("", UIImage.FromBundle("notification-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIImage.FromBundle("notification-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ); //- Contacts _contactsTab = new UIViewController(); _contactsTab.TabBarItem = new UITabBarItem("", UIImage.FromBundle("friends-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIImage.FromBundle("friends-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ); _contactsTab.View.BackgroundColor = UIColor.White; //- Map _mapTab = new UIViewController(); _mapTab.TabBarItem = new UITabBarItem("", UIImage.FromBundle("map-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIImage.FromBundle("map-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ); _mapTab.View.BackgroundColor = UIColor.White; var tabs = new UIViewController[] { _settingsTab, _ideasTab, _notificationsTab, _contactsTab, _mapTab }; this.ViewControllers = tabs; }
public static void PickContact(UIViewController view, Action<ABPerson> picked) { /* ABAddressBook ab = new ABAddressBook(); ABPerson p = new ABPerson(); p.FirstName = "Brittani"; p.LastName = "Clancey"; ABMutableMultiValue<string> phones = new ABMutableStringMultiValue(); phones.Add("9079470168", ABPersonPhoneLabel.Mobile); p.SetPhones(phones); ab.Add(p); ab.Save(); */ picker = new ABPeoplePickerNavigationController (); //picker.DismissModalViewControllerAnimated (true); //picker.Dispose(); picker.SelectPerson += delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) { picked (e.Person); }; picker.PerformAction += delegate(object sender, ABPeoplePickerPerformActionEventArgs e) { }; picker.Cancelled += delegate { picker.DismissModalViewControllerAnimated (true); picked (null); picker.Dispose (); }; view.PresentModalViewController (picker, true); }
public UIViewController GetViewer (object value, bool createInspector) { var vc = value as UIViewController; if (vc != null) return vc; var sv = GetSpecialView (value); vc = sv as UIViewController; if (vc != null && vc.ParentViewController == null) { return vc; } var v = sv as UIView; if (v != null && v.Superview == null) { vc = new UIViewController (); vc.View = v; return vc; } if (createInspector) { vc = new UINavigationController (new ObjectInspector(value)); return vc; } return null; }
/// <summary> /// Sends a request to the Keycloak server to perform token exchange. /// On successfully completing the token exchange the callback is invoked with the `openid` credentials for the user. /// Otherwise the callback is invoked with the error that occured during token exchange. /// </summary> /// <returns>The authorization flow.</returns> /// <param name="request">an openid authorisation request.</param> /// <param name="presentingViewController">The view controller from which to present the SafariViewController.</param> /// <param name="callback">a callback function that will be invoked when the token exchange is completed.</param> private IAuthorizationFlowSession startAuthorizationFlow(AuthorizationRequest request, UIViewController presentingViewController, OIDAuthFlowCallback callback) { return(AuthState.PresentAuthorizationRequest(request, presentingViewController, (authState, error) => { if (authState == null || error != null) { callback(null, error); } else { callback(new OIDCCredential(authState), null); } })); }
public ChatListViewControllerSource(List <ChatConversation> items, UIViewController uiNewView) { this.tableItems = items; this.searchItems = items; this.uiNewView = uiNewView; }
public SearchOptionsTableSource(List <TableItemGroup> items, UIViewController owner) { this.tableItems = items; this.owner = (SearchViewController)owner; }
public UIViewController SeparateSecondaryViewController(UISplitViewController splitViewController, UIViewController primaryViewController) { if (primaryViewController is UINavigationController nav && nav.TopViewController is SettingsController settings) { return(Utils.CreateEmptyViewController()); } return(null); }
public bool CollapseSecondViewController(UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController) { var secondNav = secondaryViewController as UINavigationController; if (secondNav != null) { if (secondNav.TopViewController is TorrentDetailsController) { var detail = secondNav.TopViewController as TorrentDetailsController; if (detail != null && detail.manager != null) { return(false); } } else if (secondNav.TopViewController is TorrentFilesController) { var detail = secondNav.TopViewController as TorrentFilesController; if (detail != null && detail.manager != null) { return(false); } } } return(true); }
public UIRecurrenceView(UIViewController viewController) { _viewController = viewController; Axis = UILayoutConstraintAxis.Vertical; }
public void PushViewController(UIViewController viewController) { NavigationController.PushViewController(viewController, true); }
public bool PresentModalViewController(UIViewController controller, bool animated) { return(true); }
public static void SetMenu(this UIViewController controller, IMenu menu) { if (menu != null && menu.ButtonCount > 0) { if (menu.ButtonCount > 1) { bool isNew = false; if (menu.ImagePath != null) { try { controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIImage.FromBundle(menu.ImagePath), UIBarButtonItemStyle.Plain, null); isNew = true; } catch { } } else if (!string.IsNullOrEmpty(menu.Title)) { controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem(menu.Title, UIBarButtonItemStyle.Plain, null); isNew = true; } if (controller.NavigationItem.RightBarButtonItem == null) { controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action); isNew = true; } if (isNew) { controller.NavigationItem.RightBarButtonItem.Clicked += (o, e) => { var alert = (menu as UIAlertController) ?? (menu.Pair as UIAlertController); if (alert != null) { if (alert.PopoverPresentationController != null) { alert.PopoverPresentationController.BarButtonItem = controller.NavigationItem.RightBarButtonItem; } ModalManager.EnqueueModalTransition(ModalManager.GetTopmostViewController(null), alert, true); } else { var action = (menu as UIActionSheet) ?? (menu.Pair as UIActionSheet); if (action != null) { action.ShowFrom(controller.NavigationItem.RightBarButtonItem, true); } } }; } var sheet = (menu as UIActionSheet) ?? (menu.Pair as UIActionSheet); if (sheet != null) { if (sheet.CancelButtonIndex <= 0) { sheet.Add(TouchFactory.Instance.GetResourceString("Cancel")); sheet.CancelButtonIndex = sheet.ButtonCount - 1; } } } else { controller.NavigationItem.RightBarButtonItem = TouchFactory.GetNativeObject <UIBarButtonItem>(menu.GetButton(0), "menuButton"); } } else { controller.NavigationItem.RightBarButtonItem = null; } }
public ModalDialogPresentationController(UIViewController presentedViewController, UIViewController presentingViewController) : base(presentedViewController, presentingViewController) { }
public bool CollapseSecondViewController(UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController) { if (secondaryViewController.GetType() == typeof(UINavigationController) && ((UINavigationController)secondaryViewController).TopViewController.GetType() == typeof(DetailViewController) && ((DetailViewController)((UINavigationController)secondaryViewController).TopViewController).DetailItem == null) { // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. return(true); } return(false); }
public void DismissViewController(SignIn signIn, UIViewController viewController) { var presenter = Mvx.Resolve <IMvxIosViewPresenter>() as MvxIosViewPresenter; presenter.MasterNavigationController.DismissViewController(true, null); }
public static void All() { var x1 = new UIButton(); x1.TouchUpInside += (s, e) => { }; var x2 = new UISlider(); x2.ValueChanged += (s, e) => { }; var x3 = new UIStepper(); x3.ValueChanged += (s, e) => { }; var x4 = new UISwitch(); x4.ValueChanged += (s, e) => { }; var x5 = new UITextField(); x5.Text = x5.Text; x5.EditingChanged += (s, e) => { }; var x6 = new UIView(); x6.Hidden = x6.Hidden; x6.Frame = x6.Frame; x6.TintColor = x6.TintColor; x6.BackgroundColor = x6.BackgroundColor; x6.Alpha = x6.Alpha; x6.UserInteractionEnabled = x6.UserInteractionEnabled; var x7 = new UIViewController(); x7.Title = x7.Title; var x8 = new UIDatePicker(); x8.Date = x8.Date; var x9 = new UIProgressView(); x9.Progress = x9.Progress; x9.ProgressTintColor = x9.ProgressTintColor; x9.TrackTintColor = x9.TrackTintColor; var x10 = new UIImageView(); x10.Image = x10.Image; var x11 = new UILabel(); x11.Text = x11.Text; x11.TextColor = x11.TextColor; var x12 = new UISegmentedControl(); x12.SelectedSegment = x12.SelectedSegment; var x13 = new UISlider(); x13.Value = x13.Value; x13.MaxValue = x13.MaxValue; x13.MinValue = x13.MinValue; var x14 = new UIStepper(); x14.Value = x14.Value; x14.MaximumValue = x14.MaximumValue; x14.MinimumValue = x14.MinimumValue; var x15 = new UISwitch(); x15.On = x15.On; var x16 = new UITextView(); x16.Text = x16.Text; x16.Changed += (sender, e) => { }; var x17 = new UIActivityIndicatorView(); x17.Color = x17.Color; }
// IOAuthAuthorizeHandler.AuthorizeAsync implementation. public Task <IDictionary <string, string> > AuthorizeAsync(Uri serviceUri, Uri authorizeUri, Uri callbackUri) { // If the TaskCompletionSource is not null, authorization may already be in progress and should be canceled. if (_taskCompletionSource != null) { // Try to cancel any existing authentication task. _taskCompletionSource.TrySetCanceled(); } // Create a task completion source. _taskCompletionSource = new TaskCompletionSource <IDictionary <string, string> >(); #if __ANDROID__ || __IOS__ #if __ANDROID__ // Get the current Android Activity. Activity activity = (Activity)ArcGISRuntime.Droid.MainActivity.Instance; #endif #if __IOS__ // Get the current iOS ViewController. UIViewController viewController = null; Device.BeginInvokeOnMainThread(() => { viewController = UIApplication.SharedApplication.KeyWindow.RootViewController; }); #endif // Create a new Xamarin.Auth.OAuth2Authenticator using the information passed in. OAuth2Authenticator authenticator = new OAuth2Authenticator( clientId: AppClientId, scope: "", authorizeUrl: authorizeUri, redirectUrl: callbackUri) { ShowErrors = false, // Allow the user to cancel the OAuth attempt. AllowCancel = true }; // Define a handler for the OAuth2Authenticator.Completed event. authenticator.Completed += (sender, authArgs) => { try { #if __IOS__ // Dismiss the OAuth UI when complete. viewController.DismissViewController(true, null); #endif // Check if the user is authenticated. if (authArgs.IsAuthenticated) { // If authorization was successful, get the user's account. Xamarin.Auth.Account authenticatedAccount = authArgs.Account; // Set the result (Credential) for the TaskCompletionSource. _taskCompletionSource.SetResult(authenticatedAccount.Properties); } else { throw new Exception("Unable to authenticate user."); } } catch (Exception ex) { // If authentication failed, set the exception on the TaskCompletionSource. _taskCompletionSource.TrySetException(ex); // Cancel authentication. authenticator.OnCancelled(); } finally { // Dismiss the OAuth login. #if __ANDROID__ activity.FinishActivity(99); #endif } }; // If an error was encountered when authenticating, set the exception on the TaskCompletionSource. authenticator.Error += (sndr, errArgs) => { // If the user cancels, the Error event is raised but there is no exception ... best to check first. if (errArgs.Exception != null) { _taskCompletionSource.TrySetException(errArgs.Exception); } else { // Login canceled: dismiss the OAuth login. if (_taskCompletionSource != null) { _taskCompletionSource.TrySetCanceled(); #if __ANDROID__ activity.FinishActivity(99); #endif } } // Cancel authentication. authenticator.OnCancelled(); }; // Present the OAuth UI so the user can enter user name and password. #if __ANDROID__ var intent = authenticator.GetUI(activity); activity.StartActivityForResult(intent, 99); #endif #if __IOS__ // Present the OAuth UI (on the app's UI thread) so the user can enter user name and password. Device.BeginInvokeOnMainThread(() => { viewController.PresentViewController(authenticator.GetUI(), true, null); }); #endif #endif // (If Android or iOS) // Return completion source task so the caller can await completion. return(_taskCompletionSource.Task); }
public CropViewDelegate(UIViewController parent) { parent.Title = "hello all iam title"; this.parent = parent; }
public override void DidShowViewController(UINavigationController navigationController, UIViewController viewController, bool animated) { Handler.Widget.OnItemShown(EventArgs.Empty); // need to get the view controllers to reset the references to the popped controllers // this is due to how xamarin.ios keeps the controllers in an array // and this resets that array var controllers = Handler.Navigation.ViewControllers; /* for testing garbage collection after a view is popped #if DEBUG * GC.Collect(); * GC.WaitForPendingFinalizers(); #endif * /**/ }
public IUIViewControllerAnimatedTransitioning GetAnimationControllerForPresentedController(UIViewController presented, UIViewController presenting, UIViewController source) { return(this); }
public IUIViewControllerAnimatedTransitioning GetAnimationControllerForDismissedController(UIViewController dismissed) { return(this); }
ELCImagePickerViewController(UIViewController rootController) : base(rootController) { }
/// <summary> /// Is called when a row is selected /// </summary> public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { // get a reference to the nav item NavItem navItem = navItems[indexPath.Section].Items[indexPath.Row]; // if the nav item has a proper controller, push it on to the NavigationController // NOTE: we could also raise an event here, to loosely couple this, but isn't neccessary, // because we'll only ever use this this way if (navItem.Controller != null) { navigationController.PushViewController(navItem.Controller, true); // show the nav bar (we don't show it on the home page) navigationController.NavigationBarHidden = false; } else { if (navItem.ControllerType != null) { // ConstructorInfo ctor = null; // if the nav item has constructor aguments if (navItem.ControllerConstructorArgs.Length > 0) { // look for the constructor ctor = navItem.ControllerType.GetConstructor(navItem.ControllerConstructorTypes); } else { // search for the default constructor ctor = navItem.ControllerType.GetConstructor(System.Type.EmptyTypes); } // if we found the constructor if (ctor != null) { // UIViewController instance = null; if (navItem.ControllerConstructorArgs.Length > 0) { // instance the view controller instance = ctor.Invoke(navItem.ControllerConstructorArgs) as UIViewController; } else { // instance the view controller instance = ctor.Invoke(null) as UIViewController; } if (instance != null) { // save the object navItem.Controller = instance; // push the view controller onto the stack navigationController.PushViewController(navItem.Controller, true); } else { Console.WriteLine("instance of view controller not created"); } } else { Console.WriteLine("constructor not found"); } } } }
public AdaptivePresentationController(UIViewController presentedViewController, UIViewController presentingViewController) : base(presentedViewController, presentingViewController) { presentedViewController.ModalPresentationStyle = UIModalPresentationStyle.Custom; }
private UIViewController getPresentedViewController(UIViewController current) => current.PresentedViewController == null || current.PresentedViewController.IsBeingDismissed ? current : getPresentedViewController(current.PresentedViewController);
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForPresentedController(UIViewController presented, UIViewController presenting, UIViewController source) { return(new CustomTransitionAnimator()); }
public UIPresentationController GetPresentationControllerForPresentedViewController(UIViewController presentedViewController, UIViewController presentingViewController, UIViewController sourceViewController) { return(this); }
public static LayoutSupport TopLayoutGuideCartography(this UIViewController instance) { return(new LayoutSupport(instance.TopLayoutGuide, NSLayoutAttribute.Top)); }
public CarNavigation(UIViewController controller) : base(controller) { SetValueForKey(new MyNavBar(), (NSString)"navigationBar"); }
public void PushToViewGroup(MXTouchViewGroup viewGroup, MXTouchViewGroupItem viewGroupItem, UIViewController viewController) { // let the group render itself if it needs to viewGroup.ViewController.Render(viewGroup); UIViewController viewGroupViewController = viewGroup.ViewController as UIViewController; // put the item in the proper view group int groupIndex = viewGroup.Items.FindIndex(vgi => vgi == viewGroupItem); viewGroup.ViewController.RenderItem(groupIndex, viewController); // only support the master for now if (_splitViewController == null && _masterNavigationController == null) { // first time through! Init(viewGroupViewController); } else { _masterNavigationController.DisplayViewController(viewGroupViewController, true); } }
public static bool DisplayViewController(this UINavigationController navController, UIViewController viewController, bool animate) { // Crashed with error in Linq, //UIViewController found = navController.ViewControllers.First(v => v == viewController); bool found = false; foreach (var vc in navController.ViewControllers) { if (vc == viewController) { found = true; break; } } if (found) { navController.PopToViewController(viewController, animate); } else { navController.PushViewController(viewController, animate); } return(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); UpdateSettingsToggles(); // Perform any additional setup after loading the view, typically from a nib. this.View.BackgroundColor = UIColor.White; /* * Create the Alert View effect by changeing the background(parent) color and alpha. */ TopMostParent = PresentingViewController; TopMostParent.View.BackgroundColor = UIColor.Gray; TopMostParent.View.Alpha = 0.3f; CancelSessionButton.TouchUpInside += (sender, e) => { /* * Restore the default View effect by changeing the background(parent) color and alpha * as well as close the Modal Presentation controller. * */ TopMostParent.View.BackgroundColor = UIColor.White; TopMostParent.View.Alpha = 1.0f; TopMostParent.DismissModalViewController(true); }; StartSessionButton.TouchUpInside += (sender, e) => { //new UIAlertView("Start", null, null, "Ok", null).Show(); //FinishScreenController finishedScreen = new FinishScreenController(tabBar); FinishScreenController finishedScreen = new FinishScreenController(tabBar, SessionSource, runsTableViewController, imageTableViewController, CurrentProfile, CurrentCategory); SessionController RunSession = new SessionController(CurrentProfile, CurrentCategory, finishedScreen); finishedScreen.ReturnSessionData += (CurrentSession currentSession, int Attempted, int Correct) => { //add the results to the database if (CurrentProfile != null) //Valid Profile { //create the session Session newSession = new Session(); newSession.SessionDate = DateTime.Now.ToString("d"); newSession.ParentProfileID = CurrentProfile.ID; //newSession.SessionScore = Attempted / Correct * 1.0; newSession.Attempted = Attempted; newSession.Correct = Correct; newSession.CategoryID = CurrentCategory.ID; int insertResult = new DatabaseContext <Session>().Insert(newSession); //submit the results to that database foreach (Result res in currentSession.SessionResultsList) { SessionResult temp = new SessionResult(); temp.ParentSessionID = newSession.ID; temp.SessionImageID = res.ResultImageID; temp.categoryID = CurrentCategory.ID; if (res.ImageIncorrect) { temp.Missed = true; temp.ResultString = "M"; } else if (res.ImageIndependent) { temp.Independent = true; temp.ResultString = "I"; } else { temp.Prompted = true; temp.ResultString = "P"; } new DatabaseContext <SessionResult>().Insert(temp); } //update the profile with the lates date CurrentProfile.LastSessionDate = DateTime.Now.ToString("d"); new DatabaseContext <Profiles>().Update(CurrentProfile); } }; RunSession.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; RunSession.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve; //parent TopMostParent.DismissModalViewController(true); TopMostParent.View.BackgroundColor = UIColor.White; TopMostParent.View.Alpha = 1.0f; TopMostParent.PresentViewController(RunSession, true, null); }; DisplayLabelsToggle.ValueChanged += (sender, e) => { //get toggle switch state if (DisplayLabelsToggle.On) { //new UIAlertView("Toggle On", null, null, "Ok", null).Show(); CurrentProfile.showLabelSettings = true; new DatabaseContext <Profiles>().Update(CurrentProfile); } else { //new UIAlertView("Toggle Off", null, null, "Ok", null).Show(); CurrentProfile.showLabelSettings = false; new DatabaseContext <Profiles>().Update(CurrentProfile); } }; DisplayPictureToggle.ValueChanged += (sender, e) => { //get toggle switch state if (DisplayPictureToggle.On) { //new UIAlertView("Toggle On", null, null, "Ok", null).Show(); CurrentProfile.showImageSettings = true; new DatabaseContext <Profiles>().Update(CurrentProfile); } else { //new UIAlertView("Toggle Off", null, null, "Ok", null).Show(); CurrentProfile.showImageSettings = false; new DatabaseContext <Profiles>().Update(CurrentProfile); } }; }
public void SetElement(VisualElement element) { var oldElement = Element; Element = element; ViewControllers = new[] { _flyoutController = new EventedViewController(), _detailController = new ChildViewController() }; UpdateControllers(); _flyoutController.DidAppear += FlyoutControllerDidAppear; _flyoutController.WillDisappear += FlyoutControllerWillDisappear; PresentsWithGesture = FlyoutPage.IsGestureEnabled; OnElementChanged(new VisualElementChangedEventArgs(oldElement, element)); EffectUtilities.RegisterEffectControlProvider(this, oldElement, element); if (element != null) { element.SendViewInitialized(NativeView); } }