public AddSignatureFlyoutPanel()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
        }
        public AssignmentsPage ()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
        }
        public PhotoViewModel ()
        {
            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            photoSelectedCommand = new DelegateCommand (obj => {
                var photo = obj as Photo;
                if (photo != null) {
                    SelectedPhoto = photo;
                } else
                    SelectedPhoto = null;
            });

            savePhotoCommand = new DelegateCommand (async _ => {
                selectedPhoto.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
                await SavePhotoAsync (assignmentViewModel.SelectedAssignment, selectedPhoto);
                await LoadPhotosAsync (assignmentViewModel.SelectedAssignment);
                OnPropertyChanged ("Photos");
            });

            deletePhotoCommand = new DelegateCommand (async _ => {
                bool yesDelete = false;
                var dialog = new MessageDialog ("Are you sure?", "Delete Image");
                dialog.Commands.Add (new UICommand ("Yes", del => { yesDelete = true; }));
                dialog.Commands.Add(new UICommand("No"));
                await dialog.ShowAsync ();
                if (yesDelete) {
                    await DeletePhotoAsync (assignmentViewModel.SelectedAssignment, selectedPhoto);
                    await LoadPhotosAsync (assignmentViewModel.SelectedAssignment);
                    SelectedPhoto = null;
                }
            });
        }
Example #4
0
        public ItemViewModel()
        {
            assignmentViewModel = ServiceContainer.Resolve <AssignmentViewModel> ();

            saveAssignmentItemCommand = new DelegateCommand(obj => {
                var item = obj as AssignmentItem;
                if (item != null && assignmentViewModel.SelectedAssignment != null)
                {
                    SaveAssignmentItemAsync(assignmentViewModel.SelectedAssignment, item);
                }
            });

            searchItemsCommand = new DelegateCommand(async _ => {
                await LoadItemsAsync();
                var items = new List <Item> ();
                foreach (var item in Items)
                {
                    if (item.Name.ToLower().Contains(SearchText.ToLower()) || item.Number.ToLower().Contains(SearchText.ToLower()))
                    {
                        items.Add(item);
                    }
                }
                SearchItems = items;
            });

            addItemCommand = new DelegateCommand(_ => {
                if (addItemPopUp != null && addItemPopUp.IsOpen)
                {
                    addItemPopUp.IsOpen = false;
                }
                addItemPopUp                   = new Popup();
                addItemPopUp.Height            = Window.Current.Bounds.Height;
                addItemPopUp.Width             = Constants.PopUpWidth;
                AddItemFlyoutPanel flyoutpanel = new AddItemFlyoutPanel();
                flyoutpanel.Width              = addItemPopUp.Width;
                flyoutpanel.Height             = addItemPopUp.Height;
                addItemPopUp.Child             = flyoutpanel;
                addItemPopUp.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                addItemPopUp.SetValue(Canvas.TopProperty, 0);
                addItemPopUp.IsOpen = true;
                SearchText          = string.Empty;
                SearchItemsCommand.Invoke();
            });

            cancelAddItemCommand = new DelegateCommand(_ => {
                addItemPopUp.IsOpen = false;
            });

            deleteItemCommand = new DelegateCommand(async _ => {
                if (selectedItem != null)
                {
                    await DeleteAssignmentItemAsync(assignmentViewModel.SelectedAssignment, selectedItem);
                    await LoadAssignmentItemsAsync(assignmentViewModel.SelectedAssignment);
                }
            });
        }
        public AssignmentHistoryPage ()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
            
            historyListView.DataContext =
                historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
        }
        public ImagesPage ()
        {
            this.InitializeComponent ();

            imagesGoBack.DataContext =
                background.DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            DataContext =
                photosListView.DataContext =
                photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();
        }
        public AssignmentControl ()
        {
            this.InitializeComponent ();

            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
            this.Loaded += (sender, e) => {
                //toggle button state changed isn't being called unless is checked changes, this does not call the record button by setting this property
                //this was the only way at the moment to get the toggle button to have its recording state changed when navigating to and from this screen.
                record.IsChecked = !assignmentViewModel.Recording;
                record.IsChecked = assignmentViewModel.Recording;
            };
        }
        public AddItemFlyoutPanel ()
        {
            this.InitializeComponent ();

            DataContext =
                itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();

            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            itemSearchText.TextChanged += (sender, e) => {
                itemViewModel.SearchText = itemSearchText.Text;
            };
        }
        public ItemViewModel ()
        {
            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            saveAssignmentItemCommand = new DelegateCommand (obj => {
                var item = obj as AssignmentItem;
                if (item != null && assignmentViewModel.SelectedAssignment != null) {
                    SaveAssignmentItemAsync (assignmentViewModel.SelectedAssignment, item);
                }
            });

            searchItemsCommand = new DelegateCommand (async _ => {
                await LoadItemsAsync ();
                var items = new List<Item> ();
                foreach (var item in Items) {
                    if (item.Name.ToLower ().Contains (SearchText.ToLower ()) || item.Number.ToLower ().Contains (SearchText.ToLower ())) {
                        items.Add (item);
                    }
                }
                SearchItems = items;
            });

            addItemCommand = new DelegateCommand (_ => {
                if (addItemPopUp != null && addItemPopUp.IsOpen) {
                    addItemPopUp.IsOpen = false;
                }
                addItemPopUp = new Popup ();
                addItemPopUp.Height = Window.Current.Bounds.Height;
                addItemPopUp.Width = Constants.PopUpWidth;
                AddItemFlyoutPanel flyoutpanel = new AddItemFlyoutPanel ();
                flyoutpanel.Width = addItemPopUp.Width;
                flyoutpanel.Height = addItemPopUp.Height;
                addItemPopUp.Child = flyoutpanel;
                addItemPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                addItemPopUp.SetValue (Canvas.TopProperty, 0);
                addItemPopUp.IsOpen = true;
                SearchText = string.Empty;
                SearchItemsCommand.Invoke ();
            });

            cancelAddItemCommand = new DelegateCommand (_ => {
                addItemPopUp.IsOpen = false;
            });

            deleteItemCommand = new DelegateCommand (async _ => {
                if (selectedItem != null) {
                    await DeleteAssignmentItemAsync (assignmentViewModel.SelectedAssignment, selectedItem);
                    await LoadAssignmentItemsAsync (assignmentViewModel.SelectedAssignment);
                }
            });
        }
Example #10
0
        public MapPage ()
        {
            this.InitializeComponent ();
            map.Credentials = Constants.BingMapsKey;

            locator = new Geolocator ();
            popup = new MapPopup ();

            userPin = new Pushpin ();
            userPin.Tapped += OnPinTapped;

            DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
        }
Example #11
0
 public LaborViewModel()
 {
     assignmentViewModel   = ServiceContainer.Resolve <AssignmentViewModel> ();
     cancelAddLaborCommand = new DelegateCommand(_ => {
         addLaborPopUp.IsOpen = false;
     });
     saveAddLaborCommand = new DelegateCommand(async _ => {
         selectedLabor.Hours        = TimeSpan.FromHours(currentLaborHours.ToDouble(CultureInfo.InvariantCulture));
         selectedLabor.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
         await SaveLaborAsync(assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync(assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     deleteAddLaborCommand = new DelegateCommand(async _ => {
         await DeleteLaborAsync(assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync(assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     addLaborCommand = new DelegateCommand(obj => {
         var labor = obj as Labor;
         if (labor != null)
         {
             SelectedLabor  = labor;
             AddLaborHeader = "Labor";
             CanDelete      = true;
         }
         else
         {
             SelectedLabor  = new Labor();
             AddLaborHeader = "Add Labor";
             CanDelete      = false;
         }
         if (addLaborPopUp != null && addLaborPopUp.IsOpen)
         {
             addLaborPopUp.IsOpen = false;
         }
         addLaborPopUp                   = new Popup();
         addLaborPopUp.Height            = Window.Current.Bounds.Height;
         addLaborPopUp.Width             = Constants.PopUpWidth;
         AddLaborFlyoutPanel flyoutpanel = new AddLaborFlyoutPanel();
         flyoutpanel.Width               = addLaborPopUp.Width;
         flyoutpanel.Height              = addLaborPopUp.Height;
         addLaborPopUp.Child             = flyoutpanel;
         addLaborPopUp.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
         addLaborPopUp.SetValue(Canvas.TopProperty, 0);
         addLaborPopUp.IsOpen = true;
     });
 }
        public LaborPage ()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentControl.DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            laborListView.DataContext =
                laborAddLabor.DataContext =
                laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();

            Window.Current.SizeChanged += (sender, e) => {
                if (laborViewModel.LaborPopUp != null && laborViewModel.LaborPopUp.IsOpen) {
                    laborViewModel.LaborPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                }
            };
        }
        public ExpensesPage ()
        {
            this.InitializeComponent ();

            DataContext =    
                assignmentControl.DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            expensesListView.DataContext =
                expensesAddExpense.DataContext =
                expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel> ();

            Window.Current.SizeChanged += (sender, e) => {
                if (expenseViewModel.ExpensePopUp != null && expenseViewModel.ExpensePopUp.IsOpen) {
                    expenseViewModel.ExpensePopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                }
            };
        }
 public LaborViewModel ()
 {
     assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
     cancelAddLaborCommand = new DelegateCommand (_ => {
         addLaborPopUp.IsOpen = false;
     });
     saveAddLaborCommand = new DelegateCommand (async _ => {
         selectedLabor.Hours = TimeSpan.FromHours (currentLaborHours.ToDouble (CultureInfo.InvariantCulture));
         selectedLabor.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
         await SaveLaborAsync (assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync (assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     deleteAddLaborCommand = new DelegateCommand (async _ => {
         await DeleteLaborAsync (assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync (assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     addLaborCommand = new DelegateCommand (obj => {
         var labor = obj as Labor;
         if (labor != null) {
             SelectedLabor = labor;
             AddLaborHeader = "Labor";
             CanDelete = true;
         } else {
             SelectedLabor = new Labor ();
             AddLaborHeader = "Add Labor";
             CanDelete = false;
         }
         if (addLaborPopUp != null && addLaborPopUp.IsOpen) {
             addLaborPopUp.IsOpen = false;
         }
         addLaborPopUp = new Popup ();
         addLaborPopUp.Height = Window.Current.Bounds.Height;
         addLaborPopUp.Width = Constants.PopUpWidth;
         AddLaborFlyoutPanel flyoutpanel = new AddLaborFlyoutPanel ();
         flyoutpanel.Width = addLaborPopUp.Width;
         flyoutpanel.Height = addLaborPopUp.Height;
         addLaborPopUp.Child = flyoutpanel;
         addLaborPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
         addLaborPopUp.SetValue (Canvas.TopProperty, 0);
         addLaborPopUp.IsOpen = true;
     });
 }
        public ConfirmationsPage ()
        {
            this.InitializeComponent ();

            assignmentControl.DataContext =
                DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            photoListView.DataContext =
                photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();

            Window.Current.SizeChanged += (sender, e) => {
                if (assignmentViewModel.SignaturePopUp != null && assignmentViewModel.SignaturePopUp.IsOpen) {
                    assignmentViewModel.SignaturePopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.SignaturePopUpWidth);
                }
            };

            picker = new MediaPicker ();
        }
        public AssignmentPage ()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentControl.DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
            
            itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();
            
            laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();
            
            photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();
            
            expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel> ();
            
            documentViewModel = ServiceContainer.Resolve<DocumentViewModel> ();
            
            historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();

            picker = new MediaPicker ();
        }
Example #17
0
        public ItemsPage ()
        {
            this.InitializeComponent ();

            DataContext =
                assignmentControl.DataContext =
                assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            itemsListView.DataContext =
                itemsAddItem.DataContext =
                itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();

            applicationBar.Closed += (sender, e) => {
                itemViewModel.SelectedItem = null;
                applicationBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            };

            Window.Current.SizeChanged += (sender, e) => {
                if (itemViewModel.ItemPopUp != null && itemViewModel.ItemPopUp.IsOpen) {
                    itemViewModel.ItemPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                }
            };
        }
Example #18
0
        public PhotoViewModel()
        {
            assignmentViewModel = ServiceContainer.Resolve <AssignmentViewModel> ();

            photoSelectedCommand = new DelegateCommand(obj => {
                var photo = obj as Photo;
                if (photo != null)
                {
                    SelectedPhoto = photo;
                }
                else
                {
                    SelectedPhoto = null;
                }
            });

            savePhotoCommand = new DelegateCommand(async _ => {
                selectedPhoto.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
                await SavePhotoAsync(assignmentViewModel.SelectedAssignment, selectedPhoto);
                await LoadPhotosAsync(assignmentViewModel.SelectedAssignment);
                OnPropertyChanged("Photos");
            });

            deletePhotoCommand = new DelegateCommand(async _ => {
                bool yesDelete = false;
                var dialog     = new MessageDialog("Are you sure?", "Delete Image");
                dialog.Commands.Add(new UICommand("Yes", del => { yesDelete = true; }));
                dialog.Commands.Add(new UICommand("No"));
                await dialog.ShowAsync();
                if (yesDelete)
                {
                    await DeletePhotoAsync(assignmentViewModel.SelectedAssignment, selectedPhoto);
                    await LoadPhotosAsync(assignmentViewModel.SelectedAssignment);
                    SelectedPhoto = null;
                }
            });
        }
Example #19
0
        public ExpenseViewModel()
        {
            picker = new MediaPicker();

            assignmentViewModel = ServiceContainer.Resolve <AssignmentViewModel>();

            addExpenseCommand = new DelegateCommand(async obj => {
                var expense = obj as Expense;
                if (expense != null)
                {
                    SelectedExpense  = expense;
                    CanDelete        = true;
                    AddExpenseHeader = "Expense";
                    await LoadPhotoAsync(expense);
                }
                else
                {
                    SelectedExpense  = new Expense();
                    CanDelete        = false;
                    AddExpenseHeader = "Add Expense";
                    Photo            = new ExpensePhoto();
                }
                if (addExpensePopUp != null && addExpensePopUp.IsOpen)
                {
                    addExpensePopUp.IsOpen = false;
                }
                addExpensePopUp                   = new Popup();
                addExpensePopUp.Height            = Window.Current.Bounds.Height;
                addExpensePopUp.Width             = Constants.PopUpWidth;
                AddExpenseFlyoutPanel flyoutpanel = new AddExpenseFlyoutPanel();
                flyoutpanel.Width                 = addExpensePopUp.Width;
                flyoutpanel.Height                = addExpensePopUp.Height;
                addExpensePopUp.Child             = flyoutpanel;
                addExpensePopUp.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                addExpensePopUp.SetValue(Canvas.TopProperty, 0);
                addExpensePopUp.IsOpen = true;
            });

            saveExpenseCommand = new DelegateCommand(async _ => {
                selectedExpense.Cost         = ExpenseCost.ToDecimal(CultureInfo.InvariantCulture);
                selectedExpense.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
                var task = SaveExpenseAsync(assignmentViewModel.SelectedAssignment, SelectedExpense);
                if (Photo != null && Photo.Image != null)
                {
                    task = task.ContinueWith(obj => {
                        Photo.ExpenseId = SelectedExpense.Id;
                    });
                    await SavePhotoAsync();
                }
                await LoadExpensesAsync(assignmentViewModel.SelectedAssignment);
                addExpensePopUp.IsOpen = false;
            });

            deleteExpenseCommand = new DelegateCommand(async _ => {
                await DeleteExpenseAsync(assignmentViewModel.SelectedAssignment, selectedExpense);
                await LoadExpensesAsync(assignmentViewModel.SelectedAssignment);
                addExpensePopUp.IsOpen = false;
            });

            cancelExpenseCommand = new DelegateCommand(_ => {
                addExpensePopUp.IsOpen = false;
            });

            addImageCommand = new DelegateCommand(async _ => {
                bool cameraCommand = false, imageCommand = false;
                var dialog         = new MessageDialog("Take picture with your built in camera or select one from your photo library.", "Add Image");
                if (picker.IsCameraAvailable)
                {
                    dialog.Commands.Add(new UICommand("Camera", new UICommandInvokedHandler(q => cameraCommand = true)));
                }
                dialog.Commands.Add(new UICommand("Library", new UICommandInvokedHandler(q => imageCommand = true)));

                await dialog.ShowAsync();

                if (cameraCommand)
                {
                    try {
                        var mediaFile = await picker.TakePhotoAsync(new StoreCameraMediaOptions());

                        var photo = await mediaFile.GetStream().LoadBytes();
                        if (Photo == null)
                        {
                            Photo = new ExpensePhoto {
                                ExpenseId = SelectedExpense.Id
                            }
                        }
                        ;
                        Photo.Image = photo;
                        OnPropertyChanged("Photo");
                    } catch (Exception exc) {
                        Debug.WriteLine(exc.Message);
                        //this could happen if they cancel, etc.
                    }
                }
                else if (imageCommand)
                {
                    try {
                        var mediaFile = await picker.PickPhotoAsync();

                        var photo = await mediaFile.GetStream().LoadBytes();
                        if (Photo == null)
                        {
                            Photo = new ExpensePhoto {
                                ExpenseId = SelectedExpense.Id
                            }
                        }
                        ;
                        Photo.Image = photo;
                        OnPropertyChanged("Photo");
                    } catch (Exception exc) {
                        Debug.WriteLine(exc.Message);
                        //this could happen if they cancel, etc.
                    }
                }
            });
        }
Example #20
-1
        public ExpenseViewModel ()
        {
            picker = new MediaPicker ();

            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();

            addExpenseCommand = new DelegateCommand (async obj => {
                var expense = obj as Expense;
                if (expense != null) {
                    SelectedExpense = expense;
                    CanDelete = true;
                    AddExpenseHeader = "Expense";
                    await LoadPhotoAsync (expense);
                } else {
                    SelectedExpense = new Expense ();
                    CanDelete = false;
                    AddExpenseHeader = "Add Expense";
                    Photo = new ExpensePhoto ();
                }
                if (addExpensePopUp != null && addExpensePopUp.IsOpen) {
                    addExpensePopUp.IsOpen = false;
                }
                addExpensePopUp = new Popup ();
                addExpensePopUp.Height = Window.Current.Bounds.Height;
                addExpensePopUp.Width = Constants.PopUpWidth;
                AddExpenseFlyoutPanel flyoutpanel = new AddExpenseFlyoutPanel ();
                flyoutpanel.Width = addExpensePopUp.Width;
                flyoutpanel.Height = addExpensePopUp.Height;
                addExpensePopUp.Child = flyoutpanel;
                addExpensePopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                addExpensePopUp.SetValue (Canvas.TopProperty, 0);
                addExpensePopUp.IsOpen = true;
            });

            saveExpenseCommand = new DelegateCommand (async _ => {
                selectedExpense.Cost = ExpenseCost.ToDecimal (CultureInfo.InvariantCulture);
                selectedExpense.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
                var task = SaveExpenseAsync (assignmentViewModel.SelectedAssignment, SelectedExpense);
                if (Photo !=null && Photo.Image != null) {
                    task = task.ContinueWith (obj => {
                        Photo.ExpenseId = SelectedExpense.Id;
                    });
                    await SavePhotoAsync ();
                }
                await LoadExpensesAsync (assignmentViewModel.SelectedAssignment);
                addExpensePopUp.IsOpen = false;
            });

            deleteExpenseCommand = new DelegateCommand (async _ => {
                await DeleteExpenseAsync (assignmentViewModel.SelectedAssignment, selectedExpense);
                await LoadExpensesAsync (assignmentViewModel.SelectedAssignment);
                addExpensePopUp.IsOpen = false;
            });

            cancelExpenseCommand = new DelegateCommand (_ => {
                addExpensePopUp.IsOpen = false;
            });

            addImageCommand = new DelegateCommand (async _ => {
                bool cameraCommand = false, imageCommand = false;
                var dialog = new MessageDialog ("Take picture with your built in camera or select one from your photo library.", "Add Image");
                if (picker.IsCameraAvailable) {
                    dialog.Commands.Add (new UICommand ("Camera", new UICommandInvokedHandler (q => cameraCommand = true)));
                }
                dialog.Commands.Add (new UICommand ("Library", new UICommandInvokedHandler (q => imageCommand = true)));

                await dialog.ShowAsync ();

                if (cameraCommand) {
                    try {
                        var mediaFile = await picker.TakePhotoAsync (new StoreCameraMediaOptions ());

                        var photo = await mediaFile.GetStream ().LoadBytes ();
                        if (Photo == null)
                            Photo = new ExpensePhoto { ExpenseId = SelectedExpense.Id };
                        Photo.Image = photo;
                        OnPropertyChanged ("Photo");
                    } catch (Exception exc) {
                        Debug.WriteLine (exc.Message);
                        //this could happen if they cancel, etc.
                    }
                } else if (imageCommand) {
                    try {
                        var mediaFile = await picker.PickPhotoAsync ();

                        var photo = await mediaFile.GetStream ().LoadBytes ();
                        if (Photo == null)
                            Photo = new ExpensePhoto { ExpenseId = SelectedExpense.Id };
                        Photo.Image = photo;
                        OnPropertyChanged ("Photo");
                    } catch (Exception exc) {
                        Debug.WriteLine (exc.Message);
                        //this could happen if they cancel, etc.
                    }
                }
            });
        }