示例#1
0
 public void anim3Completed(object sender, EventArgs e)
 {
     aldbi = null;
     mainScatterView.Items.Remove(this);
     if (info != null && win.SavedDockedItems.Contains(info))
     win.SavedDockedItems.Remove(info);
 }
示例#2
0
        //constructor for VIDEOS
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, string _targetVid, AssociatedDocListBoxItem _aldbi, LADSVideoBubble _video, VideoItem _vidctrl, String description)
        {
            isVideo = true;
            scatteruri = _targetVid;
            vidBub = _video;
            _helpers = new Helpers();
            _description = description;
            image = new Image();
            aldbi = null;
            String thumbFileName = _targetVid;

            //the video thumbnail filename is the same name with a different extension. This gets that extension
            int decrement = System.IO.Path.GetExtension(thumbFileName).Length;
            thumbFileName = thumbFileName.Remove(thumbFileName.Length - decrement, decrement);
            thumbFileName += ".bmp";
            thumbFileName = System.IO.Path.GetFileName(thumbFileName);
            thumbFileName = "Data\\Videos\\Metadata\\" + thumbFileName;

            //opens in filestream to prevent errors from the file already being open
            FileStream stream = new FileStream(thumbFileName, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(vidBub);
            this.UpdateLayout();
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);
            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            mainScatterView.Items.Add(this);

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + vidBub.ActualWidth * 3), (int)(win.ActualWidth - vidBub.ActualWidth * 3 - 100)),
                                                           rnd.Next((int)(vidBub.ActualHeight * 3), (int)(win.ActualHeight * .8 - vidBub.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            imageURIPath = _targetVid;
            MediaElement vid = vidBub.getVideo();
            vid.MediaOpened += new RoutedEventHandler(video_MediaOpened);
            vid.Loaded += new RoutedEventHandler(video_MediaOpened);
            this.MinHeight = 100;
        }
示例#3
0
        /// <summary>
        /// used by artwork mode, including the tour authoring & playback system
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();

            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(image);
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();

            this.Background = new SolidColorBrush(Colors.Transparent);
            RoutedEventHandler loadedEventHandler = null;
            loadedEventHandler = new RoutedEventHandler(delegate
            {
                this.Loaded -= loadedEventHandler;
                try
                {
                    Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
                    ssc = this.Template.FindName("shadow", this) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
                    ssc.Visibility = Visibility.Hidden;
                }
                catch (Exception exc) { }

            });
            this.Loaded += loadedEventHandler;

            imageURIPath = imageURIPathParam;

            stream.Close();
        }
示例#4
0
        /// <summary>
        /// used by artwork mode
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam, AssociatedDocListBoxItem _aldbi, String description)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();
            _description = description;
            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            //this.Background = Brushes.LightGray;
            //this.Background.Opacity = 0.0;

            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            if (_description == "")
                _description = "Description not found.";

                descriptionBox = new ScatterViewItem(); ///////
                descriptionLabel = new Label();
                descriptionBox.CanRotate = false;
                descriptionBox.CanScale = false;
                descriptionBox.CanMove = false;
                descriptionLabel.Opacity = .85;
                descriptionLabel.BorderBrush = Brushes.Black;
                descriptionLabel.BorderThickness = new Thickness(2.0);
                if (aldbi != null)
                {
                    descriptionLabel.Content = aldbi.getLabel();
                }
                descriptionLabel.Content += "\nMedia Description (tap media item to reread):\n\n" + _description;
                descriptionLabel.Background = Brushes.Khaki;
                descriptionLabel.Foreground = Brushes.Black;
                descriptionBox.Content = descriptionLabel;

                mainScatterView.Items.Add(descriptionBox);

                descriptionBox.Visibility = Visibility.Collapsed;

            this.AddChild(image);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + image.ActualWidth * 3), (int)(win.ActualWidth - image.ActualWidth * 3 - 100)),
                                                          rnd.Next((int)(image.ActualHeight * 3), (int)(win.ActualHeight * .8 - image.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            imageURIPath = imageURIPathParam;
        }
        // Tour explore mode asset management for when an item should be added.
        // Takes the uri string for the potential item.
        // If it should be added, does asset management and returns a new DockableItem. It it shouldn't, just returns null.
        // Note that this method actually creates a new DockableItem, which is otherwise only done in AssociatedDocListBoxItem.onTouch.
        public DockableItem tourExploreManageAdd(String scatteruri, AssociatedDocListBoxItem adlbi)
        {
            Helpers _helpers = new Helpers();  // Stupid.
            if (tourSystem.IsExploreMode)
            {
                if (!tourSystem.exploreAssetsOnCanvas.ContainsKey(scatteruri) &&
                    !tourSystem.exploreAssetsInDock.ContainsKey(scatteruri) &&
                    !tourSystem.exploreDisposableAssets.ContainsKey(scatteruri))
                {
                    // Make the Dockable item (currently only images supported)
                    if (_helpers.IsImageFile(scatteruri))
                    {
                        DockableItem asset = new DockableItem(getMainScatterView(), this, getBar(), scatteruri, adlbi, null);
                        _openedAssets.Add(scatteruri, asset);
                        tourSystem.exploreAssetsOnCanvas.Add(scatteruri, asset);
                        return asset;
                    }

                }
            }
            return null;
        }