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);
        }
        public override void WillBecomeActive(MSConversation conversation)
        {
            base.WillBecomeActive (conversation);

            // Present the view controller appropriate for the conversation and presentation style.
            PresentViewController (conversation, PresentationStyle);
        }
        public override void WillBecomeActive(MSConversation conversation)
        {
            base.WillBecomeActive(conversation);

            // Present the view controller appropriate for the conversation and presentation style.
            PresentViewController(conversation, PresentationStyle);
        }
Example #4
0
        public override void DidCancelSendingMessage(MSMessage message, MSConversation conversation)
        {
            base.DidCancelSendingMessage(message, conversation);

            // Called when the user deletes the message without sending it.

            // Use this to clean up state related to the deleted message.
        }
Example #5
0
        public override void DidBecomeActive(MSConversation conversation)
        {
            base.DidBecomeActive(conversation);

            // Called when the extension is about to move from the inactive to active state.
            // This will happen when the extension is about to present UI.

            // Use this method to configure the extension and restore previously stored state.
        }
Example #6
0
        public override void DidReceiveMessage(MSMessage message, MSConversation conversation)
        {
            base.DidReceiveMessage(message, conversation);

            // Called when a message arrives that was generated by another instance of this
            // extension on a remote device.

            // Use this method to trigger UI updates in response to the message.
        }
Example #7
0
        public override void WillResignActive(MSConversation conversation)
        {
            base.WillResignActive(conversation);

            // Called when the extension is about to move from the active to inactive state.
            // This will happen when the user dissmises the extension, changes to a different
            // conversation or quits Messages.

            // Use this method to release shared resources, save user data, invalidate timers,
            // and store enough state information to restore your extension to its current state
            // in case it is terminated later.
        }
        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);
        }
Example #9
0
        public override void DidStartSendingMessage(MSMessage message, MSConversation conversation)
        {
            base.DidStartSendingMessage(message, conversation);

            // Called when the user taps the send button.
        }
        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);
        }