public void SelectImageFromPhone() { try { CoreApplicationView view = CoreApplication.GetCurrentView(); FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".bmp"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); filePicker.FileTypeFilter.Add(".gif"); filePicker.FileTypeFilter.Add(".ico"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; } catch (Exception ex) { MessageDialogHelper.Show(ex.Message, "Error!"); } }
private async void appbarSave_Click(object sender, RoutedEventArgs e) { if (CheckObject()) { Test _Test = LoadTestObject(); MyResult result = await _DBAccess.SaveTestAsync(_Test); MessageDialogHelper.Show(result.Message, "Note"); if (result.IsSuccess) { Frame.Navigate(typeof(MainPage)); } } }
private async System.Threading.Tasks.Task LoadTests() { try { List <Test> list = new List <Test>(); list = await _DBAccess.LoadTestsAsync(); list = list.OrderByDescending(x => x.Id).ToList(); lvwDailyNotes.ItemsSource = list; } catch (Exception ex) { MessageDialogHelper.Show(ex.Message, "Loading"); } }
private bool CheckObject() { if (string.IsNullOrEmpty(txtname.Text.Trim())) { MessageDialogHelper.Show("Name is empty", "Checking"); return(false); } if (string.IsNullOrEmpty(txtpath.Text.Trim())) { MessageDialogHelper.Show("Path is empty", "Checking"); return(false); } return(true); }
private void Loadprofile(Test item) { try { ID = item.Id; txtname.Text = item.Name; txtpath.Text = item.Path; image = item.image; imgPhoto.Source = null; if (item.image != null) { BitmapImage _BitmapImage = new BitmapImage(); _BitmapImage = ImageHelper.BytesToBitmapImage(item.image); imgPhoto.Source = _BitmapImage; } } catch (Exception ex) { MessageDialogHelper.Show(ex.Message, "ERROR"); } }