public static Conversation ConversationWithDictionary(NSDictionary dictionary)
        {
            var photoValues = (NSArray)dictionary.ObjectForKey(new NSString("photos"));
            var photos      = new NSMutableArray(photoValues.Count);

            for (nuint i = 0; i < photoValues.Count; i++)
            {
                var photo = Photo.PhotoWithDictionary(photoValues.GetItem <NSDictionary> (i));
                photos.Add(photo);
            }

            return(new Conversation {
                Name = (NSString)dictionary.ObjectForKey(new NSString("name")),
                Photos = photos
            });
        }
Пример #2
0
        public static User UserWithDictionary(NSDictionary dictionary)
        {
            string name = (NSString)dictionary.ObjectForKey(new NSString("name"));
            var    conversationDictionaries = (NSArray)dictionary.ObjectForKey(new NSString("conversations"));
            var    conversations            = new NSMutableArray(conversationDictionaries.Count);

            for (nuint i = 0; i < conversationDictionaries.Count; i++)
            {
                var conversation = Conversation.ConversationWithDictionary(conversationDictionaries.GetItem <NSDictionary> (i));
                conversations.Add(conversation);
            }

            var lastPhotoDictionary = NSDictionary.FromDictionary((NSDictionary)dictionary.ObjectForKey(new NSString("lastPhoto")));

            return(new User {
                Name = name,
                Conversations = conversations,
                LastPhoto = Photo.PhotoWithDictionary(lastPhotoDictionary)
            });
        }