private async Task urControl_CommittingDataFieldAsync(object sender, Windows.Controls.CommittingDataFieldEventArgs e)
        {
            if (e.TargetField.PropertyKey == "PictureFileId")
            {
                CustomDataField field     = e.TargetField as CustomDataField;
                PictureSelector pSelector = field.EditorElement as PictureSelector;
                if (pSelector.ChoosenPhotoStream != null)
                {
                    pSelector.ChoosenPhotoStream.Position = 0;
                    try
                    {
                        Guid id = await(CloudProvider.Current as ICloudProvider).UploadFileAsync(pSelector.FileName, pSelector.ChoosenPhotoStream);
                        e.Value = id;
                    }
                    catch (Exception ex)
                    {
                        e.Cancel = true;
                        System.Windows.MessageBox.Show("Could not upload your profile picture. Error: " + ex.Message);
                    }
                }
            }
            if (e.TargetField.PropertyKey == "BirthDate")
            {
                DateTime value = (DateTime)e.Value;

                e.Value = new DateTime(value.Ticks, DateTimeKind.Utc);
            }
        }
Exemplo n.º 2
0
        public virtual InitializePaymentRequest AddCustomData(CustomDataField item)
        {
            Ensure.That(item, "item").IsNotNull();

            InternalCustomData.Add(item);

            return(this);
        }
Exemplo n.º 3
0
 private async System.Threading.Tasks.Task objectBrowser_CommittingDataFieldAsync(object sender, Windows.Controls.CommittingDataFieldEventArgs args)
 {
     if (args.TargetField.PropertyKey == "PictureFileId")
     {
         CustomDataField field     = args.TargetField as CustomDataField;
         PictureSelector pSelector = field.EditorElement as PictureSelector;
         if (pSelector.ChoosenPhotoStream != null)
         {
             pSelector.ChoosenPhotoStream.Position = 0;
             try
             {
                 Guid result = await(CloudProvider.Current as ICloudProvider).UploadFileAsync(pSelector.FileName, pSelector.ChoosenPhotoStream);
                 args.Value = result;
                 (this.objectBrowser.CurrentItem as Activity).PictureStream = null;
             }
             catch (Exception e)
             {
                 System.Windows.MessageBox.Show("Could not upload picture. Error: " + e.Message);
             }
         }
     }
 }