public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { bool result = true; PhotoRecord record = value as PhotoRecord; if (String.Equals(record.SenderUserId, App.CurrentUser.UserId) || record.Expired == true) { result = false; } return(result); }
public static PhotoEntity ToEntity(this PhotoRecord record) { return(new PhotoEntity { Id = record.PhotoId, CloudUrl = record.CloudUrl, CreatedAt = record.CreatedAt, EntityId = record.EntityId, Order = record.Order, Height = record.Height, Width = record.Width }); }
public SendViewModel() { chatService = ServiceLocator.Current.GetInstance <IChatService>(); parentViewModel = ServiceLocator.Current.GetInstance <CameraViewModel>(); parentViewModel.PropertyChanged += parentViewModel_PropertyChanged; ResetImageSource(); SendPhoto = new RelayCommand(async() => { PhotoRecord p = new PhotoRecord(); // If they didn't explicitly toggle the list picker, assume // they want the first contact in the list. if (SelectedFriend != null) { p.RecepientUserId = SelectedFriend.UserId; } else { p.RecepientUserId = Friends.First().UserId; } p.SenderUserId = App.CurrentUser.UserId; p.SenderName = App.CurrentUser.Name; await chatService.CreatePhotoRecordAsync(p); System.Net.Http.HttpResponseMessage m = await chatService.UploadPhotoAsync(p.Uri, p.UploadKey, parentViewModel.Image); App.RootFrame.Navigate(new Uri("/View/PhotosPage.xaml", UriKind.RelativeOrAbsolute)); }); RefreshCommand = new RelayCommand(async() => { Friends = await chatService.ReadFriendsAsync(App.CurrentUser.UserId); }); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string result = String.Empty; PhotoRecord record = value as PhotoRecord; if (String.Equals(record.SenderUserId, App.CurrentUser.UserId)) { // Sent result = "\ue120"; } else if (record.Expired == true) { // Read result = "\ue166"; } else { // Unread result = "\ue119"; } return(result); }