示例#1
0
        private async Task LoadCustomerPhoto(string nationalId)
        {
            CustomerPhotoService service = new CustomerPhotoService();
            CustomerPhoto        photo   = await service.GetMostRecentCustomerPhoto(nationalId);

            CustomerDetailFragmentViewModel vm = this.ViewModel as CustomerDetailFragmentViewModel;

            if (photo == null || photo.FilePath == null || vm == null)
            {
                return;
            }

            vm.MostRecentPhoto = photo.FilePath;
            try
            {
                Bitmap bitmap = BitmapFactory.DecodeFile(photo.FilePath);

                if (bitmap == null)
                {
                    return;
                }

                this.Activity.RunOnUiThread(() =>
                {
                    this._imgCustomerPhoto.SetImageBitmap(bitmap);
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
        private async Task MarkReadyForUpload(CustomerRegistrationCompletedEventArgs e)
        {
            if (e == null || !e.Succeeded)
            {
                return;
            }

            CustomerPhotoService service = new CustomerPhotoService();
            await service.MarkForUpload(this.personRegistrationInfo.NationalId);
        }
 public CustomerPhotoViewModel(string nationalId, CustomerPhotoService service)
 {
     this._service    = service;
     this._nationalId = nationalId;
 }