Пример #1
0
 public TourSystem(ArtworkModeWindow artworkModeWindowParam)
 {
     artModeWin = artworkModeWindowParam;
     ///// Delete?
     tourAuthoringUI = new TourAuthoringUI(artModeWin, this);
     // event handlers for dragging of seek bar during tour playback
     artModeWin.tourSeekBarMarker.PreviewTouchDown += new EventHandler<TouchEventArgs>(TourSeekBarMarker_PreviewTouchDown);
     artModeWin.tourSeekBarMarker.PreviewMouseDown += new MouseButtonEventHandler(TourSeekBarMarker_PreviewMouseDown);
     artModeWin.tourSeekBarMarker.PreviewTouchMove += new EventHandler<TouchEventArgs>(TourSeekBarMarker_PreviewTouchMove);
     artModeWin.tourSeekBarMarker.PreviewMouseMove += new MouseEventHandler(TourSeekBarMarker_PreviewMouseMove);
     artModeWin.tourSeekBarMarker.PreviewTouchUp += new EventHandler<TouchEventArgs>(TourSeekBarMarker_PreviewTouchUp);
     artModeWin.tourSeekBarMarker.PreviewMouseUp += new MouseButtonEventHandler(TourSeekBarMarker_PreviewMouseUp);
     startDragPoint = new Point();
     loadTourButtons();
     tourPlaybackOn = false;
     tourAuthoringOn = false;
     mouseIsDown = false;
 }
 public metaDataEntry(ArtworkModeWindow artModeWin, String fileName, String filepath)
 {
     _artModeWin = artModeWin;
     String dataDir1 = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\";
     String dataDir = dataDir1 + "Images\\Metadata\\";
     _helpers = new Helpers();
     _fileName = fileName;
     if (_helpers.IsImageFile(filepath))
     {
         dataDir = dataDir1 + "Images\\Metadata\\";
     }
     else if (_helpers.IsVideoFile(filepath))
     {
         dataDir = dataDir1 + "Videos\\Metadata\\";
         int decrement = System.IO.Path.GetExtension(filepath).Length;
         filepath = filepath.Remove(filepath.Length - decrement, decrement);
         filepath += ".bmp";
     }
     _filePath = dataDir + filepath;
     InitializeComponent();
     this.Focusable = true;
 }
 //public TourSystem tourSystem { get; set;}
 //not edited for videos
 public metadata_lists(ArtworkModeWindow artModeWin, string filename)
 {
     _artModeWin = artModeWin;
     InitializeComponent();
     this.loadAssets(filename);
 }
Пример #4
0
 public void resetValues(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar)
 {
     mainScatterView = _mainScatterView;
     bar = _bar;
     win = _win;
     isDocked = false;
 }
Пример #5
0
        public AssociatedDocListBoxItem(String labeltext, String imageUri, String _scatteruri, ArtworkModeWindow lb, string description)
        {
            _helpers = new Helpers();
            _description = description;
            scatteruri = _scatteruri;
            _lb = lb;
            opened = false;
            dp = new DockPanel();
            this.Content = dp;
            //if image
            if (_helpers.IsImageFile(_scatteruri))
            {
                image = new Image();
                _helpers = new Helpers();

                FileStream stream = new FileStream(imageUri, FileMode.Open);

                System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
                System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
                stream.Close();

                wpfImage.SetCurrentValue(DockPanel.DockProperty, Dock.Left);

                wpfImage.SetCurrentValue(HeightProperty, 50.0);
                wpfImage.SetCurrentValue(WidthProperty, 50 * wpfImage.Source.Width / wpfImage.Source.Height);

                dp.Children.Add(wpfImage);

                label = new Label();
                label.Content = labeltext;
                label.FontSize = 18;
                label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
                dp.Children.Add(label);
                this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
                this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
                lb.getAssociatedDocToolBar().Items.Add(this);
            }

            //equivalent for videos
            else if (_helpers.IsVideoFile(_scatteruri))
            {
                if (_helpers.IsDirShowFile(_scatteruri)) //can easily create nice thumbnails of the video using DirectShow
                {
                    image = new Image();

                    imageUri = System.IO.Path.GetFullPath(imageUri);
                    int decrement = System.IO.Path.GetExtension(imageUri).Length;
                    imageUri = imageUri.Remove(imageUri.Length - decrement, decrement);
                    imageUri += ".bmp";
                    FileStream stream = new FileStream(imageUri, FileMode.Open);

                    System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
                    System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
                    stream.Close();

                    wpfImage.SetCurrentValue(DockPanel.DockProperty, Dock.Left);
                    wpfImage.SetCurrentValue(HeightProperty, 50.0);
                    wpfImage.SetCurrentValue(WidthProperty, 50 * wpfImage.Source.Width / wpfImage.Source.Height);

                    dp.Children.Add(wpfImage);

                    label = new Label();
                    label.Content = labeltext;
                    label.FontSize = 18;
                    label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
                    dp.Children.Add(label);
                    this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
                    this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
                    lb.getAssociatedDocToolBar().Items.Add(this);
                }
                //Code for not actually creating thumbnails of videos, but instead creating paused, unplayable media elements to act as thumbnails
                else
                {
                    MediaElement thumVid = new MediaElement();
                    thumVid.Source = new Uri(scatteruri, UriKind.RelativeOrAbsolute);

                    thumVid.LoadedBehavior = MediaState.Manual;
                    thumVid.ScrubbingEnabled = true;
                    thumVid.Play();
                    thumVid.Pause();

                    thumVid.Position = new TimeSpan(0, 0, 0, 0);
                    thumVid.SetCurrentValue(DockPanel.DockProperty, Dock.Left);
                    thumVid.SetCurrentValue(HeightProperty, 50.0);
                    thumVid.SetCurrentValue(WidthProperty, 50 * thumVid.Width / thumVid.Height);

                    dp.Children.Add(thumVid);

                    label = new Label();
                    label.Content = labeltext;
                    label.FontSize = 18;
                    label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
                    dp.Children.Add(label);
                    this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
                    this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
                    lb.getAssociatedDocToolBar().Items.Add(this);
                }
            }
        }
Пример #6
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;
        }
Пример #7
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;
        }
Пример #8
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();
        }
Пример #9
0
        double windowW = 0; // width of parent canvas/window

        #endregion Fields

        #region Constructors

        public TourAuthoringUI(ArtworkModeWindow artModeWinParam, TourSystem tourSystemParam)
        {
            artModeWin = artModeWinParam;
            tourSystem = tourSystemParam;
            canvasWrapper = artModeWin.tourAuthoringUICanvas;
            opacitySlider = new SurfaceSlider();

            w = artModeWin.Width;
            timelineHeight = 40; // 40 px is a good guideline to follow for touchability -- borrowed from Microsoft's touch guidelines

            windowW = w;
            centerX = w / 2;

            timelineLength = 0;
            timelineCount = 0;

            tourSeekBarTimerCount = new Label();
            tourSeekBarLength = new Label();
            backgroundMoved = false;
        }
Пример #10
0
        private void HandleImageTouched(object sender, EventArgs e)
        {
            if (!_artOpen)
            {
                artmode = new LADSArtworkMode.ArtworkModeWindow(currentImage.filename);
                artmode.Closed += new EventHandler(onArtmodeClose);
                _timer.Tick += new EventHandler(TimerTick_Handler);
                artmode.MultiImage.SetImageSource(@currentImage.xmlpath);
                artmode.MultiImageThumb.SetImageSource(@currentImage.xmlpath);
                artmode.Show();

                _artOpen = true;
                artmode.LayoutArtworkMode(currentImage.filename);

                if (SavedDockedItems != null)
                {
                    artmode.LoadDockedItems(SavedDockedItems);
                }
                else
                {
                }
                artmode.currentArtworkTitle = currentImage.title;
            }
            else
            {
                if (currentImage.filename != artmode.currentArtworkFileName)
                {
                    if (MessageBox.Show("Are you sure you want to switch artworks? You will lose what you have been working on.", "Switch", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        ArtworkModeWindow newWindow = new ArtworkModeWindow(currentImage.filename);
                        artmode.Close();
                        artmode = newWindow;
                        artmode.Closed += new EventHandler(onArtmodeClose);

                        _timer.Tick += new EventHandler(TimerTick_Handler);
                        artmode.MultiImage.SetImageSource(@currentImage.xmlpath);
                        artmode.MultiImageThumb.SetImageSource(@currentImage.xmlpath);
                        newWindow.Show();
                        _artOpen = true;
                        artmode.LayoutArtworkMode(currentImage.filename);
                        artmode.currentArtworkTitle = currentImage.title;

                        if (SavedDockedItems != null)
                        {
                            artmode.LoadDockedItems(SavedDockedItems);
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        artmode.Show();
                        return;
                    }
                }
                else
                {
                    artmode.Hide();
                    artmode.Show();
                    artmode.ShowActivated = true;
                }
            }
        }
 public void NewImageSelected_Handler(object sender, EventArgs e)
 {
     this.Show();
     string newImageFilename = sender as string;
     if (newImageFilename != currentArtworkFileName)
     {
         if (MessageBox.Show("Are you sure you want to switch artworks? You will lose what you have been working on.","Switch", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             ArtworkModeWindow newWindow = new ArtworkModeWindow(newImageFilename);
             newWindow.Show();
             this.Close();
         }
         else
         {
             return;
         }
     }
 }