コード例 #1
0
 public void LoadDockedItems(List<DockedItemInfo> SavedDockedItemsFromNav)
 {
     SavedDockedItems = SavedDockedItemsFromNav;
     Helpers _helpers=new Helpers();
     foreach (DockedItemInfo info in SavedDockedItemsFromNav)
     {
         //if it's an image, do this:
         if (_helpers.IsImageFile(info.scatteruri))
         {
             DockableItem item = new DockableItem(MainScatterView, this, Bar, info.scatteruri, null, info.description);
             item.AddtoDockFromSaved(info.savedOldWidth, info.savedOldHeight, info.savedWKEWidth, info);
         }
         else if (_helpers.IsVideoFile(info.scatteruri))
         {
             //perhaps the initializatoin of this bubble should have the height and width of the thumbnail... if I could extract one...
             DockableItem item = new DockableItem(MainScatterView, this, Bar, info.scatteruri, null, new LADSVideoBubble(info.scatteruri, 500, 500), new VideoItem(), info.description);
             item.AddtoDockFromSaved(info.savedOldWidth, info.savedOldHeight, info.savedWKEWidth, info);//video-specific constructor
         }
         else
         { //not image or video...
         }
     }
         //for all, do this:
 }
コード例 #2
0
 // Tour explore mode asset management for when an item is docked.
 public void tourExploreManageDock(DockableItem item)
 {
     if (tourSystem.IsExploreMode)
     {
         tourSystem.exploreAssetsInDock.Add(item.scatteruri, item);
         if (tourSystem.exploreAssetsOnCanvas.ContainsKey(item.scatteruri))
             tourSystem.exploreAssetsOnCanvas.Remove(item.scatteruri);
         if (tourSystem.exploreDisposableAssets.ContainsKey(item.scatteruri))
             tourSystem.exploreDisposableAssets.Remove(item.scatteruri);
     }
 }
コード例 #3
0
 // Tour explore mode asset management for when an item is undocked.
 public void tourExploreManageUndock(DockableItem item)
 {
     if (tourSystem.IsExploreMode)
     {
         tourSystem.exploreAssetsOnCanvas.Add(item.scatteruri, item);
         if (tourSystem.exploreAssetsInDock.ContainsKey(item.scatteruri)) // it should...
             tourSystem.exploreAssetsInDock.Remove(item.scatteruri);
     }
 }
コード例 #4
0
        public void LoadDictFromXML(String xmlFileName)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(xmlFileName);

            if (doc.HasChildNodes)
            {
                foreach (XmlNode tourNode in doc.ChildNodes)
                {
                    if (tourNode.Name == "TourStoryboard")
                    {
                        tourStoryboard = new TourStoryboard();
                        tourStoryboard.displayName = tourNode.Attributes.GetNamedItem("displayName").InnerText;
                        tourStoryboard.description = tourNode.Attributes.GetNamedItem("description").InnerText;
                        //// Time experiment
                        tourStoryboard.totalDuration = double.Parse(tourNode.Attributes.GetNamedItem("duration").InnerText);

                        dockableItemsLoaded = new List<DockableItem>();
                        msiItemsLoaded = new List<MultiScaleImage>();
                        tourBiDictionary = new BiDictionary<Timeline, BiDictionary<double, TourEvent>>();
                        undoStack = new Stack<BiDictionary<Timeline, BiDictionary<double, TourEvent>>>();
                        redoStack = new Stack<BiDictionary<Timeline, BiDictionary<double, TourEvent>>>();
                        itemToTLDict = new Dictionary<DockableItem, Timeline>();
                        msiToTLDict = new Dictionary<MultiScaleImage, Timeline>();

                        foreach (XmlNode TLNode in tourNode.ChildNodes)
                        {
                            if (TLNode.Name == "TourParallelTL")
                            {
                                if (TLNode.Attributes.GetNamedItem("type").InnerText == "artwork")
                                {
                                    String msi_file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    String msi_tour_path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Images\\DeepZoom\\" + msi_file + "\\dz.xml";
                                    artModeWin.msi_tour.SetImageSource(msi_tour_path);
                                    artModeWin.msi_tour_thumb.SetImageSource(msi_tour_path);

                                    msiItemsLoaded.Add(artModeWin.msi_tour);
                                    artModeWin.msi_tour.PreviewTouchDown += new EventHandler<TouchEventArgs>(msiTouchDown);
                                    artModeWin.msi_tour.PreviewMouseDown += new MouseButtonEventHandler(msiTouchDown);
                                    artModeWin.msi_tour.PreviewTouchMove += new EventHandler<TouchEventArgs>(msiTouchMoved);
                                    artModeWin.msi_tour.PreviewMouseMove += new MouseEventHandler(msiTouchMoved);
                                    artModeWin.msi_tour.PreviewTouchUp += new EventHandler<TouchEventArgs>(msiTouchUp);
                                    artModeWin.msi_tour.PreviewMouseUp += new MouseButtonEventHandler(msiTouchUp);
                                    artModeWin.msi_tour.PreviewMouseWheel += new MouseWheelEventHandler(msiMouseWheel);
                                    artModeWin.msi_tour.disableInertia();
                                    TourParallelTL msi_tour_TL = new TourParallelTL();

                                    msiToTLDict.Add(artModeWin.msi_tour, msi_tour_TL);

                                    msi_tour_TL.type = TourTLType.artwork;
                                    msi_tour_TL.displayName = TLNode.Attributes.GetNamedItem("displayName").InnerText;
                                    msi_tour_TL.file = TLNode.Attributes.GetNamedItem("file").InnerText;

                                    BiDictionary<double, TourEvent> msi_tour_TL_dict = new BiDictionary<double, TourEvent>();
                                    tourBiDictionary.Add(msi_tour_TL, msi_tour_TL_dict);

                                    foreach (XmlNode TourEventNode in TLNode.ChildNodes)
                                    {
                                        if (TourEventNode.Name == "TourEvent")
                                        {
                                            if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "ZoomMSIEvent")
                                            {
                                                double scale = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("scale").InnerText);
                                                double toMSIPointX = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toMSIPointX").InnerText);
                                                double toMSIPointY = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toMSIPointY").InnerText);
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);
                                                TourEvent zoomMSIEvent = new ZoomMSIEvent(artModeWin.msi_tour, scale, toMSIPointX, toMSIPointY, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                msi_tour_TL_dict.Add(beginTime, zoomMSIEvent);
                                            }
                                        }
                                    }
                                }

                                else if (TLNode.Attributes.GetNamedItem("type").InnerText == "media")
                                {
                                    String media_file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    DockableItem dockItem = new DockableItem(artModeWin.MSIScatterView, artModeWin, artModeWin.Bar, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Images\\Metadata\\" + media_file);

                                    dockItem.PreviewMouseMove += new MouseEventHandler(mediaTouchDown);
                                    dockItem.PreviewTouchDown += new EventHandler<TouchEventArgs>(mediaTouchDown);
                                    dockItem.PreviewMouseDown += new MouseButtonEventHandler(mediaTouchDown);
                                    dockItem.PreviewTouchMove += new EventHandler<TouchEventArgs>(mediaTouchMoved);
                                    dockItem.PreviewMouseMove += new MouseEventHandler(mediaTouchMoved);
                                    dockItem.PreviewTouchUp += new EventHandler<TouchEventArgs>(mediaTouchUp);
                                    dockItem.PreviewMouseUp += new MouseButtonEventHandler(mediaTouchUp);

                                    dockableItemsLoaded.Add(dockItem);
                                    dockItem.Visibility = Visibility.Hidden;

                                    TourParallelTL dockItem_TL = new TourParallelTL();
                                    dockItem_TL.type = TourTLType.media;

                                    dockItem_TL.displayName = TLNode.Attributes.GetNamedItem("displayName").InnerText;
                                    dockItem_TL.file = TLNode.Attributes.GetNamedItem("file").InnerText;

                                    itemToTLDict.Add(dockItem, dockItem_TL);

                                    BiDictionary<double, TourEvent> dockItem_TL_dict = new BiDictionary<double, TourEvent>();
                                    tourBiDictionary.Add(dockItem_TL, dockItem_TL_dict);

                                    foreach (XmlNode TourEventNode in TLNode.ChildNodes)
                                    {
                                        if (TourEventNode.Name == "TourEvent")
                                        {
                                            if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeInMediaEvent")
                                            {
                                                double toScreenPointX = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toScreenPointX").InnerText);
                                                double toScreenPointY = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toScreenPointY").InnerText);
                                                double scale = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("scale").InnerText);
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeInMediaEvent = new FadeInMediaEvent(dockItem, toScreenPointX, toScreenPointY, scale, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                dockItem_TL_dict.Add(beginTime, fadeInMediaEvent);
                                            }

                                            else if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "ZoomMediaEvent")
                                            {
                                                double scale = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("scale").InnerText);
                                                double toScreenPointX = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toScreenPointX").InnerText);
                                                double toScreenPointY = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("toScreenPointY").InnerText);
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent zoomMediaEvent = new ZoomMediaEvent(dockItem, scale, toScreenPointX, toScreenPointY, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                dockItem_TL_dict.Add(beginTime, zoomMediaEvent);
                                            }

                                            else if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeOutMediaEvent")
                                            {
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeOutMediaEvent = new FadeOutMediaEvent(dockItem, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                dockItem_TL_dict.Add(beginTime, fadeOutMediaEvent);
                                            }
                                        }
                                    }
                                }

                                else if (TLNode.Attributes.GetNamedItem("type").InnerText == "highlight")
                                {
                                    String media_file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    SurfaceInkCanvas sic = new SurfaceInkCanvas();
                                    inkCanvases.Add(sic);
                                    sic.Width = 1920;
                                    sic.Height = 1080;
                                    sic.DefaultDrawingAttributes.Width = 50;
                                    sic.DefaultDrawingAttributes.Height = 50;
                                    sic.UsesTouchShape = false;
                                    sic.Background = Brushes.Transparent;
                                    sic.Opacity = 0.7;
                                    sic.Visibility = Visibility.Visible;
                                    Canvas.SetZIndex(sic, 50);
                                    loadInkCanvas(sic, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + media_file);
                                    artModeWin.ImageArea.Children.Add(sic);

                                    TourParallelTL tourtl = new TourParallelTL();
                                    tourtl.type = TourTLType.highlight;
                                    tourtl.inkCanvas = sic;
                                    tourtl.displayName = TLNode.Attributes.GetNamedItem("displayName").InnerText;
                                    tourtl.file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    BiDictionary<double, TourEvent> tldict = new BiDictionary<double, TourEvent>();
                                    tourBiDictionary.Add(tourtl, tldict);

                                    foreach (XmlNode TourEventNode in TLNode.ChildNodes)
                                    {
                                        if (TourEventNode.Name == "TourEvent")
                                        {
                                            if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeInHighlightEvent")
                                            {
                                                double opacity = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("opacity").InnerText);
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeInHighlightEvent = new FadeInHighlightEvent(sic, duration, opacity);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                tldict.Add(beginTime, fadeInHighlightEvent);
                                            }

                                            else if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeOutHighlightEvent")
                                            {
                                                double opacity = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("opacity").InnerText);
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeOutHighlightEvent = new FadeOutHighlightEvent(sic, duration, opacity);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                tldict.Add(beginTime, fadeOutHighlightEvent);
                                            }
                                        }
                                    }
                                }

                                else if (TLNode.Attributes.GetNamedItem("type").InnerText == "path")
                                {
                                    String media_file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    SurfaceInkCanvas sic = new SurfaceInkCanvas();
                                    inkCanvases.Add(sic);
                                    sic.Width = 1920;
                                    sic.Height = 1080;
                                    sic.UsesTouchShape = true;
                                    sic.DefaultDrawingAttributes.FitToCurve = true;
                                    sic.Background = Brushes.Transparent;
                                    sic.Opacity = 0;
                                    sic.Visibility = Visibility.Visible;
                                    Canvas.SetZIndex(sic, 50);
                                    loadInkCanvas(sic, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + media_file);
                                    artModeWin.ImageArea.Children.Add(sic);

                                    TourParallelTL tourtl = new TourParallelTL();
                                    tourtl.type = TourTLType.path;
                                    tourtl.inkCanvas = sic;
                                    tourtl.displayName = TLNode.Attributes.GetNamedItem("displayName").InnerText;
                                    tourtl.file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                    BiDictionary<double, TourEvent> tldict = new BiDictionary<double, TourEvent>();
                                    tourBiDictionary.Add(tourtl, tldict);

                                    foreach (XmlNode TourEventNode in TLNode.ChildNodes)
                                    {
                                        if (TourEventNode.Name == "TourEvent")
                                        {
                                            if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeInPathEvent")
                                            {
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeInPathEvent = new FadeInPathEvent(sic, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                tldict.Add(beginTime, fadeInPathEvent);
                                            }

                                            else if (TourEventNode.Attributes.GetNamedItem("type").InnerText == "FadeOutPathEvent")
                                            {
                                                double duration = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("duration").InnerText);

                                                TourEvent fadeOutPathEvent = new FadeOutPathEvent(sic, duration);

                                                double beginTime = Convert.ToDouble(TourEventNode.Attributes.GetNamedItem("beginTime").InnerText);
                                                tldict.Add(beginTime, fadeOutPathEvent);
                                            }
                                        }
                                    }
                                }
                            }
                            else if (TLNode.Name == "TourMediaTL")
                            {
                                String audio_file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                TourMediaTL tourAudio_TL = new TourMediaTL(new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Tour\\Audio\\" + audio_file, UriKind.Absolute));
                                tourAudio_TL.type = TourTLType.audio;
                                tourAudio_TL.displayName = TLNode.Attributes.GetNamedItem("displayName").InnerText;
                                tourAudio_TL.file = TLNode.Attributes.GetNamedItem("file").InnerText;
                                if (TLNode.Attributes.GetNamedItem("beginTime") != null)
                                    tourAudio_TL.BeginTime = TimeSpan.FromSeconds(Convert.ToDouble(TLNode.Attributes.GetNamedItem("beginTime").InnerText));

                                if (TLNode.Attributes.GetNamedItem("duration") != null)
                                    tourAudio_TL.Duration = TimeSpan.FromSeconds(Convert.ToDouble(TLNode.Attributes.GetNamedItem("duration").InnerText));
                                else
                                {
                                    TagLib.File audio_file_tags = TagLib.File.Create(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Tour\\Audio\\" + audio_file);
                                    tourAudio_TL.Duration = audio_file_tags.Properties.Duration;
                                }

                                BiDictionary<double, TourEvent> tourAudio_TL_dict = new BiDictionary<double, TourEvent>(); // dummy TL_dict -- tourAudio_timeline obviously doesn't store any TourEvents
                                tourBiDictionary.Add(tourAudio_TL, tourAudio_TL_dict);

                                tourAudio_element = new MediaElement();
                                tourAudio_element.Volume = 0.99;

                                tourAudio_element.LoadedBehavior = MediaState.Manual;
                                tourAudio_element.UnloadedBehavior = MediaState.Manual;

                                Storyboard.SetTarget(tourAudio_TL, tourAudio_element);
                                tourStoryboard.SlipBehavior = SlipBehavior.Slip;

                                // took me quite a while to figure out that WPF really can't determine the duration of an MP3 until it's actually loaded (i.e. playing), and then it took me a little longer to finally find and accept this open-source library...argh

                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        // 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;
        }
コード例 #6
0
        public void AddNewMetaDataTimeline(String imageFilePath, String fileName)
        {
            DockableItem dockItem = new DockableItem(artModeWin.MSIScatterView, artModeWin, artModeWin.Bar, imageFilePath);

            dockItem.PreviewMouseWheel += new MouseWheelEventHandler(mediaMouseWheel);
            dockItem.removeDockability();
            dockItem.PreviewMouseMove += new MouseEventHandler(mediaTouchDown);
            dockItem.PreviewTouchDown += new EventHandler<TouchEventArgs>(mediaTouchDown);
            dockItem.PreviewMouseDown += new MouseButtonEventHandler(mediaTouchDown);
            dockItem.PreviewTouchMove += new EventHandler<TouchEventArgs>(mediaTouchMoved);
            dockItem.PreviewMouseMove += new MouseEventHandler(mediaTouchMoved);
            dockItem.PreviewTouchUp += new EventHandler<TouchEventArgs>(mediaTouchUp);
            dockItem.PreviewMouseUp += new MouseButtonEventHandler(mediaTouchUp);

            dockableItemsLoaded.Add(dockItem);
            dockItem.Visibility = Visibility.Hidden;

            TourParallelTL dockItem_TL = new TourParallelTL();
            dockItem_TL.type = TourTLType.media;

            dockItem_TL.displayName = fileName;
            dockItem_TL.file = System.IO.Path.GetFileName(imageFilePath);

            itemToTLDict.Add(dockItem, dockItem_TL);

            BiDictionary<double, TourEvent> dockItem_TL_dict = new BiDictionary<double, TourEvent>();

            tourBiDictionary.Add(dockItem_TL, dockItem_TL_dict);

            // Add fade in
            double toScreenPointX = 500;
            double toScreenPointY = 500;
            double scale = 1.0;
            double FadeInduration = 1.0;

            TourEvent fadeInMediaEvent = new FadeInMediaEvent(dockItem, toScreenPointX, toScreenPointY, scale, FadeInduration);

            double FadeInbeginTime = authorTimerCountSpan.TotalSeconds - 1;
            if (FadeInbeginTime < 0) FadeInbeginTime = 0;
            if (authorTimerCountSpan.TotalSeconds == 0) FadeInbeginTime += 1;
            authorTimerCountSpan = TimeSpan.FromSeconds(FadeInbeginTime+1);
            dockItem_TL_dict.Add(FadeInbeginTime, fadeInMediaEvent);

            // Add fade out
            double FadeOutduration = 1.0;

            TourEvent fadeOutMediaEvent = new FadeOutMediaEvent(dockItem, FadeOutduration);

            double FadeOutbeginTime = FadeInbeginTime + 2;
            dockItem_TL_dict.Add(FadeOutbeginTime, fadeOutMediaEvent);

            TourAuthoringUI.timelineInfo tli = tourAuthoringUI.addTimeline(dockItem_TL, dockItem_TL_dict, fileName, tourAuthoringUI.getNextPos());
            tourAuthoringUI.addTourEvent(tli, fadeInMediaEvent, tli.lengthSV, FadeInbeginTime, FadeInduration);
            tourAuthoringUI.addTourEvent(tli, fadeOutMediaEvent, tli.lengthSV, FadeOutbeginTime, FadeOutduration);
            tourAuthoringUI.timelineCount += 1;
            tourAuthoringUI.updateTLSize();

            StopAndReloadTourAuthoringUIFromDict(authorTimerCountSpan.TotalSeconds);

            tourAuthoringUI.refreshUI();
        }
コード例 #7
0
        // Create the Dictionaries that we use for managing assets in explore mode.
        private void initializeExploreAssets()
        {
            this.exploreAssetsOnCanvas = new Dictionary<String, DockableItem>();
            this.exploreAssetsInDock = new Dictionary<String, DockableItem>();
            this.exploreDisposableAssets = new Dictionary<String, DockableItem>();
            // Fill exploreAssetsInDock with the assets in the dock.
            foreach (WorkspaceElement item in artModeWin.Bar.Items)
            {
                exploreAssetsInDock.Add(item.item.scatteruri, item.item);
            }
            // Fill exploreAssetsOnCanvas with the assets on the canvas.
            foreach (ScatterViewItem item in artModeWin.MainScatterView.Items)
            {
                if (item is DockableItem)
                {
                    if (!exploreAssetsInDock.ContainsKey((item as DockableItem).scatteruri))
                        exploreAssetsOnCanvas.Add((item as DockableItem).scatteruri, (item as DockableItem));
                }
            }
            // For each asset to be explored:
            foreach (DockableItem item in dockableItemsLoaded)
            {
                // If it isn't actually visible, skip.
                if (item.Visibility != Visibility.Visible || item.Opacity == 0) continue;
                // if in exploreAssetsOnCanvas, position to tour asset's position.
                if (exploreAssetsOnCanvas.ContainsKey(item.scatteruri))
                {
                    alignAssets(exploreAssetsOnCanvas[item.scatteruri], item);
                }
                else if (exploreAssetsInDock.ContainsKey(item.scatteruri))
                {
                    // if in exploreAssetsInDock, undock and move to position.
                    DockableItem asset = exploreAssetsInDock[item.scatteruri];
                    alignAssets(asset.wke.quickReleaseItem(), item);
                    // Also, remove from exploreAssetsInDock and put in exploreAssetsOnCanvas
                    exploreAssetsOnCanvas.Add(asset.scatteruri, asset);
                    exploreAssetsInDock.Remove(asset.scatteruri);
                }
                else
                {// Otherwise, make a new one, add to disposable, and position it.
                    Helpers _helpers = new Helpers();  // Are you freaking kidding me, why isn't everything in this class just static?
                    // Make the DockableItem the normal way:
                    if (_helpers.IsImageFile(item.scatteruri))
                    {
                        DockableItem asset = new DockableItem(artModeWin.getMainScatterView(), artModeWin, artModeWin.getBar(), item.scatteruri);
                        artModeWin._openedAssets.Add(item.scatteruri, asset);
                        alignAssets(asset, item);
                        exploreDisposableAssets.Add(asset.scatteruri, asset);
                    }
                    else if (_helpers.IsVideoFile(item.scatteruri))
                    {
                        // TODO: Video assets?
                        /*artModeWin._openedAssets.Add(item.scatteruri, new DockableItem(artModeWin.getMainScatterView(), artModeWin, artModeWin.getBar(), item.scatteruri, this, new LADSVideoBubble(item.scatteruri, 500, 500), new VideoItem()));*/
                        //video-specific constructor
                    }
                }

            }
        }
コード例 #8
0
 // Given two (presumably identical) assets, scale, rotate, and translate one (first) so that it is
 // in the same position as the other (second).
 private void alignAssets(DockableItem to_position, DockableItem in_position)
 {
     to_position.Height = in_position.Height;
     to_position.Width = in_position.Width;
     to_position.Center = in_position.Center;
     to_position.Orientation = in_position.Orientation;
 }
コード例 #9
0
 /// <summary>
 /// Add new zoom tour event
 /// </summary>
 /// <param name="duration"></param>
 /// <param name="media"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="scale"></param>
 private void addZoomTourEvent(DockableItem media, double scale, double x, double y, double start, double duration)
 {
     ZoomMediaEvent toAdd = new ZoomMediaEvent(media, scale, x, y, duration);
     Timeline tl;
     if (itemToTLDict.TryGetValue(media, out tl))
     {
         BiDictionary<double, TourEvent> itemDict;
         IList<BiDictionary<double, TourEvent>> itemDictList;
         if (tourBiDictionary.TryGetValue(tl, out itemDictList))
         {
             itemDict = itemDictList[0];
             itemDict.Add(start, toAdd);
         }
     }
 }
コード例 #10
0
 public void registerDockableItem(DockableItem d, Timeline t)
 {
     if (!itemToTLDict.ContainsKey(d))
         itemToTLDict.Add(d, t);
 }