Example #1
0
        public static void CreateSlideList(StackPanel sSlideList, string strFolderPath, ZYPSlice zypSlide, CancellationTokenSource ctsSource, ResourceDictionary rdDirectory, string strCurrentSlidePath)
        {
            ArrayList slideFileList = GetSlideFileList(strFolderPath, ".zyp");

            if (slideFileList.Count != 0)
            {
                foreach (string item in slideFileList)
                {
                    SlideListItem slideListItem = new SlideListItem();
                    slideListItem.strFileName = item;
                    MemoryStream thumbnail = zypSlide.GetThumbnail(item);
                    MemoryStream label     = zypSlide.GetLabel(item);
                    if (thumbnail != null && label != null)
                    {
                        ImageSourceConverter imageSourceConverter = new ImageSourceConverter();
                        slideListItem.imgSourceThumbnail = (ImageSource)imageSourceConverter.ConvertFrom(thumbnail);
                        slideListItem.imgSourceLabel     = (ImageSource)imageSourceConverter.ConvertFrom(label);
                        if (slideListItem != null)
                        {
                            int    count  = sSlideList.Children.Count;
                            Border border = new Border();
                            border.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideListItemBorder"]);
                            border.DataContext = slideListItem.strFileName;
                            Canvas canvas  = new Canvas();
                            Border border2 = new Border();
                            border2.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideListItemThumbnailBorder"]);
                            border2.RenderTransform = new RotateTransform(-90.0);
                            Image image = new Image();
                            image.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideListItemThumbnail"]);
                            image.Source = slideListItem.imgSourceThumbnail;
                            RotateTransform rotateTransform = new RotateTransform();
                            rotateTransform.Angle   = 180.0;
                            rotateTransform.CenterX = 47.5;
                            rotateTransform.CenterY = 100.0;
                            image.RenderTransform   = rotateTransform;
                            border2.Child           = image;
                            Image image2 = new Image();
                            image2.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideListItemLabel"]);
                            image2.Source = slideListItem.imgSourceLabel;
                            Label label2 = new Label();
                            label2.SetValue(FrameworkElement.StyleProperty, rdDirectory["SlideListItemSlideName"]);
                            label2.Content = Path.GetFileNameWithoutExtension(slideListItem.strFileName);
                            if (strCurrentSlidePath == slideListItem.strFileName)
                            {
                                border.BorderBrush = new SolidColorBrush(Color.FromRgb(57, 176, 181));
                                int num = (count - 1) * 130 + count * 10;
                                (sSlideList.Parent as ScrollViewer).ScrollToVerticalOffset(num - 10);
                            }
                            else
                            {
                                border.BorderBrush = Brushes.Gray;
                            }
                            canvas.Children.Add(border2);
                            canvas.Children.Add(image2);
                            canvas.Children.Add(label2);
                            border.Child = canvas;
                            if (ctsSource.IsCancellationRequested)
                            {
                                break;
                            }
                            sSlideList.Children.Add(border);
                        }
                    }
                }
            }
        }
Example #2
0
 public static void UpdateSlideLabel(string strSlidePath, Image imgLabel, Canvas cLabelTool, ZYPSlice zypSlide)
 {
     if (strSlidePath != null)
     {
         cLabelTool.Visibility = Visibility.Visible;
         imgLabel.Source       = (ImageSource) new ImageSourceConverter().ConvertFrom(zypSlide.GetLabel(strSlidePath));
     }
     else
     {
         imgLabel.Source       = null;
         cLabelTool.Visibility = Visibility.Collapsed;
     }
 }