Ejemplo n.º 1
0
		public void InitWithSession ()
		{
			var session = new MSSession ();
			using (var msg = new MSMessage (session)) {
				Assert.That (msg.Session, Is.EqualTo (session), "Session");
				Assert.That (msg.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
			}
		}
Ejemplo n.º 2
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.
        }
Ejemplo n.º 3
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.
        }
Ejemplo n.º 4
0
        public IceCream(MSMessage message)
        {
            if (message == null)
            {
                return;
            }

            var messageURL    = message.Url;
            var urlComponents = new NSUrlComponents(messageURL, false);

            if (urlComponents.QueryItems == null)
            {
                return;
            }

            CheckQueryItems(urlComponents.QueryItems);
        }
        MSMessage ComposeMessage(IceCream iceCream, string caption, MSSession session = null)
        {
            var components = new NSUrlComponents {
                QueryItems = iceCream.QueryItems
            };

            var layout = new MSMessageTemplateLayout {
                Image   = iceCream.RenderSticker(true),
                Caption = caption
            };

            var message = new MSMessage(session ?? new MSSession())
            {
                Url    = components.Url,
                Layout = layout
            };

            return(message);
        }
Ejemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            FinalScoreLabel.Text = string.Format("You scored {0}!", finalScore);

            // Set up the message layout
            MSMessageTemplateLayout layout = new MSMessageTemplateLayout()
            {
                Image           = UIImage.FromBundle("Monkey"),
                Caption         = "Try and beat my score!",
                TrailingCaption = "" + finalScore,
                Subcaption      = "MonkeyTap"
            };

            // Create a new message with the above layout
            MSMessage message = new MSMessage()
            {
                Layout = layout
            };

            // Send the message when the button is tapped
            PostScore.TouchUpInside += (sender, e) =>
            {
                conversation.InsertMessage(message, (Foundation.NSError error) =>
                {
                    if (error == null)
                    {
                        // Handle successful send
                    }
                    else
                    {
                        // Report Error
                        Console.WriteLine("Error: {0}", error);
                    }
                });
            };

            PlayAgain.TouchUpInside += (sender, e) =>
            {
                DismissViewController(true, null);
            };
        }
Ejemplo n.º 7
0
 public void AddMessage(MSMessage message)
 {
     list.Add(message);
 }
Ejemplo n.º 8
0
        public override void DidStartSendingMessage(MSMessage message, MSConversation conversation)
        {
            base.DidStartSendingMessage(message, conversation);

            // Called when the user taps the send button.
        }
        MSMessage ComposeMessage(IceCream iceCream, string caption, MSSession session = null)
        {
            var components = new NSUrlComponents {
                QueryItems = iceCream.QueryItems
            };

            var layout = new MSMessageTemplateLayout {
                Image = iceCream.RenderSticker (true),
                Caption = caption
            };

            var message = new MSMessage (session ?? new MSSession()) {
                Url = components.Url,
                Layout = layout
            };

            return message;
        }