public override void Setup() { base.Setup(); var photo1 = new SalesApp.Core.BL.Models.People.CustomerPhoto { CustomerIdentifier = "273194961", PhotoStatus = PhotoSaveStatus.Successful, PhotoUploadStatus = PhotoUploadStatus.Pending, FilePath = "bla bla bla bla" }; var photo2 = new SalesApp.Core.BL.Models.People.CustomerPhoto { CustomerIdentifier = "273194961", PhotoStatus = PhotoSaveStatus.Successful, PhotoUploadStatus = PhotoUploadStatus.Pending, FilePath = "bla bla bla bla" }; this._photos = new List <SalesApp.Core.BL.Models.People.CustomerPhoto> { photo1, photo2 }; string nationalId = "273194961"; var service = Substitute.For <CustomerPhotoService>(); service.GetCustomerPhotos(nationalId).Returns(async a => await this.GetPhotos()); this._model = new CustomerPhotoViewModel(nationalId, service); }
private async void AdapterOnPhotoUpdated(object sender, CustomerPhotoUpdatedEvent e) { CustomerPhotoViewModel vm = this.ViewModel as CustomerPhotoViewModel; if (vm == null) { return; } vm.PhotoUpdated(e.Position); // serialize the selected photo and pass it's string to the Photo Upload service CustomerPhoto photo = vm.CustomerPhotos[e.Position]; var photoList = new List <CustomerPhoto> { photo }; var photoListString = JsonConvert.SerializeObject(photoList); Logger.Verbose(photoListString); var photoUploadServiceIntent = new Intent(Activity, typeof(CustomerPhotoUploadService)); photoUploadServiceIntent.PutExtra(CustomerPhotoUploadService.PhotoList, photoListString); Activity.StartService(photoUploadServiceIntent); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { base.OnCreateView(inflater, container, savedState); this.FragmentView = this.BindingInflate(Resource.Layout.fragment_customer_photos, null); _addPhoto = this.FragmentView.FindViewById <Button>(Resource.Id.add_photo); var adapter = new CustomerPhotoListAdapter(this.Activity, (IMvxAndroidBindingContext)this.BindingContext); MvxListView photoList = this.FragmentView.FindViewById <MvxListView>(Resource.Id.photo_list); photoList.Adapter = adapter; if (this.Arguments != null) { _customerNationalId = this.Arguments.GetString(CustomerNationalIdBundleKey); _phone = this.Arguments.GetString(CustomerPhoneBundleKey); } CustomerPhotoViewModel viewModel = new CustomerPhotoViewModel(_customerNationalId, new CustomerPhotoService()); this.ViewModel = viewModel; adapter.PhotoUpdated += AdapterOnPhotoUpdated; _customerPhotoUploaderReceiver = new CustomerPhotoUploaderReceiver(); _addPhoto.Click += AddPhotoOnClick; // App trackking GoogleAnalyticService.Instance.TrackScreen(Activity.GetString(Resource.String.customer_photo)); return(this.FragmentView); }
private void UploadStatusEvent(object sender, UploadStatusEventArgs e) { CustomerPhotoViewModel vm = this.ViewModel as CustomerPhotoViewModel; if (e.PhotoUploadStatusDictionary == null || vm == null) { return; } foreach (var map in e.PhotoUploadStatusDictionary) { CustomerPhoto photo = new CustomerPhoto { Id = map.Key, PhotoUploadStatus = map.Value }; vm.PhotoUpdated(photo); } }
public async Task SwipeRefresh(bool forceRemote) { CustomerPhotoViewModel vm = this.GetTypeSafeViewModel <CustomerPhotoViewModel>(); vm.GetCustomerPhotos(); }