Beispiel #1
0
        public async Task<UserListItem> AddUserAsync(User user, BuddyGeoLocation location, string tag = null)
        {
            var c = new UserListItem(this.GetObjectPath() + PlatformAccess.GetCustomAttribute<BuddyObjectPathAttribute>(typeof(UserListItem)).Path, this.Client)
            {
                UserID = user.ID,
                Location = location,
                Tag = tag
            };

            var r = await c.SaveAsync();

            return r.Convert<UserListItem>(b => c).Value;
        }
Beispiel #2
0
        public async Task<AlbumItem> AddItemAsync(string itemId, string caption, BuddyGeoLocation location, string tag = null)
		{
	
			var c = new AlbumItem(this.GetObjectPath() + PlatformAccess.GetCustomAttribute<BuddyObjectPathAttribute>(typeof(AlbumItem)).Path, this.Client)
			{
				ItemId = itemId,
                Caption = caption,
				Location = location,
				Tag = tag
			};

            var r = await c.SaveAsync();
					
            return r.Convert<AlbumItem> (b => c).Value;
		}
Beispiel #3
0
        public async Task<BuddyResult<AlbumItem>> AddItemAsync(string itemId, string caption, BuddyGeoLocation location, string tag = null,
            BuddyPermissions readPermissions = BuddyPermissions.Default, BuddyPermissions writePermissions = BuddyPermissions.Default)
		{
			var c = new AlbumItem(this.GetObjectPath() + PlatformAccess.GetCustomAttribute<BuddyObjectPathAttribute>(typeof(AlbumItem)).Path, this.Client)
			{
				ItemId = itemId,
                Caption = caption,
				Location = location,
				Tag = tag,
                ReadPermissions = readPermissions,
                WritePermissions = writePermissions
			};

            var r = await c.SaveAsync();
					
            return r.Convert<AlbumItem>(b => c);
		}
Beispiel #4
0
        public async Task<BuddyResult<Picture>> AddProfilePictureAsync(string caption, Stream pictureData, string contentType, BuddyGeoLocation location = null,
            BuddyPermissions readPermissions = BuddyPermissions.Default, BuddyPermissions writePermissions = BuddyPermissions.Default)
        {
           var result = await PictureCollection.AddAsync(this.Client, caption, pictureData, contentType, location,
               readPermissions, writePermissions);

           if (result.IsSuccess)
           {
               ProfilePicture = result.Value;
           }

           return result;
        }
        private async void SaveCheckin() {


            var comment = txtComment.Text;


            var loc = mapView.UserLocation.Location.ToBuddyGeoLocation ();

			Action<Picture> finish = async (p) => {


                string photoID = null;

                if (p != null) {
                    photoID = p.ID;
                }

                // add the checkin

                if (_selected != null) {
                    loc = new BuddyGeoLocation(_selected.ID);
                }

                await Buddy.Checkins.AddAsync (comment, null, loc, photoID);

               

                this.NavigationController.PopViewControllerAnimated(true);

                PlatformAccess.Current.ShowActivity = false;

            };

            PlatformAccess.Current.ShowActivity = true;

            // if we have a photo save that first.
            //
            if (_chosenImage != null) {

                var bytes = _chosenImage.AsJPEG ();


				var result = await Buddy.Pictures.AddAsync (comment, bytes.AsStream (), "image/jpeg", loc);

                if (result.IsSuccess) {
                    finish (result.Value);
                }  
               
            } else {
                finish (null);
            }

        }
        public static CLLocation ToCLLocation(this BuddyGeoLocation loc)
        {
            var clLoc = new CLLocation(loc.Latitude, loc.Longitude);

            return(clLoc);
        }
        private async void SaveCheckin() {


            var comment = txtComment.Text;


            var loc = mapView.UserLocation.Location.ToBuddyGeoLocation ();

			Action<Picture> finish = async (p) => {


                string photoID = null;

                if (p != null) {
                    photoID = p.ID;
                }

                // add the checkin

                if (_selected != null) {
                    loc = new BuddyGeoLocation(_selected.ID);
                }

                await Buddy.PostAsync<Checkin>("/checkins", new {
                    Comment = comment,
                    Location = loc,
                    Tag = photoID
                });
                       
               

                this.NavigationController.PopViewControllerAnimated(true);

                PlatformAccess.Current.ShowActivity = false;

            };

            PlatformAccess.Current.ShowActivity = true;

            // if we have a photo save that first.
            //
            if (_chosenImage != null) {


                var result = await Buddy.PostAsync<Picture> ("/pictures", new {
                    data = new BuddyFile (_chosenImage.AsPNG ().AsStream (), "data", "image/png"),
                });

                if (result.IsSuccess) {
                    finish (result.Value);
                }  
               
            } else {
                finish (null);
            }

        }