public void MarkPhotoAsCompleted(CategoryListViewItem categoryListViewItem, int photoIndex) { //Create a new PhotoListView Item and replace the old one (Since updating newItem.Spinning isnt reflected in the ListView) PhotoListViewItem oldItem = categoryListViewItem.PhotoListViewItems.ElementAt(photoIndex); PhotoListViewItem newItem = new PhotoListViewItem(); newItem.Photo = oldItem.Photo; newItem.Filename = oldItem.Filename; newItem.Enabled = true; newItem.Thumbnail = oldItem.Thumbnail; newItem.Spinning = ProgressRing.OFF; categoryListViewItem.PhotoListViewItems[photoIndex] = newItem; PopulatePhotoDetails(newItem); /*if (ProgressBarControl.Visibility == Visibility.Visible) * { * ProgressBarControl.Value += 1; * this.PhotoStatus.Text = Properties.Resources.ProcessingPhoto + " " +(int)(ProgressBarControl.Value + 1) + " " + Properties.Resources.Of + " " + (int)ProgressBarControl.Maximum; * }*/ if (OverallProgressRing.Visibility == Visibility.Visible) { count++; this.PhotoStatus.Text = Properties.Resources.ProcessingPhoto + " " + (count + 1) + " " + Properties.Resources.Of + " " + photoCount; } }
private void PhotoListView_MouseUp(object sender, MouseButtonEventArgs e) { ListView photoListView = sender as ListView; PhotoListViewItem photoListViewItem = photoListView.SelectedItem as PhotoListViewItem; if (photoListViewItem != null && photoListViewItem.Enabled == true) { PopulatePhotoDetails(photoListViewItem); } }
private PhotoListViewItem CreatePhotoListViewItem(Photo photo, bool enabled) { PhotoListViewItem photoListViewItem = new PhotoListViewItem(); photoListViewItem.Photo = photo; photoListViewItem.Filename = photo.Filename; photoListViewItem.Thumbnail = FetchImage(photo.SourceFilePath, 100); photoListViewItem.Enabled = enabled; photoListViewItem.Spinning = ProgressRing.OFF; return(photoListViewItem); }
public void MarkPhotoAsBusy(CategoryListViewItem categoryListViewItem, int photoIndex) { //Create a new PhotoListView Item and replace the old one (Since updating newItem.Spinning isnt reflected in the ListView) PhotoListViewItem oldItem = categoryListViewItem.PhotoListViewItems.ElementAt(photoIndex); PhotoListViewItem newItem = new PhotoListViewItem(); newItem.Photo = oldItem.Photo; newItem.Filename = oldItem.Filename; newItem.Enabled = false; newItem.Thumbnail = oldItem.Thumbnail; newItem.Spinning = ProgressRing.ON; categoryListViewItem.PhotoListViewItems[photoIndex] = newItem; }
private void PopulatePhotoDetails(PhotoListViewItem photoListViewItem) { //Set Photo Name this.FileName.Text = photoListViewItem.Filename; //Set Source Photo this.SourcePhoto.Source = FetchImage(photoListViewItem.Photo.SourceFilePath, 500); //Visualizations this.VisualizationComboBox.DataContext = photoListViewItem.Photo.VisualizationImages; this.VisualizationComboBox.SelectedIndex = 0; //Set Photo Details this.PhotoDetails.Children.Clear(); //double itemWidth = this.PhotoDetails.Width / 4; Thickness itemMargin = new Thickness(20, 0, 20, 0); foreach (PhotoDetail photoDetail in photoListViewItem.Photo.PhotoDetails) { if ((photoDetail.DisplayPreference == Constants.DisplayPreference.DETAIL_PAGE || photoDetail.DisplayPreference == Constants.DisplayPreference.RESULT_AND_DETAIL_PAGE) || (Properties.Settings.Default.DisplayPhotoMOS && photoDetail.ParameterName == "MOS")) { //Create Grid with Feature Name and Value TextBlock featureName = new TextBlock(); featureName.Style = this.Resources["ContentTextStyle"] as Style; featureName.Foreground = new SolidColorBrush(Colors.Black); featureName.TextAlignment = TextAlignment.Left; featureName.Text = photoDetail.ParameterName; TextBlock featureValue = new TextBlock(); featureValue.Style = this.Resources["ContentTextStyle"] as Style; featureValue.TextAlignment = TextAlignment.Right; featureValue.Text = double.IsNaN(photoDetail.Value) ? photoDetail.ValueString : photoDetail.Value.ToString("0.00"); Grid grid = new Grid(); grid.Height = 30; grid.Width = 300; grid.Margin = itemMargin; grid.Children.Add(featureName); grid.Children.Add(featureValue); this.PhotoDetails.Children.Add(grid); } } }
private int PopulateCategories(List <Category> categoryList) { PhotoListViewItem firstPhotoListViewItem = null; int photoCount = 0; if (categoryList.Count > 0) { //Put the different categories into different listViews foreach (Category category in categoryList) { CategoryListViewItem categoryListViewItem = new CategoryListViewItem(); categoryListViewItem.Name = category.Name; this.categoryListViewItems.Add(categoryListViewItem); if (category.PhotoList.Count > 0) { foreach (Photo photo in category.PhotoList) { PhotoListViewItem photoListViewItem = CreatePhotoListViewItem(photo, true); categoryListViewItem.PhotoListViewItems.Add(photoListViewItem); if (!photo.Analyzed) { photoListViewItem.Enabled = false; } //Save the first photo item to display if (firstPhotoListViewItem == null) { firstPhotoListViewItem = photoListViewItem; } } photoCount += category.PhotoList.Count; } } //Display the details of the first Photo PopulatePhotoDetails(firstPhotoListViewItem); } return(photoCount); }
private void PopulatePhotoDetails(PhotoListViewItem photoListViewItem) { //Set Photo Name this.FileName.Text = photoListViewItem.Filename; //Set Source Photo this.SourcePhoto.Source = FetchImage(photoListViewItem.Photo.SourceFilePath, 500); //Visualizations this.VisualizationComboBox.DataContext = photoListViewItem.Photo.VisualizationImages; this.VisualizationComboBox.SelectedIndex = 0; //TODO: Check if this causes a crash if it is run before the combo box is populated //Set Photo Details this.PhotoDetails.Children.Clear(); //double itemWidth = this.PhotoDetails.Width / 4; Thickness itemMargin = new Thickness(20, 0, 20, 0); foreach (PhotoDetail photoDetail in photoListViewItem.Photo.PhotoDetails) { if ((photoDetail.DisplayPreference == Constants.DisplayPreference.DETAIL_PAGE || photoDetail.DisplayPreference == Constants.DisplayPreference.RESULT_AND_DETAIL_PAGE) || (Properties.Settings.Default.DisplayPhotoMOS && photoDetail.ParameterName == "MOS")) { //Create Grid with Feature Name and Value TextBlock featureName = new TextBlock(); featureName.Style = this.Resources["ContentHeadingTextStyle"] as Style; //featureName.Margin. Left = 10; featureName.TextAlignment = TextAlignment.Left; featureName.Text = photoDetail.ParameterName; TextBlock featureValue = new TextBlock(); featureValue.Style = this.Resources["ContentTextStyle"] as Style; featureValue.TextAlignment = TextAlignment.Right; featureValue.Text = double.IsNaN(photoDetail.Value) ? photoDetail.ValueString : photoDetail.Value.ToString("0.00"); Grid grid = new Grid(); grid.Height = 30; grid.Width = 300; grid.Margin = itemMargin; grid.Children.Add(featureName); grid.Children.Add(featureValue); this.PhotoDetails.Children.Add(grid); } } }
public void MarkPhotoAsCompleted(CategoryListViewItem categoryListViewItem, int photoIndex) { //Create a new PhotoListView Item and replace the old one (Since updating newItem.Spinning isnt reflected in the ListView) PhotoListViewItem oldItem = categoryListViewItem.PhotoListViewItems.ElementAt(photoIndex); PhotoListViewItem newItem = new PhotoListViewItem(); newItem.Photo = oldItem.Photo; newItem.Filename = oldItem.Filename; newItem.Enabled = true; newItem.Thumbnail = oldItem.Thumbnail; newItem.Spinning = ProgressRing.OFF; categoryListViewItem.PhotoListViewItems[photoIndex] = newItem; PopulatePhotoDetails(newItem); }
private PhotoListViewItem CreatePhotoListViewItem(Photo photo, bool enabled) { PhotoListViewItem photoListViewItem = new PhotoListViewItem(); photoListViewItem.Photo = photo; photoListViewItem.Filename = photo.Filename; photoListViewItem.Thumbnail = FetchImage(photo.SourceFilePath, 100); photoListViewItem.Enabled = enabled; photoListViewItem.Spinning = ProgressRing.OFF; return photoListViewItem; }
public void MarkPhotoAsCompleted(CategoryListViewItem categoryListViewItem, int photoIndex) { //Create a new PhotoListView Item and replace the old one (Since updating newItem.Spinning isnt reflected in the ListView) PhotoListViewItem oldItem = categoryListViewItem.PhotoListViewItems.ElementAt(photoIndex); PhotoListViewItem newItem = new PhotoListViewItem(); newItem.Photo = oldItem.Photo; newItem.Filename = oldItem.Filename; newItem.Enabled = true; newItem.Thumbnail = oldItem.Thumbnail; newItem.Spinning = ProgressRing.OFF; categoryListViewItem.PhotoListViewItems[photoIndex] = newItem; PopulatePhotoDetails(newItem); /*if (ProgressBarControl.Visibility == Visibility.Visible) { ProgressBarControl.Value += 1; this.PhotoStatus.Text = Properties.Resources.ProcessingPhoto + " " +(int)(ProgressBarControl.Value + 1) + " " + Properties.Resources.Of + " " + (int)ProgressBarControl.Maximum; }*/ if(OverallProgressRing.Visibility == Visibility.Visible) { count++; this.PhotoStatus.Text = Properties.Resources.ProcessingPhoto + " " + (count+1) + " " + Properties.Resources.Of + " " + photoCount ; } }