Esempio n. 1
0
        async void lstFriends_Tap(object sender, GestureEventArgs e)
        {
            if (lstFriends.SelectedItem != null)
            {
                
                FacebookUser selectedFriend = lstFriends.SelectedItem as FacebookUser;
                Permission permission = new Permission();

                MessageBoxResult result = MessageBox.Show(
                    string.Format(AppResources.FriendAddView_Txt_FriendAddQuestion,selectedFriend.Name),
                    AppResources.FriendAddView_Txt_FriendAddTitle,
                    MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.OK)
                {
                    permission.FBIDFromViewed = selectedFriend.Id;
                    permission.FBIDFromViewer = App.fbUserID;
                    permission.IsAllowed = false;
                    permission.PartitionKey = permission.FBIDFromViewer;
                    permission.RowKey = permission.FBIDFromViewed;
                    
                    bool addResult = await (this.DataContext as FriendAddViewModel).TryAddNewFriend(permission);
                    if (addResult)
                        MessageBox.Show(AppResources.FriendAddView_Txt_FriendAddSuccess,AppResources.FriendAddView_Txt_FriendAddTitle, MessageBoxButton.OK);
                    else MessageBox.Show(AppResources.FriendAddView_Txt_FriendAddError, AppResources.FriendAddView_Txt_FriendAddTitle, MessageBoxButton.OK);
                }   
            }
        }
Esempio n. 2
0
        public async Task<bool> TryAddNewFriend(Permission permission)
        {
            HaventUploaded = true;
            bool result = await Queries.TryInsertEntityAsync("AllowedOne", permission);
            HaventUploaded = false;

            return result;
        }
Esempio n. 3
0
 static Permission GetPermission(Friend selectedFriend)
 {
     Permission per = new Permission();
     per.FBIDFromViewed = selectedFriend.FBIDFromViewed;
     per.FBIDFromViewer = selectedFriend.FBIDFromViewer;
     per.IsAllowed = !selectedFriend.IsAllowed;
     per.PartitionKey = per.FBIDFromViewer;
     per.RowKey = per.FBIDFromViewed;
     return per;
 }
Esempio n. 4
0
        public async Task<bool> TryUpdatePermission(Permission permission)
        {
            HaventUploaded = true;
            bool result = await Queries.TryUpdateEntityAsync("AllowedOne", permission, permission.PartitionKey, permission.RowKey);
            HaventUploaded = false;

            return result;
        }