void PresentViewController(MSConversation conversation, MSMessagesAppPresentationStyle presentationStyle)
        {
            // Determine the controller to present.
            UIViewController controller;

            if (presentationStyle == MSMessagesAppPresentationStyle.Compact)
            {
                // Show a list of previously created ice creams.
                controller = InstantiateIceCreamsController();
            }
            else
            {
                var iceCream = new IceCream(conversation.SelectedMessage);
                controller = iceCream.IsComplete ? InstantiateCompletedIceCreamController(iceCream) : InstantiateBuildIceCreamController(iceCream);
            }

            foreach (var child in ChildViewControllers)
            {
                child.WillMoveToParentViewController(null);
                child.View.RemoveFromSuperview();
                child.RemoveFromParentViewController();
            }

            AddChildViewController(controller);
            controller.View.Frame = View.Bounds;
            controller.View.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(controller.View);

            controller.View.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active     = true;
            controller.View.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active   = true;
            controller.View.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active       = true;
            controller.View.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;

            controller.DidMoveToParentViewController(this);
        }
Example #2
0
        public override void DidTransition(MSMessagesAppPresentationStyle presentationStyle)
        {
            base.DidTransition(presentationStyle);

            // Called after the extension transitions to a new presentation style.

            // Use this method to finalize any behaviors associated with the change in presentation style.
        }
Example #3
0
        public override void WillTransition(MSMessagesAppPresentationStyle presentationStyle)
        {
            base.WillTransition(presentationStyle);

            // Called before the extension transitions to a new presentation style.

            // Use this method to prepare for the change in presentation style.
        }
        public override void WillTransition(MSMessagesAppPresentationStyle presentationStyle)
        {
            var conversation = ActiveConversation;

            if (conversation == null)
            {
                throw new Exception("Expected an active converstation");
            }

            // Present the view controller appropriate for the conversation and presentation style.
            PresentViewController(conversation, presentationStyle);
        }
        void PresentViewController(MSConversation conversation, MSMessagesAppPresentationStyle presentationStyle)
        {
            // For both Compact and Expanded presentation styles, show the list of stickers.
            UIViewController controller = InstantiateXamarinStickersController();

            foreach (var child in ChildViewControllers)
            {
                child.WillMoveToParentViewController(null);
                child.View.RemoveFromSuperview();
                child.RemoveFromParentViewController();
            }

            AddChildViewController(controller);
            controller.View.Frame = View.Bounds;
            controller.View.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(controller.View);

            controller.View.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active     = true;
            controller.View.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active   = true;
            controller.View.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active       = true;
            controller.View.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;

            controller.DidMoveToParentViewController(this);
        }
        public override void WillTransition(MSMessagesAppPresentationStyle presentationStyle)
        {
            var conversation = ActiveConversation;
            if (conversation == null)
                throw new Exception ("Expected an active converstation");

            // Present the view controller appropriate for the conversation and presentation style.
            PresentViewController (conversation, presentationStyle);
        }
        void PresentViewController(MSConversation conversation, MSMessagesAppPresentationStyle presentationStyle)
        {
            // Determine the controller to present.
            UIViewController controller;

            if (presentationStyle == MSMessagesAppPresentationStyle.Compact) {
                // Show a list of previously created ice creams.
                controller = InstantiateIceCreamsController ();
            } else {
                var iceCream = new IceCream (conversation.SelectedMessage);
                controller = iceCream.IsComplete ? InstantiateCompletedIceCreamController (iceCream) : InstantiateBuildIceCreamController (iceCream);
            }

            foreach (var child in ChildViewControllers) {
                child.WillMoveToParentViewController (null);
                child.View.RemoveFromSuperview ();
                child.RemoveFromParentViewController ();
            }

            AddChildViewController (controller);
            controller.View.Frame = View.Bounds;
            controller.View.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview (controller.View);

            controller.View.LeftAnchor.ConstraintEqualTo (View.LeftAnchor).Active = true;
            controller.View.RightAnchor.ConstraintEqualTo (View.RightAnchor).Active = true;
            controller.View.TopAnchor.ConstraintEqualTo (View.TopAnchor).Active = true;
            controller.View.BottomAnchor.ConstraintEqualTo (View.BottomAnchor).Active = true;

            controller.DidMoveToParentViewController (this);
        }