private void OnDisplayImage(MovieContents myMovieContents, MovieGroup myTargetGroup) { // パラメータがnullの場合は画像表示を全てクリア if (myMovieContents == null) { imagePackage.Source = null; return; } if (image == null) image = new common.Image(myMovieContents, myTargetGroup); // PackageImage // Visibleの場合のみ表示 FileInfo fileInfoPackage = image.GetDefaultPackageFileInfo(); if (fileInfoPackage != null && fileInfoPackage.Exists) { string path = myMovieContents.GetExistPath(myTargetGroup); if (path != null) { txtStatusBar.Text = myMovieContents.ExistMovie[0]; txtStatusBarFileLength.Text = CommonMethod.GetDisplaySize(myMovieContents.Size); imagePackage.Source = ImageMethod.GetImageStream(fileInfoPackage.FullName); } } else { imagePackage.Source = null; } // ImageContents // Visibleの場合のみ表示 // Kind == 1 ( File ) // isThumbnail // true サムネイル画像を表示 // false Dirがあれば、Dir内の画像、無い場合はパッケージを表示、ImagePackageを非表示 // Kind == 2 ( Site ) if (image.IsThumbnail()) { List<FileInfo> listFileInfo = image.listImageFileInfo; if (listFileInfo != null && listFileInfo.Count >= 1) { imageSitesImageOne.Source = ImageMethod.GetImageStream(listFileInfo[0].FullName); imageSitesImageOne.ToolTip = listFileInfo[0].Name; imageSitesImageTwo.Visibility = Visibility.Collapsed; imageSitesImageThree.Visibility = Visibility.Collapsed; imageSitesImageFour.Visibility = Visibility.Collapsed; imageSitesImageOne.SetValue(Grid.RowSpanProperty, 2); imageSitesImageOne.SetValue(Grid.ColumnSpanProperty, 2); BitmapImage bitmapImage = (BitmapImage)imageSitesImageOne.Source; imageSitesImageOne.Width = lgridMain.ColumnDefinitions[MAIN_COLUMN_NO_CONTENTS].ActualWidth; imageSitesImageOne.Height = (imageSitesImageOne.Width / bitmapImage.Width) * bitmapImage.Height; imageSitesImageOne.Stretch = Stretch.Uniform; } } else { List<FileInfo> listFileInfo = image.listImageFileInfo; txtbImageInfo.Text = image.DisplayPage; txtStatusBar.Text = Path.Combine(myMovieContents.Label, myMovieContents.Name); txtStatusBarFileLength.Text = CommonMethod.GetDisplaySize(myMovieContents.Size); if (listFileInfo.Count > 1) { imageSitesImageOne.SetValue(Grid.RowSpanProperty, 1); imageSitesImageOne.SetValue(Grid.ColumnSpanProperty, 1); imageSitesImageOne.Width = imageSitesImageTwo.Width; imageSitesImageOne.Height = imageSitesImageTwo.Height; if (listFileInfo.Count >= 1) { imageSitesImageOne.Source = ImageMethod.GetImageStream(listFileInfo[0].FullName); imageSitesImageOne.ToolTip = listFileInfo[0].Name; imageSitesImageOne.Visibility = Visibility.Visible; } if (listFileInfo.Count >= 2) { imageSitesImageTwo.Source = ImageMethod.GetImageStream(listFileInfo[1].FullName); imageSitesImageTwo.ToolTip = listFileInfo[1].Name; imageSitesImageTwo.Visibility = Visibility.Visible; } else imageSitesImageTwo.Visibility = Visibility.Collapsed; if (listFileInfo.Count >= 3) { imageSitesImageThree.Source = ImageMethod.GetImageStream(listFileInfo[2].FullName); imageSitesImageThree.ToolTip = listFileInfo[2].Name; imageSitesImageThree.Visibility = Visibility.Visible; } else imageSitesImageThree.Visibility = Visibility.Collapsed; if (listFileInfo.Count >= 4) { imageSitesImageFour.Source = ImageMethod.GetImageStream(listFileInfo[3].FullName); imageSitesImageFour.ToolTip = listFileInfo[3].Name; imageSitesImageFour.Visibility = Visibility.Visible; } else imageSitesImageFour.Visibility = Visibility.Collapsed; } else { if (listFileInfo.Count >= 1) { imageSitesImageOne.Source = ImageMethod.GetImageStream(listFileInfo[0].FullName); imageSitesImageOne.ToolTip = listFileInfo[0].Name; imageSitesImageOne.Visibility = Visibility.Visible; } else imageSitesImageOne.Source = null; imageSitesImageTwo.Visibility = Visibility.Collapsed; imageSitesImageThree.Visibility = Visibility.Collapsed; imageSitesImageFour.Visibility = Visibility.Collapsed; imageSitesImageOne.SetValue(Grid.RowSpanProperty, 2); imageSitesImageOne.SetValue(Grid.ColumnSpanProperty, 2); } } }
private void dgridMovieContents_SelectionChanged(object sender, SelectionChangedEventArgs e) { dispinfoSelectContents = (MovieContents)dgridMovieContents.SelectedItem; image = null; if (dispinfoSelectContents != null) { txtLargeComment.Text = dispinfoSelectContents.Comment; cmbLargeRating.SelectedValue = dispinfoSelectContents.Rating; } else return; dispinfoTargetGroupBySelectContents = ColViewMovieGroup.GetMatchDataByContents(dispinfoSelectContents); if (dispinfoTargetGroupBySelectContents == null) txtStatusBar.Text = "" + dispinfoSelectContents.Label + "に一致するグループが存在しませんでした"; OnDisplayImage(dispinfoSelectContents, dispinfoTargetGroupBySelectContents); if (dispinfoContentsVisibleKind == CONTENTS_VISIBLE_KIND_DETAIL) { if (dispinfoSelectContents == null) return; if (dispinfoSelectContents.Kind == MovieContents.KIND_FILE || dispinfoSelectContents.Kind == MovieContents.KIND_CONTENTS) { lgridSiteDetail.Visibility = Visibility.Collapsed; lgridFileDetail.Visibility = Visibility.Visible; ColViewFileDetail = new detail.FileDetail(dispinfoSelectContents, dispinfoTargetGroupBySelectContents); dgridFileDetail.ItemsSource = ColViewFileDetail.listFileInfo; OnRefreshFileDetailInfo(null, null); return; } lgridSiteDetail.Visibility = Visibility.Visible; lgridFileDetail.Visibility = Visibility.Collapsed; txtSiteDetailContentsName.Text = dispinfoSelectContents.Name; txtSiteDetailContentsTag.Text = dispinfoSelectContents.Tag; string path = dispinfoSelectContents.GetExistPath(dispinfoTargetGroupBySelectContents); txtSiteDetailContentsPath.Text = path; txtSiteDetailContentsComment.Text = dispinfoSelectContents.Comment; if (path != null) { ScreenDisableBorderSiteDetail.Width = 0; ScreenDisableBorderSiteDetail.Height = 0; ScreenDisableBorderImageContents.Width = 0; ScreenDisableBorderImageContents.Height = 0; txtSiteDetailContentsPath.Text = path; txtSiteDetailContentsComment.Text = dispinfoSelectContents.Comment; ColViewSiteDetail = new SiteDetail(txtSiteDetailContentsPath.Text); dgridSiteDetail.ItemsSource = ColViewSiteDetail.listFileInfo; btnSiteDetailImage.Content = "Image (" + ColViewSiteDetail.ImageCount + ")"; btnSiteDetailMovie.Content = "Movie (" + ColViewSiteDetail.MovieCount + ")"; btnSiteDetailList.Content = "List (" + ColViewSiteDetail.ListCount + ")"; imageSiteDetail.Source = ImageMethod.GetImageStream(ColViewSiteDetail.StartImagePathname); } // 存在しないpathの場合 else { ScreenDisableBorderSiteDetail.Width = Double.NaN; ScreenDisableBorderSiteDetail.Height = Double.NaN; ScreenDisableBorderImageContents.Width = Double.NaN; ScreenDisableBorderImageContents.Height = Double.NaN; dgridSiteDetail.ItemsSource = null; imageSiteDetail.Source = null; } } }