protected override void Dispose(bool disposing) { if (disposing) { if (leftMenuViewController != null) { leftMenuViewController.Dispose(); leftMenuViewController = null; } if (rightMenuViewController != null) { rightMenuViewController.Dispose(); rightMenuViewController = null; } if (contentViewController != null) { contentViewController.Dispose(); contentViewController = null; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (FlyingObjects != null) { FlyingObjects.Dispose(); FlyingObjects = null; } if (DestinationViewController != null) { DestinationViewController.Dispose(); DestinationViewController = null; } if (DidEnterBackgroundToken != null) { DidEnterBackgroundToken.Dispose(); DidEnterBackgroundToken = null; } if (WillEnterForgroundToken != null) { WillEnterForgroundToken.Dispose(); WillEnterForgroundToken = null; } } }
public static void SetUsingViewController(bool isUsing) { if (isUsing == UsingViewController) { return; } UsingViewController = isUsing; if (UsingViewController) { if (ViewController == null) { ViewController = new GenericViewController(); } Instance.window.AddSubview(ViewController.View); InputSourceIphone source = InputManager.RegisteredSources[0] as InputSourceIphone; source.ReleaseAllTouches(); glView.StopAnimation(); } else { ViewController.View.RemoveFromSuperview(); ViewController.Dispose(); ViewController = null; glView.StartAnimation(); } }
public void Dispose() { _dlgView.Destroy(); _dlgView.Parent = null; Dialogs.DisposeModelAndChildrenRenderers(_dlgView); _dlgView.BindingContext = null; _dlgView = null; var tapGesture = _overlayView.GestureRecognizers.FirstOrDefault(); _overlayView.RemoveGestureRecognizer(tapGesture); tapGesture?.Dispose(); _overlayView.RemoveFromSuperview(); _overlayView.Dispose(); _overlayView = null; _contentViewController.TransitioningDelegate = null; _contentViewController.Dispose(); _contentViewController = null; _dialogController.Dispose(); _dialogController = null; _renderer = null; }
void DisposeOldViewController(UIViewController controller) { new Wait(TimeSpan.FromMilliseconds(500), () => { // DidReceiveMemoryWarning(); controller.Dispose(); }); }
public void Dismiss() { vc?.DismissViewController(true, () => { vc.Dispose(); vc = null; }); }
void DisposeOldViewController(UIViewController controller) { new Wait(TimeSpan.FromMilliseconds(500), ()=> { // DidReceiveMemoryWarning(); controller.Dispose(); }); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { ActiveViewController?.Dispose(); ActiveViewController = null; } }
private static void DisposeViewController(UIViewController viewController) { var viewControllerView = viewController as IViewControllerView; if (viewControllerView == null || viewControllerView.Mediator.IsViewLoaded) { viewController.View.ClearBindingsRecursively(true, true); viewController.View.DisposeEx(); viewController.EditButtonItem.ClearBindings(true, true); viewController.EditButtonItem.DisposeEx(); viewController.ToolbarItems.ClearBindings(true, true); viewController.ToolbarItems.DisposeEx(); UINavigationItem navigationItem = viewController.NavigationItem; if (navigationItem != null) { navigationItem.LeftBarButtonItem.ClearBindings(true, true); navigationItem.LeftBarButtonItem.DisposeEx(); navigationItem.LeftBarButtonItems.ClearBindings(true, true); navigationItem.LeftBarButtonItems.DisposeEx(); navigationItem.RightBarButtonItem.ClearBindings(true, true); navigationItem.RightBarButtonItem.DisposeEx(); navigationItem.RightBarButtonItems.ClearBindings(true, true); navigationItem.RightBarButtonItems.DisposeEx(); navigationItem.ClearBindings(true, true); navigationItem.DisposeEx(); } var dialogViewController = viewController as DialogViewController; if (dialogViewController != null) { dialogViewController.Root.ClearBindingsRecursively(true, true); dialogViewController.Root.DisposeEx(); } } var tabBarController = viewController as UITabBarController; if (tabBarController == null) { var splitViewController = viewController as UISplitViewController; if (splitViewController != null) { splitViewController.ViewControllers.ClearBindings(true, true); splitViewController.ViewControllers.DisposeEx(); } } else { tabBarController.ViewControllers.ClearBindings(true, true); tabBarController.ViewControllers.DisposeEx(); } viewController.ChildViewControllers.ClearBindings(true, true); viewController.ChildViewControllers.DisposeEx(); viewController.Dispose(); }
void Dismiss(UIViewController picker) { try { picker?.Dispose(); } catch { } GC.Collect(GC.MaxGeneration, GCCollectionMode.Default); Interlocked.Exchange(ref _pickerDelegate, null); }
void ClearBeforeNavigating() { _currentModalController?.Dispose(); _currentModalController = null; if (_storyboard.IsValueCreated) { _storyboard.Value.Dispose(); _storyboard = null; _storyboard = new Lazy <UIStoryboard>(() => UIStoryboard.FromName(STORYBOARD_NAME, null)); } }
protected override void Dispose(bool disposing) { RemoveObservers(); _touchView.Dispose(); _viewController.Dispose(); _contentView.Dispose(); // _window.Dispose (); // _parentView.Dispose (); Delegate = null; base.Dispose(disposing); }
/// Xamarin.iOS does not automatically dispose of ViewControllers when a page is popped /// from the navigation stack. It's the responsibility of the developer to ensure that a /// ViewController is disposed when it is no longer in scope. public override UIViewController PopViewController(bool animated) { UIViewController topView = TopViewController; if (topView != null) { // Dispose of Viewcontroller on back navigation. topView.Dispose(); } return(base.PopViewController(animated)); }
void Dismiss(UIPopoverController popover, UIViewController picker) { if (popover != null) { popover.Dispose(); popover = null; } try { picker?.Dispose(); } catch { } GC.Collect(GC.MaxGeneration, GCCollectionMode.Default); Interlocked.Exchange(ref pickerDelegate, null); }
private void Dismiss(UIPopoverController popover, UIViewController picker) { if (popover != null) { popover.Dispose(); popover = null; } try { picker?.Dispose(); } catch { } Interlocked.Exchange(ref pickerDelegate, null); }
protected virtual void ChangeRootViewController(UIViewController newController, UIViewAnimationOptions transition) { CoreUtility.ExecuteMethod("ChangeRootViewController", delegate() { UIViewController previousRoot = this.Window.RootViewController; if (this.Window.RootViewController == null) { this.Window.RootViewController = newController; } else { UIView.Transition(this.Window, 0.5, transition, delegate() { this.Window.RootViewController = newController; }, null); } if (previousRoot != null) { previousRoot.Dispose(); } }); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (_backButton != null) { _backButton.Dispose(); _backButton = null; } if (tabTopMovieRentals != null) { tabTopMovieRentals.Dispose(); tabTopMovieRentals = null; } if (tabTopMovies != null) { tabTopMovies.Dispose(); tabTopMovies = null; } if (tabTopMusicVideos != null) { tabTopMusicVideos.Dispose(); tabTopMusicVideos = null; } }
public void DisposeNoteEntryPage() { _noteEntryPage.Dispose(); _noteEntryPage = null; }
private void DisposeOldViewController(UIViewController controller) { DidReceiveMemoryWarning(); controller.Dispose(); }
public override void ViewDidLoad() { base.ViewDidLoad(); AppDelegate.FlyoutNavigation = new FlyoutNavigationController(); AppDelegate.FlyoutNavigation.Position = FlyOutNavigationPosition.Left; AppDelegate.FlyoutNavigation.AlwaysShowLandscapeMenu = false; AppDelegate.FlyoutNavigation.ForceMenuOpen = false; AppDelegate.FlyoutNavigation.View.Frame = UIScreen.MainScreen.Bounds; AppDelegate.FlyoutNavigation.NavigationTableView.RowHeight = 60; AppDelegate.FlyoutNavigation.NavigationTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; AppDelegate.FlyoutNavigation.NavigationTableView.SectionHeaderHeight = 0; AppDelegate.FlyoutNavigation.NavigationTableView.BackgroundColor = new UIColor((nfloat)(0 / 255.0), (nfloat)(0 / 255.0), (nfloat)(0 / 255.0), (nfloat)0); View.AddSubview(AppDelegate.FlyoutNavigation.View); AddChildViewController(AppDelegate.FlyoutNavigation); var username = String.Format("{0} {1}", AppSettings.UserFirstName, AppSettings.UserLastName); var userphoto = UIImage.FromBundle("empty.png"); var menu = new Dictionary <Section, Dictionary <ImageStringElement, UINavigationController> >() { { new Section("Help"), new Dictionary <ImageStringElement, UINavigationController> { { new ImageStringElement(username, userphoto), null }, { new ImageStringElement("Home", UIImage.FromFile("micon_user.png")), new UINavigationController(Storyboard.InstantiateViewController("MapViewController")) }, { new ImageStringElement("Book a Ride", UIImage.FromFile("micon_user.png")), new UINavigationController(Storyboard.InstantiateViewController("ScheduleARideViewController")) }, { new ImageStringElement("Payment", UIImage.FromFile("micon_payment.png")), new UINavigationController(Storyboard.InstantiateViewController("BillingInfoViewController")) }, { new ImageStringElement("My Trips", UIImage.FromFile("micon_clock.png")), new UINavigationController(Storyboard.InstantiateViewController("ReservationsDetailsViewController")) }, { new ImageStringElement("Support", UIImage.FromFile("micon_support.png")), new UINavigationController(Storyboard.InstantiateViewController("SupportViewController")) }, { new ImageStringElement("Terms", UIImage.FromFile("micon_terms.png")), new UINavigationController(Storyboard.InstantiateViewController("TermsOFServiceViewController")) }, // {new ImageStringElement("Profile", UIImage.FromFile("micon_user.png")), new UINavigationController(Storyboard.InstantiateViewController("ProfileViewController"))}, { new ImageStringElement("Change Login", UIImage.FromFile("micon_terms.png")), new UINavigationController(Storyboard.InstantiateViewController("LoginViewController")) } } } }; var viewControllers = new List <UINavigationController>(); var rootElement = new RootElement("Task List"); foreach (var pair in menu) { var section = pair.Key; foreach (var innerPair in pair.Value) { section.Add(innerPair.Key); viewControllers.Add(innerPair.Value); } rootElement.Add(section); } // Create the menu: AppDelegate.FlyoutNavigation.NavigationRoot = rootElement; AppDelegate.FlyoutNavigation.ViewControllers = viewControllers.ToArray(); AppDelegate.FlyoutNavigation.SelectedIndex = 1; AppDelegate.FlyoutNavigation.SelectedIndexChanged = new Action(delegate { int idx = AppDelegate.FlyoutNavigation.SelectedIndex; if (idx == 7) { LogoutProcess(); } //if(idx != 1){ Facade.Instance.ResetCurrentRide(); for (int i = 0; i < Facade.Instance.UIViewControllerList.Count; i++) { UIViewController vController = Facade.Instance.UIViewControllerList[i] as UIViewController; if (vController != null) { foreach (UIView view in vController.View.Subviews) { UITextField textField = view as UITextField; if (textField != null) { //textField.Text = ""; } } } vController.View.Dispose(); vController.Dispose(); vController.ViewDidLoad(); } //} }); foreach (var cell in AppDelegate.FlyoutNavigation.NavigationTableView.VisibleCells) { cell.BackgroundColor = new UIColor((nfloat)(0 / 255.0), (nfloat)(0 / 255.0), (nfloat)(0 / 255.0), (nfloat)0); cell.TextLabel.TextColor = UIColor.White; var seperator = new UIView(new CGRect(0.0f, cell.Frame.Height - 2.0f, cell.Frame.Width, 2.0f)); seperator.BackgroundColor = new UIColor((nfloat)(171.0 / 255.0), (nfloat)(200.0 / 255.0), (nfloat)(226.0 / 255.0), (nfloat)1.0); cell.AddSubview(seperator); } UIImageView iView = new UIImageView(); if (AppSettings.LoginType == 0) { iView.Image = UIImage.FromBundle("icon_avatar.png"); } else { iView.Image = UIImage.LoadFromData(NSData.FromUrl(new NSUrl(AppSettings.UserPhoto))); iView.Layer.CornerRadius = 25.0f; } iView.Frame = new CGRect(0, 0, 50, 50); UITableViewCell mCell = AppDelegate.FlyoutNavigation.NavigationTableView.VisibleCells [0]; mCell.SelectionStyle = UITableViewCellSelectionStyle.None; mCell.ImageView.AddSubview(iView); NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Menu", UIBarButtonItemStyle.Plain, (sender, e) => { AppDelegate.FlyoutNavigation.ToggleMenu(); }); }
private bool PushRootController(UIViewController newRootViewController, bool canShowTheSameController = false) { var topNavigationController = MenuNavigationController.TopNavigationController; topNavigationController.PopToRootViewController(false); var successful = true; var oldViewController = topNavigationController.ChildViewControllers.IsNullOrEmpty() ? null : topNavigationController.ChildViewControllers.First(); if (topNavigationController.PresentedViewController != null) { topNavigationController.DismissViewController(false, null); } if (canShowTheSameController || (oldViewController == null) || (oldViewController != null && newRootViewController.GetType() != oldViewController.GetType())) { if (oldViewController != null) { if (oldViewController is MvxViewController) //баг в iOS – ViewDidDisappear не вызывается при вызове RemoveFromParentViewController() { var unbindableVC = oldViewController as IUnbindable; if (unbindableVC != null) { UnbindCycle(ref unbindableVC); } } else { var eventSourceViCo = (oldViewController as IMvxEventSourceViewController); if (eventSourceViCo != null) { eventSourceViCo.ViewDidDisappearCalled += (sender, e) => { var unbindableVC = sender as IUnbindable; if (unbindableVC != null) { UnbindCycle(ref unbindableVC); } } } ; } oldViewController.RemoveFromParentViewController(); } if (topNavigationController.NavigationBar.TopItem != null) { topNavigationController.NavigationBar.TopItem.Title = newRootViewController.Title ?? string.Empty; } topNavigationController.PushViewController(newRootViewController, false); } else { var unbindableVC = newRootViewController as IUnbindable; if (unbindableVC != null) { UnbindCycle(ref unbindableVC); unbindableVC.DisposeIfDisposable(); unbindableVC = null; } newRootViewController.Dispose(); newRootViewController = null; successful = false; } if (MenuNavigationController.LeftMenuVisible || MenuNavigationController.RightMenuVisible) { MenuNavigationController.HideMenu(true); } return(successful); }
static async Task <IEnumerable <IMediaFile> > PlatformPickAsync(int selectionLimit, params MediaFileType[] types) { var vc = GetCurrentUIViewController(); var isVideo = types.Contains(MediaFileType.Video); var isImage = types.Contains(MediaFileType.Image); var tcs = new TaskCompletionSource <IEnumerable <IMediaFile> >(); if (HasOSVersion(14)) { var config = new PHPickerConfiguration(); config.SelectionLimit = selectionLimit; if (!(isVideo && isImage)) { config.Filter = isVideo ? PHPickerFilter.VideosFilter : PHPickerFilter.ImagesFilter; } pickerRef = new PHPickerViewController(config) { Delegate = new PHPickerDelegate(tcs) }; } else { var sourceType = UIImagePickerControllerSourceType.PhotoLibrary; if (!UIImagePickerController.IsSourceTypeAvailable(sourceType)) { throw new FeatureNotSupportedException(); } var availableTypes = UIImagePickerController.AvailableMediaTypes(sourceType); isVideo = isVideo && availableTypes.Contains(UTType.Movie); isImage = isImage && availableTypes.Contains(UTType.Image); if (!(isVideo || isImage)) { throw new FeatureNotSupportedException(); } pickerRef = new UIImagePickerController { SourceType = sourceType, AllowsEditing = false, AllowsImageEditing = false, Delegate = new PhotoPickerDelegate(tcs), MediaTypes = isVideo && isImage ? new string[] { UTType.Movie, UTType.Image } : new string[] { isVideo?UTType.Movie : UTType.Image } }; } if (pickerRef.PresentationController != null) { pickerRef.PresentationController.Delegate = new PresentatControllerDelegate(tcs); } if (DeviceInfo.Idiom == DeviceIdiom.Tablet && pickerRef.PopoverPresentationController != null && vc.View != null) { pickerRef.PopoverPresentationController.SourceRect = vc.View.Bounds; } await vc.PresentViewControllerAsync(pickerRef, true); var result = await tcs.Task; pickerRef?.Dispose(); pickerRef = null; return(result); }
public void NewObjectDispose() { var obj = new UIViewController(); obj.Dispose(); }
public void Dispose() { RemoveAllMarkers(); if (_focusOnSeekiosButton != null) { _focusOnSeekiosButton.Dispose(); } if (_focusOnZoneButton != null) { _focusOnZoneButton.Dispose(); } if (_zoomInButton != null) { _zoomInButton.Dispose(); } if (_zoomOutButton != null) { _zoomOutButton.Dispose(); } if (_editZoneButton != null) { _editZoneButton.Dispose(); } if (_undoButton != null) { _undoButton.Dispose(); } if (_accuracyArea != null) { _accuracyArea.Dispose(); } if (_mapDelegate != null) { _mapDelegate.Dispose(); } if (_controller != null) { _controller.Dispose(); } if (MapViewControl != null) { MapViewControl.MapType = MKMapType.Hybrid; MapViewControl.Delegate = null; MapViewControl.RemoveFromSuperview(); MapViewControl = null; MapViewControl.Dispose(); } if (SelectedAnnotation != null) { SelectedAnnotation.Dispose(); } if (SelectedLocationHistory != null) { SelectedLocationHistory.Dispose(); } if (SelectedPointsOfRoute != null) { SelectedPointsOfRoute.Dispose(); } if (RoutePolyline != null) { RoutePolyline.Dispose(); } PointsOfRoute.Clear(); PointsOfRoute = null; }