protected virtual void UpdateHeaderVisibility() { bool visible = ShellSectionController.GetItems().Count > 1; if (visible) { if (_header == null) { _header = CreateShellSectionRootHeader(_shellContext); _header.ShellSection = ShellSection; AddChildViewController(_header.ViewController); View.AddSubview(_header.ViewController.View); } _blurView.Hidden = false; LayoutHeader(); } else { if (_header != null) { _header.ViewController.View.RemoveFromSuperview(); _header.ViewController.RemoveFromParentViewController(); _header.Dispose(); _header = null; } _blurView.Hidden = true; } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing && ShellSection != null) { ShellSection.PropertyChanged -= OnShellSectionPropertyChanged; ShellSectionController.ItemsCollectionChanged -= OnShellSectionItemsChanged; _header?.Dispose(); _tracker?.Dispose(); foreach (var shellContent in ShellSectionController.GetItems()) { if (_renderers.TryGetValue(shellContent, out var oldRenderer)) { _renderers.Remove(shellContent); oldRenderer.NativeView.RemoveFromSuperview(); oldRenderer.ViewController.RemoveFromParentViewController(); var element = oldRenderer.Element; oldRenderer.Dispose(); element?.ClearValue(Platform.RendererProperty); } } } ShellSection = null; _header = null; _tracker = null; }
protected override void Dispose(bool disposing) { if (_isDisposed) { return; } if (disposing && ShellSection != null) { ShellSection.PropertyChanged -= OnShellSectionPropertyChanged; ShellSectionController.ItemsCollectionChanged -= OnShellSectionItemsChanged; this.RemoveFromParentViewController(); _header?.Dispose(); _tracker?.Dispose(); foreach (var renderer in _renderers) { var oldRenderer = renderer.Value; if (oldRenderer.NativeView != null) { oldRenderer.NativeView.RemoveFromSuperview(); } if (oldRenderer.ViewController != null) { oldRenderer.ViewController.RemoveFromParentViewController(); } var element = oldRenderer.Element; oldRenderer.Dispose(); element?.ClearValue(Platform.RendererProperty); } _renderers.Clear(); } if (disposing) { _shellContext.Shell.PropertyChanged -= HandleShellPropertyChanged; } _shellContext = null; ShellSection = null; _header = null; _tracker = null; _currentContent = null; _isDisposed = true; }
protected override void Dispose(bool disposing) { if (_isDisposed) { return; } if (disposing && ShellSection != null) { (this as IDisconnectable).Disconnect(); this.RemoveFromParentViewController(); _header?.Dispose(); _tracker?.Dispose(); foreach (var renderer in _renderers) { var oldRenderer = renderer.Value; if (oldRenderer.PlatformView != null) { oldRenderer.PlatformView.RemoveFromSuperview(); } if (oldRenderer.ViewController != null) { oldRenderer.ViewController.RemoveFromParentViewController(); } var element = oldRenderer.VirtualView; oldRenderer?.DisconnectHandler(); } _renderers.Clear(); } if (disposing) { _shellContext.Shell.PropertyChanged -= HandleShellPropertyChanged; } _shellContext = null; ShellSection = null; _header = null; _tracker = null; _currentContent = null; _isDisposed = true; }