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"); } }
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. }
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. }
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); }
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); }; }
public void AddMessage(MSMessage message) { list.Add(message); }
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; }