NSDictionary SideBarViewAnimation(NSView customView, bool isShow)
        {
            CGRect startFrame = customView.Frame;
            CGRect endFrame   = startFrame;

            NSObject[] objects;

            if (isShow)
            {
                endFrame.Width = sidebarViewWidth;
                endFrame.X     = 0;
                objects        = new NSObject[] { customView,
                                                  NSValue.FromCGRect(startFrame),
                                                  NSValue.FromCGRect(endFrame),
                                                  NSViewAnimation.FadeInEffect };
            }
            else
            {
                endFrame.Width = 0;
                objects        = new NSObject[] { customView,
                                                  NSValue.FromCGRect(startFrame),
                                                  NSValue.FromCGRect(endFrame),
                                                  NSViewAnimation.FadeOutEffect };
            }

            NSObject[] keys = new NSObject[] { NSViewAnimation.TargetKey,
                                               NSViewAnimation.StartFrameKey,
                                               NSViewAnimation.EndFrameKey,
                                               NSViewAnimation.EffectKey };

            return(NSDictionary.FromObjectsAndKeys(objects, keys));
        }
예제 #2
0
        public PSPDFMenuItem[] ShouldShowMenuItemsForSelectedText(PSPDFViewController pdfController, PSPDFMenuItem[] menuItems, CGRect rect, string selectedText, CGRect textRect, PSPDFPageView pageView)
        {
            // Disable Wikipedia
            // Be sure to check for PSPDFMenuItem class; there might also be classic UIMenuItems in the array.
            // Note that for words that are in the iOS dictionary, instead of Wikipedia we show the "Define" menu item with the native dict.
            // There is also a simpler way to disable wikipedia (See PSPDFTextSelectionMenuAction)
            var newMenuItems = menuItems.Where((item) => !(item.IsKindOfClass(new Class(typeof(PSPDFMenuItem))) && item.Identifier == "Wikipedia")).ToList();

            // Add option to Google for it.
            newMenuItems.Add(new PSPDFMenuItem("Google", () => {
                var queryUri = new Uri(string.Format("https://www.google.com/search?q={0}", selectedText));
                var nsurl    = new NSUrl(queryUri.GetComponents(UriComponents.HttpRequestUrl, UriFormat.UriEscaped));

                var browser = new PSPDFWebViewController(nsurl)
                {
                    Delegate             = pdfController,
                    PreferredContentSize = new CGSize(600, 500)
                };

                var browserOptions = NSDictionary <NSString, NSObject> .FromObjectsAndKeys(
                    new NSObject[] { NSValue.FromCGRect(rect), NSNumber.FromBoolean(true), NSNumber.FromBoolean(true) },
                    new NSObject[] { PSPDFPresentationKeys.RectKey, PSPDFPresentationKeys.InNavigationControllerKey, PSPDFPresentationKeys.CloseButtonKey }
                    );

                pdfController.PresentViewController(browser, browserOptions, true, null, null);
            }, "Google"));

            return(newMenuItems.ToArray());
        }
예제 #3
0
        public void SetFrameSize(CGSize newFrameSize, bool animating)
        {
            CGRect newFrame = FrameForNewSizePinnedToTopLeft(newFrameSize);

            if (animating)
            {
                NSAnimation animation = new NSViewAnimation(new [] {
                    NSDictionary.FromObjectsAndKeys(
#if MONOMAC
                        new object[] { this, NSValue.FromRectangleF(Frame), NSValue.FromRectangleF(newFrame) },
#else
                        new object[] { this, NSValue.FromCGRect(Frame), NSValue.FromCGRect(newFrame) },
#endif
                        new object[] { NSViewAnimation.TargetKey, NSViewAnimation.StartFrameKey, NSViewAnimation.EndFrameKey }
                        )
                });
                animation.AnimationBlockingMode = NSAnimationBlockingMode.Nonblocking;
                animation.Duration = 0.25;
                animation.StartAnimation();
            }
            else
            {
                Superview.SetNeedsDisplayInRect(Frame);
                Frame        = newFrame;
                NeedsDisplay = true;
            }
        }
예제 #4
0
        CAAnimation CreateMoveAndGrowAnimation(CALayer progress, double growToFraction)
        {
            CAAnimationGroup grp = CAAnimationGroup.CreateAnimation();

            grp.Duration            = 0.2;
            grp.FillMode            = CAFillMode.Forwards;
            grp.RemovedOnCompletion = false;

            CABasicAnimation move      = CABasicAnimation.FromKeyPath("position.x");
            double           oldOffset = (progress.Frame.Width / 2) * oldFraction;
            double           newOffset = (progress.Frame.Width / 2) * growToFraction;

            move.From = NSNumber.FromDouble(oldOffset);
            move.To   = NSNumber.FromDouble(newOffset);

            CABasicAnimation grow = CABasicAnimation.FromKeyPath("bounds");

            grow.From      = NSValue.FromCGRect(new CGRect(0, 0, progress.Frame.Width * (nfloat)oldFraction, barHeight));
            grow.To        = NSValue.FromCGRect(new CGRect(0, 0, progress.Frame.Width * (nfloat)growToFraction, barHeight));
            grp.Animations = new [] {
                move,
                grow,
            };
            return(grp);
        }
예제 #5
0
        CAAnimation CreateMoveAndGrowAnimation(CALayer progress, double growToFraction)
        {
            CABasicAnimation grow = CABasicAnimation.FromKeyPath("bounds");

            grow.Duration            = 0.2;
            grow.FillMode            = CAFillMode.Forwards;
            grow.RemovedOnCompletion = false;
            grow.From = NSValue.FromCGRect(new CGRect(0, barY, Frame.Width * (nfloat)oldFraction, barHeight));
            grow.To   = NSValue.FromCGRect(new CGRect(0, barY, Frame.Width * (nfloat)growToFraction, barHeight));
            return(grow);
        }
        NSDictionary ContentViewAnimation(NSView customView, bool isFull)
        {
            CGRect startFrame = customView.Frame;
            CGRect endFrame   = GetContentPageViewSize(isFull);

            NSObject[] objects = new NSObject[] { customView,
                                                  NSValue.FromCGRect(startFrame),
                                                  NSValue.FromCGRect(endFrame) };

            NSObject[] keys = new NSObject[] { NSViewAnimation.TargetKey,
                                               NSViewAnimation.StartFrameKey,
                                               NSViewAnimation.EndFrameKey };
            return(NSDictionary.FromObjectsAndKeys(objects, keys));
        }
예제 #7
0
        private CAAnimation frameAnimation(CGRect aniFrame)
        {
            CAKeyFrameAnimation frameAni = new CAKeyFrameAnimation();

            frameAni.KeyPath = "frame";
            CGRect start = aniFrame;
            CGRect end   = aniFrame.Inset(-start.Width * .5f, -start.Height * 0.5f);

            frameAni.Values = new NSObject[] {
                NSValue.FromCGRect(start),
                NSValue.FromCGRect(end)
            };
            return(frameAni);
        }
예제 #8
0
        public static NSMutableData CreatePdfFile(this WebKit.WKWebView webView, UIViewPrintFormatter printFormatter)
        {
            var bounds = webView.Bounds;

            webView.Bounds = new CoreGraphics.CGRect(bounds.X, bounds.Y, bounds.Width, webView.ScrollView.ContentSize.Height);
            var pdfPageFrame = new CoreGraphics.CGRect(0, 0, webView.Bounds.Width, webView.Bounds.Height);
            var renderer     = new PdfRenderer();

            renderer.AddPrintFormatter(printFormatter, 0);
            renderer.SetValueForKey(NSValue.FromCGRect(UIScreen.MainScreen.Bounds), new NSString("paperRect"));
            renderer.SetValueForKey(NSValue.FromCGRect(pdfPageFrame), new NSString("printableRect"));
            webView.Bounds = bounds;
            return(renderer.PrintToPdf());
        }
        NSObject IInterpolator.ProvideValue(double delta)
        {
            var tdx = To.X - From.X;
            var tdy = To.Y - From.Y;
            var tdw = To.Width - From.Width;
            var tdh = To.Height - From.Height;

            return(NSValue.FromCGRect(new CGRect(
                                          tdx * delta + From.X,
                                          tdy * delta + From.Y,
                                          tdw * delta + From.Width,
                                          tdh * delta + From.Height
                                          )));
        }
예제 #10
0
        public static NSMutableData CreatePdfFile(this WebKit.WKWebView webView, UIViewPrintFormatter printFormatter)
        {
            var renderer = new PdfRenderer();

            renderer.AddPrintFormatter(printFormatter, 0);
            // Letter = 8.5" * 72 x 11" * 72
            // Inset = .5"/2 * 72 x 1"/2 * 72
            var page         = new CGRect(0, 0, 8.5 * 72, 11 * 72);
            var pdfPageFrame = page.Inset(dx: (nfloat).25 * 72, dy: (nfloat).5 * 72);

            renderer.SetValueForKey(NSValue.FromCGRect(page), new NSString("paperRect"));
            renderer.SetValueForKey(NSValue.FromCGRect(pdfPageFrame), new NSString("printableRect"));
            return(renderer.PrintToPdf());
        }
예제 #11
0
        public static void SaveContentInWebViewAsPDF()
        {
            ContentPrintPageRender render = new ContentPrintPageRender(AppDataUtil.Instance.GetCurrentPublication().Name + " / " + AppDataUtil.Instance.GetOpendTOC().Title);

            render.AddPrintFormatter(AppDisplayUtil.Instance.contentVC.ContentWebView.ViewPrintFormatter, 0);

            CGSize kPaperSizeA4 = new CGSize(595.2, 841.8);

            float  topPadding = 20, bottomPadding = 20, leftPadding = 10, rightPadding = 10;
            CGRect printableRect = new CGRect(leftPadding, topPadding, kPaperSizeA4.Width - leftPadding - rightPadding, kPaperSizeA4.Height - topPadding - bottomPadding);
            CGRect paperRect     = new CGRect(0, 0, kPaperSizeA4.Width, kPaperSizeA4.Height);

            render.SetValueForKey(NSValue.FromCGRect(paperRect), new NSString("paperRect"));
            render.SetValueForKey(NSValue.FromCGRect(printableRect), new NSString("printableRect"));
            render.PrintToPDF();
        }
        private NSData CreatePdfFile(UIViewPrintFormatter printFormatter)
        {
            var renderer = new UIPrintPageRenderer();

            renderer.AddPrintFormatter(printFormatter, 0);
            var point = new CoreGraphics.CGPoint(0, 0);

            var paperSize     = new CoreGraphics.CGSize(this.Frame.Size.Width, this.Frame.Size.Height);
            var printableRect = new CoreGraphics.CGRect(point, new CoreGraphics.CGSize(paperSize.Width, paperSize.Height));
            var paperRect     = new CoreGraphics.CGRect(point, new CoreGraphics.CGSize(paperSize.Width, paperSize.Height));

            renderer.SetValueForKey(NSValue.FromCGRect(paperRect), new NSString("paperRect"));
            renderer.SetValueForKey(NSValue.FromCGRect(printableRect), new NSString("printableRect"));

            return(renderer.PrintToPDF(paperRect));
        }
예제 #13
0
        public static NSMutableData CreatePdfFile(this WKWebView webView, UIViewPrintFormatter printFormatter, PageSize pageSize, PageMargin margin)
        {
            var bounds = webView.Bounds;

            //webView.Bounds = new CoreGraphics.CGRect(bounds.X, bounds.Y, bounds.Width, webView.ScrollView.ContentSize.Height);
            webView.Bounds = new CoreGraphics.CGRect(0, 0, (nfloat)pageSize.Width, (nfloat)pageSize.Height);
            margin         = margin ?? new PageMargin();
            var pdfPageFrame = new CoreGraphics.CGRect((nfloat)margin.Left, (nfloat)margin.Top, webView.Bounds.Width - margin.HorizontalThickness, webView.Bounds.Height - margin.VerticalThickness);
            //var pdfPageFrame = new CoreGraphics.CGRect(0, 0, 72 * 8, 72 * 10.5);
            var renderer = new PdfRenderer();

            renderer.AddPrintFormatter(printFormatter, 0);
            //renderer.SetValueForKey(NSValue.FromCGRect(UIScreen.MainScreen.Bounds), new NSString("paperRect"));
            renderer.SetValueForKey(NSValue.FromCGRect(webView.Bounds), new NSString("paperRect"));
            renderer.SetValueForKey(NSValue.FromCGRect(pdfPageFrame), new NSString("printableRect"));
            webView.Bounds = bounds;
            return(renderer.PrintToPdf());
        }
예제 #14
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();


            var img = UIImage.FromBundle("camion");

            var camion = new CALayer();

            camion.Contents                    = img.CGImage;
            camion.Bounds                      = new CoreGraphics.CGRect(x: 0, y: 0, width: 92, height: 92);
            camion.Position                    = new CoreGraphics.CGPoint(x: View.Center.X, y: View.Center.Y - 20);
            ContenidoVista.Layer.Mask          = camion;
            ContenidoVista.Layer.MasksToBounds = true;

            /*
             *  var bird = new CALayer();
             *  smileMask.contents = UIImage(named: "smiley face")?.cgImage
             *  smileMask.bounds = CGRect(x: 0, y: 0, width: 92, height: 92)
             *  smileMask.position = CGPoint(x: view.center.x, y: view.center.y-20)
             *  contentView.layer.mask = smileMask
             *  contentView.layer.masksToBounds = true
             */

            // MARK: - Smile Animation

            /*
             * 1. duration
             * 2. timing curve
             * 3. keyframes
             * 4. keyframe order
             * 5. apply animation
             */

            /*
             *
             * var animation = CAKeyframeAnimation(keyPath: "bounds")
             * animation.duration = 1
             * animation.timingFunctions = [
             * CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut),
             * CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
             * ]
             *
             */

            var animation = CAKeyFrameAnimation.FromKeyPath("bounds");

            animation.Duration        = 1;
            animation.TimingFunctions = new CAMediaTimingFunction[] {
                CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut),
                CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut)
            };

            var keyframe1 = NSValue.FromCGRect(new CoreGraphics.CGRect(x: 0, y: 0, width: 80, height: 80));
            var keyframe2 = NSValue.FromCGRect(new CoreGraphics.CGRect(x: 0, y: 0, width: 65, height: 65));
            var keyframe3 = NSValue.FromCGRect(new CoreGraphics.CGRect(x: 0, y: 0, width: 5200, height: 5200));


            animation.Values = new NSObject[] {
                keyframe1,
                keyframe2,
                keyframe3
            };


            animation.KeyTimes = new NSNumber[] {
                NSNumber.FromFloat(0f),
                NSNumber.FromFloat(0.7f),
                NSNumber.FromFloat(1f)
            };

            /*
             *  contentView.layer.mask?.add(animation, forKey: "bounds")
             *  contentView.layer.mask?.bounds = CGRect(x: 0, y: 0, width: 2600, height: 2600)
             */

            ContenidoVista.Layer.Mask.AddAnimation(animation, "bounds");
            ContenidoVista.Layer.Mask.Bounds = new CoreGraphics.CGRect(x: 0, y: 0, width: 5200, height: 5200);

            // contentView.transform = CGAffineTransform(scaleX: 1.1, y: 1.1)

            ContenidoVista.Transform = CoreGraphics.CGAffineTransform.MakeScale(1.1f, 1.1f); //Scale(1.1f, sy: 1.1f);

            /* UIView.animate(withDuration: 0.4, delay: 0.8, usingSpringWithDamping: 1, initialSpringVelocity: 16, options: .curveEaseInOut, animations: {
             *   self.contentView.transform = CGAffineTransform(scaleX: 1, y: 1)
             * }, completion: nil)
             */

            UIView.Animate(0.4, 0.8, UIViewAnimationOptions.CurveEaseInOut, HandleAction, HandleAction1);
        }
        private void AnimateNavBarTo(nfloat y)
        {
            UIView.Animate(0.2,
                           () =>
            {
                var navBarFrame = _navigationBar.Frame;
                navBarFrame.Y   = y;

                _navigationBar.Frame = navBarFrame;

                NSNotificationCenter.DefaultCenter.PostNotificationName(NAVIGATION_BAR_FRAME_CHANGED, NSValue.FromCGRect(navBarFrame));
            });
        }
예제 #16
0
        //- (void)presentImage:(NSImage *)image;
        void PresentImage(NSImage image, string filename)
        {
            int animationSpeed = 3;

            CGRect  superLayerBounds = View.Layer.Bounds;
            CGPoint center           = new CGPoint(superLayerBounds.GetMidX(), superLayerBounds.GetMidY());

            CGRect imageBounds = new CGRect(0, 0, image.Size.Width, image.Size.Height);

            nfloat  X           = (nfloat)random.Next((int)Math.Floor(imageBounds.Width / 2), (int)Math.Floor(superLayerBounds.GetMaxX() - imageBounds.Width / 2));   //(superLayerBounds.GetMaxX() - imageBounds.Width/2) * random.NextDouble();
            nfloat  Y           = (nfloat)random.Next((int)Math.Floor(imageBounds.Height / 2), (int)Math.Floor(superLayerBounds.GetMaxY() - imageBounds.Height / 2)); //(superLayerBounds.GetMaxY() - imageBounds.Height/2) * random.NextDouble();
            CGPoint randomPoint = new CGPoint(X, Y);

            CAMediaTimingFunction tf = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);

            // Animations for image layer
            CABasicAnimation posAnim = CABasicAnimation.FromKeyPath("position");

            posAnim.From           = NSValue.FromCGPoint(center);
            posAnim.Duration       = animationSpeed;
            posAnim.TimingFunction = tf;

            CABasicAnimation bdsAnim = CABasicAnimation.FromKeyPath("bounds");

            bdsAnim.From           = NSValue.FromCGRect(CGRect.Empty);
            bdsAnim.Duration       = animationSpeed;
            bdsAnim.TimingFunction = tf;

            // Image layer
            CALayer layer = new CALayer();

            layer.Contents  = image.CGImage;
            layer.Position  = center;
            layer.ZPosition = random.Next(-100, 99);
            layer.Actions   = NSDictionary.FromObjectsAndKeys(new NSObject[] { posAnim, bdsAnim }, new NSObject[] { new NSString("position"), new NSString("bounds") });

            // Animation for text layer
            CATransform3D    scale      = CATransform3D.MakeScale(0.0f, 0.0f, 0.0f);
            CABasicAnimation tScaleAnim = CABasicAnimation.FromKeyPath("transform");

            tScaleAnim.From           = NSValue.FromCATransform3D(scale);
            tScaleAnim.Duration       = animationSpeed;
            tScaleAnim.TimingFunction = tf;

            // text layer
            CATextLayer fileNameLayer = new CATextLayer();

            fileNameLayer.FontSize        = 24;
            fileNameLayer.ForegroundColor = NSColor.White.CGColor;
            SetText(" " + filename + " ", fileNameLayer);
            fileNameLayer.Transform     = scale;
            fileNameLayer.Position      = CGPoint.Empty;
            fileNameLayer.AnchorPoint   = CGPoint.Empty;
            fileNameLayer.ShadowColor   = NSColor.Black.CGColor;
            fileNameLayer.ShadowOffset  = new CGSize(5, 5);
            fileNameLayer.ShadowOpacity = 1.0f;
            fileNameLayer.ShadowRadius  = 0.0f;
            fileNameLayer.BorderColor   = NSColor.White.CGColor;
            fileNameLayer.BorderWidth   = 1.0f;
            fileNameLayer.Actions       = NSDictionary.FromObjectsAndKeys(new NSObject[] { tScaleAnim }, new NSObject[] { new NSString("transform") });

            layer.AddSublayer(fileNameLayer);
            View.Layer.AddSublayer(layer);

            CATransaction.Begin();
            layer.Position          = randomPoint;
            layer.Bounds            = imageBounds;
            fileNameLayer.Transform = CATransform3D.Identity;
            CATransaction.Commit();
        }
예제 #17
0
 public override bool ShouldChangeCharacters(UITextField textField, NSRange range, string replacementString)
 {
     NSNotificationCenter.DefaultCenter.PostNotificationName(Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager.TextControlChangedNotification, NSValue.FromCGRect(textField.Frame));
     return(true);
 }
예제 #18
0
 public override bool ShouldBeginEditing(UITextField textField)
 {
     NSNotificationCenter.DefaultCenter.PostNotificationName(Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager.TextControlDidBeginEditingNotification, NSValue.FromCGRect(textField.Frame));
     return(true);
 }
        public void Scrolled(UIScrollView scrollView)
        {
            if (_navigationBar != null && scrollView.ScrollEnabled)
            {
                var navBarFrame = _navigationBar.Frame;
                var navBarMinY  = -(navBarFrame.Height + STATUS_BAR_HEIGHT + _topOffsetOfNavBar);

                var scrollOffset            = scrollView.ContentOffset.Y;
                var scrollDiff              = scrollOffset - _previousScrollViewYOffset;
                var scrollHeight            = scrollView.Frame.Height;
                var scrollContentSizeHeight = scrollView.ContentSize.Height + scrollView.ContentInset.Bottom;

                if (scrollOffset <= -(scrollView.ContentInset.Top)) // bounces top
                {
                    navBarFrame.Y = STATUS_BAR_HEIGHT;
                }
                else if ((scrollOffset + scrollHeight) >= scrollContentSizeHeight) // bounces bottom
                {
                    navBarFrame.Y = navBarMinY;
                }
                else
                {
                    navBarFrame.Y = (nfloat)Math.Min(STATUS_BAR_HEIGHT, Math.Max(navBarMinY, navBarFrame.Y - scrollDiff));
                }

                _navigationBar.Frame = navBarFrame;

                NSNotificationCenter.DefaultCenter.PostNotificationName(NAVIGATION_BAR_FRAME_CHANGED, NSValue.FromCGRect(navBarFrame));

                _previousScrollViewYOffset = scrollOffset;
            }
        }
예제 #20
0
        private void DisplayViewController(NSViewController vc)
        {
            BeginInvokeOnMainThread(() => {
                NSWindow w = box.Window;

                bool ended = w.MakeFirstResponder(w);
                if (!ended)
                {
                    AppKitFramework.NSBeep();
                    return;
                }
                // get the new View
                NSView newView = vc.View;

                // Get the old View
                NSView oldView = (NSView)box.ContentView;

                if (oldView == newView)
                {
                    return;
                }

                // Compute the new window frame
                CGSize currentSize = oldView.Frame.Size;
                CGSize newSize     = newView.Frame.Size;

                nfloat deltaWidth    = newSize.Width - currentSize.Width;
                nfloat deltaHeight   = newSize.Height - currentSize.Height;
                CGRect windowframe   = w.Frame;
                windowframe.Size     = new CGSize(windowframe.Size.Width, windowframe.Size.Height + deltaHeight);
                windowframe.Location = new CGPoint(windowframe.Location.X, windowframe.Location.Y - deltaHeight);
                windowframe.Size     = new CGSize(windowframe.Size.Width + deltaWidth, windowframe.Size.Height);


                NSDictionary windowResize   = NSDictionary.FromObjectsAndKeys(new NSObject[] { w, NSValue.FromCGRect(windowframe) }, new NSObject[] { NSViewAnimation.TargetKey, NSViewAnimation.EndFrameKey });
                NSDictionary oldViewFadeOut = NSDictionary.FromObjectsAndKeys(new NSObject[] { oldView, NSViewAnimation.FadeOutEffect }, new NSObject[] { NSViewAnimation.TargetKey, NSViewAnimation.EffectKey });
                NSDictionary newViewFadeOut = NSDictionary.FromObjectsAndKeys(new NSObject[] { newView, NSViewAnimation.FadeOutEffect }, new NSObject[] { NSViewAnimation.TargetKey, NSViewAnimation.EffectKey });
                NSDictionary fadeIn         = NSDictionary.FromObjectsAndKeys(new NSObject[] { newView, NSViewAnimation.FadeInEffect }, new NSObject[] { NSViewAnimation.TargetKey, NSViewAnimation.EffectKey });

                NSViewAnimation animation       = new NSViewAnimation(new NSDictionary[] { oldViewFadeOut });
                animation.AnimationBlockingMode = NSAnimationBlockingMode.Blocking;
                animation.AnimationCurve        = NSAnimationCurve.Linear;
                animation.Duration = 0.1;
                animation.StartAnimation();

                NSViewAnimation animation2       = new NSViewAnimation(new NSDictionary[] { newViewFadeOut });
                animation2.AnimationBlockingMode = NSAnimationBlockingMode.Blocking;
                animation2.Duration = 0.0;
                animation2.StartAnimation();

                box.ContentView = newView;

                NSViewAnimation animation3       = new NSViewAnimation(new NSDictionary[] { windowResize });
                animation3.AnimationBlockingMode = NSAnimationBlockingMode.Blocking;
                animation3.AnimationCurve        = NSAnimationCurve.EaseInOut;
                animation3.Duration = 0.2;
                animation3.StartAnimation();


                NSViewAnimation animation4       = new NSViewAnimation(new NSDictionary[] { fadeIn });
                animation4.AnimationBlockingMode = NSAnimationBlockingMode.Blocking;
                animation4.AnimationCurve        = NSAnimationCurve.Linear;
                animation4.Duration = 0.1;
                animation4.StartAnimation();
            });
        }