public void SetFavorite (bool favorite, TTTMessage message)
		{
			if (favorite)
				favoriteMessages.Add (message);
			else
				favoriteMessages.Remove (message);
		}
		public void AddMessage (TTTMessage message)
		{
			messages.Insert (0, message);

			var handler = MessagesAdded;
			if (handler != null)
				handler (this, new MessageEvenArg (0));

			WriteMessages ();
		}
Exemple #3
0
 public void SetFavorite(bool favorite, TTTMessage message)
 {
     if (favorite)
     {
         favoriteMessages.Add(message);
     }
     else
     {
         favoriteMessages.Remove(message);
     }
 }
Exemple #4
0
        void post(object sender, EventArgs e)
        {
            TTTMessage message = new TTTMessage()
            {
                Icon = Profile.Icon,
                Text = messageTextView.Text
            };

            TTTMessageServer.SharedMessageServer.AddMessage(message);

            close(null, EventArgs.Empty);
        }
        public void AddMessage(TTTMessage message)
        {
            int messageIndex = 0;
            messages.Insert (0, message);

            NSDictionary userInfo =
                NSDictionary.FromObjectAndKey (NSArray.FromNSObjects (new NSNumber (messageIndex)),
                                            new NSString (AddedMessageIndexesUserInfoKey));
            NSNotificationCenter.DefaultCenter.PostNotificationName (DidAddMessagesNotification,
                                                                     null, userInfo);
            WriteMessages ();
        }
Exemple #6
0
        public void AddMessage(TTTMessage message)
        {
            messages.Insert(0, message);

            var handler = MessagesAdded;

            if (handler != null)
            {
                handler(this, new MessageEvenArg(0));
            }

            WriteMessages();
        }
        public void AddMessage(TTTMessage message)
        {
            int messageIndex = 0;

            messages.Insert(0, message);

            NSDictionary userInfo =
                NSDictionary.FromObjectAndKey(NSArray.FromNSObjects(new NSNumber(messageIndex)),
                                              new NSString(AddedMessageIndexesUserInfoKey));

            NSNotificationCenter.DefaultCenter.PostNotificationName(DidAddMessagesNotification,
                                                                    null, userInfo);
            WriteMessages();
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            TTTMessage message = TTTMessageServer.SharedMessageServer.MessageAtIndex (indexPath.Row);
            TTTMessageTableViewCell cell = (TTTMessageTableViewCell)tableView.CellAt (indexPath);

            if (selectedMessage == message) {
                tableView.DeselectRow (indexPath, true);
                selectedMessage = null;
                cell.SetShowReplyButton (false);
            } else {
                selectedMessage = message;
                cell.SetShowReplyButton (true);
            }
            updateFavoriteButton ();
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            TTTMessage message           = TTTMessageServer.SharedMessageServer.MessageAtIndex(indexPath.Row);
            TTTMessageTableViewCell cell = (TTTMessageTableViewCell)tableView.CellAt(indexPath);

            if (selectedMessage == message)
            {
                tableView.DeselectRow(indexPath, true);
                selectedMessage = null;
                cell.SetShowReplyButton(false);
            }
            else
            {
                selectedMessage = message;
                cell.SetShowReplyButton(true);
            }
            updateFavoriteButton();
        }
        public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
        {
            TTTMessageTableViewCell messageCell = (TTTMessageTableViewCell)cell;
            TTTMessage message = TTTMessageServer.SharedMessageServer.MessageAtIndex(indexPath.Row);

            cell.TextLabel.Text  = message.Text;
            cell.ImageView.Image = TTTProfile.SmallImageForIcon(message.Icon);

            if (messageCell.ReplyButton == null)
            {
                UIButton replyButton = UIButton.FromType(UIButtonType.System);
                replyButton.TouchUpInside += newMessage;
                replyButton.SetImage(UIImage.FromBundle("reply"), UIControlState.Normal);
                replyButton.SizeToFit();
                messageCell.ReplyButton = replyButton;
            }

            bool isSelected = tableView.IndexPathForSelectedRow != null &&
                              tableView.IndexPathForSelectedRow.Equals(indexPath);

            messageCell.SetShowReplyButton(isSelected);
        }
		void post (object sender, EventArgs e)
		{
			TTTMessage message = new TTTMessage (){
				Icon = Profile.Icon,
				Text = messageTextView.Text
			};
			TTTMessageServer.SharedMessageServer.AddMessage (message);

			close (null, EventArgs.Empty);
		}
		public bool IsFavoriteMessage (TTTMessage message)
		{
			return favoriteMessages.Contains (message);
		}
Exemple #13
0
 public bool IsFavoriteMessage(TTTMessage message)
 {
     return(favoriteMessages.Contains(message));
 }