コード例 #1
0
        public void addTourEvent(timelineInfo timelineInfoStruct, TourEvent tourEvent, ScatterView timelineSV, double beginTime, double duration)
        {
            ScatterViewItem currentSVI = new ScatterViewItem();
            currentSVI.MinWidth = 10; // don't want it to disappear, but still need it to be touchable (even if resolution is as low as 1024 x 768)
            currentSVI.MinHeight = 10;
            currentSVI.Width = duration * (timelineWidth / timelineLength);
            currentSVI.Height = timelineHeight - 7;
            currentSVI.Background = new SolidColorBrush(Colors.Transparent);
            currentSVI.Orientation = 0;
            currentSVI.CanRotate = false;
            currentSVI.Deceleration = double.NaN; // disables inertia
            currentSVI.Center = new Point((beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2), (timelineHeight / 2) - 2);
            currentSVI.Opacity = .7;
            currentSVI.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(tourEventSVI_ContainerManipulationCompleted);
            currentSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(tourEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseUp += new MouseButtonEventHandler(tourEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseDown += tourEventSVI_PreviewMouseDown;

            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(currentSVI, tourEventCenterChanged);

            tourEventInfo currentAnimInfo = new tourEventInfo();
            currentAnimInfo.timelineInfoStruct = timelineInfoStruct;
            currentAnimInfo.beginTime = beginTime;
            currentAnimInfo.tourEvent = tourEvent;
            currentAnimInfo.centerY = (timelineHeight / 2) - 2;
            currentAnimInfo.centerX = (beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2);
            currentAnimInfo.originalLoc = beginTime * (timelineWidth / timelineLength);
            Rectangle r = new Rectangle();
            r.Width = currentSVI.Width;
            r.Height = currentSVI.Height;
            Timeline timeline = timelineInfoStruct.timeline;
            if (tourEvent != null)
            {
                LinearGradientBrush fadeInBrush = new LinearGradientBrush();
                fadeInBrush.StartPoint = new Point(0, 0);
                fadeInBrush.EndPoint = new Point(1, 0);
                fadeInBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 0.0));
                fadeInBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.7));
                fadeInBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 1.0));
                LinearGradientBrush fadeOutBrush = new LinearGradientBrush();
                fadeOutBrush.StartPoint = new Point(0, 0);
                fadeOutBrush.EndPoint = new Point(1, 0);
                fadeOutBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
                fadeOutBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.0));
                fadeOutBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.3));
                switch (tourEvent.type)
                {

                    case TourEvent.Type.fadeInMedia:
                        tourSystem.registerDockableItem((tourEvent as FadeInMediaEvent).media, timeline);
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutMedia:
                        tourSystem.registerDockableItem((tourEvent as FadeOutMediaEvent).media, timeline);
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.zoomMedia:
                        tourSystem.registerDockableItem((tourEvent as ZoomMediaEvent).media, timeline);
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;
                    case TourEvent.Type.fadeInPath:
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutPath:
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.fadeInHighlight:
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutHighlight:
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.zoomMSI:
                        tourSystem.registerMSI((tourEvent as ZoomMSIEvent).msi, timeline);
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;
                    default:
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;

                }
            }
            else
            {
                r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
            }
            currentSVI.Content = r;

            currentAnimInfo.r = r;
            currentSVI.Tag = currentAnimInfo;
            if (tourEvent == null)
                currentSVI.IsManipulationEnabled = false;
            currentSVI.PreviewMouseWheel +=new MouseWheelEventHandler(currentSVI_PreviewMouseWheel);
            currentSVI.SizeChanged += new SizeChangedEventHandler(tourEventSVI_SizeChanged);

            timelineSV.Items.Add(currentSVI);
        }
コード例 #2
0
        public void addAudioEvent(timelineInfo timelineInfoStruct, TourEvent tourEvent, ScatterView timelineSV, double beginTime, double duration)
        {
            ScatterViewItem currentSVI = new ScatterViewItem();
            currentSVI.MinWidth = 10; // don't want it to disappear, but still need it to be touchable (even if resolution is as low as 1024 x 768)
            currentSVI.MinHeight = 10;
            currentSVI.Width = duration * (timelineWidth / timelineLength);
            currentSVI.Height = timelineHeight - 7;
            currentSVI.Background = new SolidColorBrush(Colors.Transparent);
            currentSVI.Orientation = 0;
            currentSVI.CanRotate = false;
            currentSVI.Deceleration = double.NaN; // disables inertia
            currentSVI.Center = new Point((beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2), (timelineHeight / 2) - 2);
            currentSVI.Opacity = .7;
            currentSVI.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(tourAudioEventSVI_ContainerManipulationCompleted);
            currentSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(tourEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseUp += new MouseButtonEventHandler(tourEventSVI_PreviewTouchUp);

            currentSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(tourAudioEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseUp += new MouseButtonEventHandler(tourAudioEventSVI_PreviewTouchUp);
            currentSVI.SizeChanged += new SizeChangedEventHandler(tourEventSVI_SizeChanged);
            currentSVI.PreviewMouseWheel += new MouseWheelEventHandler(currentAudioSVI_PreviewMouseWheel);
            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(currentSVI, tourAudioEventCenterChanged);

            tourEventInfo currentAnimInfo = new tourEventInfo();
            currentAnimInfo.timelineInfoStruct = timelineInfoStruct;
            currentAnimInfo.beginTime = beginTime;
            currentAnimInfo.tourEvent = tourEvent;
            currentAnimInfo.centerY = (timelineHeight / 2) - 2;
            currentAnimInfo.centerX = (beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2);
            currentAnimInfo.originalLoc = beginTime * (timelineWidth / timelineLength);
            Rectangle r = new Rectangle();
            r.Width = currentSVI.Width;
            r.Height = currentSVI.Height;

            r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));

            currentSVI.Content = r;

            currentAnimInfo.r = r;
            currentSVI.Tag = currentAnimInfo;

            timelineSV.Items.Add(currentSVI);
        }