コード例 #1
0
ファイル: UserList.cs プロジェクト: halukmy/Buddy-DotNET-SDK
        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;
        }
コード例 #2
0
ファイル: Album.cs プロジェクト: halukmy/Buddy-DotNET-SDK
        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;
		}
コード例 #3
0
ファイル: Album.cs プロジェクト: nickatbuddy/Buddy-DotNET-SDK
        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);
		}
コード例 #4
0
ファイル: User.cs プロジェクト: nickatbuddy/Buddy-DotNET-SDK
        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;
        }
コード例 #5
0
        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);
            }

        }
コード例 #6
0
        public static CLLocation ToCLLocation(this BuddyGeoLocation loc)
        {
            var clLoc = new CLLocation(loc.Latitude, loc.Longitude);

            return(clLoc);
        }
コード例 #7
0
        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);
            }

        }