protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _intermediateLayer?.RemoveFromSuperLayer(); _intermediateLayer?.Dispose(); _intermediateLayer = null; _blurView?.RemoveFromSuperview(); _blurView?.Dispose(); _blurView = null; } }
public EqualizerView() { AddSubview(blur = new NSVisualEffectView()); AddSubview(enabledSwitch = new NSButton { Title = "On", State = Equalizer.Shared.Active ? NSCellStateValue.On : NSCellStateValue.Off, }); enabledSwitch.SetButtonType(NSButtonType.Switch); enabledSwitch.SizeToFit(); AddSubview(comboBox = new NSComboBox(new CGRect(0, 0, 300, 40))); comboBox.Editable = false; // AddSubview (preAmp = new NSSlider (new CGRect(0,0,21,100))); // AddSubview (preampLabel = new NSTextField {StringValue = "Preamp"}.StyleAsMainTextCentered()); init(); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); InternalLogger.Debug(Tag, () => $"Dispose( disposing: {disposing} )"); if (disposing) { _intermediateLayer?.RemoveFromSuperLayer(); _intermediateLayer?.Dispose(); _intermediateLayer = null; _blurView?.RemoveFromSuperview(); _blurView?.Dispose(); _blurView = null; } }
private void EnableBlur() { if (_blurView == null) { _blurView = new macOSVisualEffectView() { WantsLayer = true }; _blurView.Layer.MasksToBounds = true; } UpdateMaterialBlurStyle(); if (Subviews.Length > 0 && ReferenceEquals(Subviews[0], _blurView)) { return; } UpdateBlurViewBounds(); AddSubview(_blurView, NSWindowOrderingMode.Below, this); }
public override void AnimatePresentation(NSViewController viewController, NSViewController fromViewController) { var bottomVc = fromViewController; var topVc = viewController; topVc.View.WantsLayer = true; topVc.View.LayerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay; topVc.View.AlphaValue = 1; NSVisualEffectView backgroundView = new NSVisualEffectView(); backgroundView.Material = NSVisualEffectMaterial.Sheet; backgroundView.BlendingMode = NSVisualEffectBlendingMode.WithinWindow; backgroundView.AddSubview(topVc.View); backgroundView.AlphaValue = 0; bottomVc.View.AddSubview(backgroundView); backgroundView.LeadingAnchor.ConstraintEqualToAnchor(bottomVc.View.LeadingAnchor).Active = true; backgroundView.TopAnchor.ConstraintEqualToAnchor(bottomVc.View.TopAnchor).Active = true; backgroundView.BottomAnchor.ConstraintEqualToAnchor(bottomVc.View.BottomAnchor).Active = true; backgroundView.TrailingAnchor.ConstraintEqualToAnchor(bottomVc.View.TrailingAnchor).Active = true; topVc.View.LeadingAnchor.ConstraintEqualToAnchor(backgroundView.LeadingAnchor).Active = true; topVc.View.TopAnchor.ConstraintEqualToAnchor(backgroundView.TopAnchor).Active = true; topVc.View.BottomAnchor.ConstraintEqualToAnchor(backgroundView.BottomAnchor).Active = true; topVc.View.TrailingAnchor.ConstraintEqualToAnchor(backgroundView.TrailingAnchor).Active = true; backgroundView.Frame = bottomVc.View.Frame; topVc.View.Frame = bottomVc.View.Frame; NSAnimationContext.RunAnimation((context) => { context.Duration = 1; (backgroundView.Animator as NSView).AlphaValue = 1; }); }
public void SetUp() { Asserts.EnsureYosemite(); view = new NSVisualEffectView(); }