public FadeOutHighlightEvent(SurfaceInkCanvas canvas, double durationParam, double opacity)
 {
     type = TourEvent.Type.fadeOutHighlight;
     duration = durationParam;
     inkCanvas = canvas;
     this.opacity = opacity;
 }
Ejemplo n.º 2
0
 public ZoomPathEvent(SurfaceInkCanvas canvas, double absoluteScaleParam, double zoomToArtworkPointXParam, double zoomToArtworkPointYParam, double durationParam)
 {
     type = TourEvent.Type.zoomPath;
     absoluteScale = absoluteScaleParam;
     zoomToArtworkPointX = zoomToArtworkPointXParam;
     zoomToArtworkPointY = zoomToArtworkPointYParam;
     duration = durationParam;
 }
 public ZoomHighlightEvent(SurfaceInkCanvas canvas, double absoluteScaleParam, double zoomToArtworkPointXParam, double zoomToArtworkPointYParam, double durationParam, double opacity)
 {
     type = TourEvent.Type.zoomHighlight;
     absoluteScale = absoluteScaleParam;
     zoomToArtworkPointX = zoomToArtworkPointXParam;
     zoomToArtworkPointY = zoomToArtworkPointYParam;
     duration = durationParam;
     this.opacity = opacity;
 }
Ejemplo n.º 4
0
        public StrokeInkAnalyzer(SurfaceInkCanvas inkHost, IShapeHost host)
        {
            this.drawingHost    = host;
            this.theInkAnalyzer = new System.Windows.Ink.InkAnalyzer();
            this.inkCanvas      = inkHost;

            this.inkCanvas.StrokeCollected        += inkHost_StrokeCollected;
            this.inkCanvas.Strokes.StrokesChanged += Strokes_StrokesChanged;
            theInkAnalyzer.ResultsUpdated         += theInkAnalyzer_ResultsUpdated;

            IsWork = false;
        }
Ejemplo n.º 5
0
        // TODO: Add in UndoRedo CommandStack and relevant classes
        public SessionManager(SurfaceInkCanvas targetInkCanvas)
        {
            CurrentProject = new Project();
            AddNewPageToProject();
            _SurfacetargetInkCanvas = targetInkCanvas;
            CommonGestureManager = GestureManager.LoadFromFile("gestures.xml");
            ActivePenMode = PenMode.Draw;

            NotifyPropertyChanged("CurrentProject");
            NotifyPropertyChanged("ActivePenMode");
            NotifyPropertyChanged("ActivePenSettings");
        }
Ejemplo n.º 6
0
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (AddStrokesMode == "ADD")
            {
                InkLayer.Children.Remove(GISInkCanvas);
                GISInkCanvas = new SurfaceInkCanvas();
                InkLayer.Children.Add(GISInkCanvas);
                GISInkCanvas.DefaultDrawingAttributes.Color = Colors.Red;
                GISInkCanvas.GotTouchCapture += new EventHandler <TouchEventArgs>(GISInkCanvas_TouchDown);

                GISInkCanvas.DefaultDrawingAttributes.Height = 15;
                GISInkCanvas.DefaultDrawingAttributes.Width  = 15;
            }
        }
Ejemplo n.º 7
0
        public RuleSample(IGTRules _parent, List<String> gdl, SurfaceInkCanvas canvas)
        {
            InitializeComponent();
            foreach (string s in gdl)
            {
                rule.Items.Add(s);

            }

            parent = _parent;
            thumbnail.Strokes.Add(canvas.Strokes);
            viewbox.Width = canvas.ActualWidth / 3;
            viewbox.Height = canvas.ActualHeight / 3;
            thumbnail.EditingMode = SurfaceInkEditingMode.None;
        }
Ejemplo n.º 8
0
        public Whiteboard()
        {
            base.CanScale = true;

            _grid = new Grid()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                Background = new SolidColorBrush(Color.FromArgb(200, 50, 50, 50))
            };
            _grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            _grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
            base.Content = _grid;

            _canvas = new SurfaceInkCanvas()
            {
                Background = new SolidColorBrush(Colors.Black),
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                Margin = new Thickness(12, 0, 12, 12)
            };

            _privateStrokeCollection = _canvas.Strokes;

            Grid.SetRow(_canvas, 1);
            _grid.Children.Add(_canvas);

            StackPanel buttons = new StackPanel()
            {
                Orientation = System.Windows.Controls.Orientation.Horizontal,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right
            };
            Grid.SetRow(buttons, 0);
            _grid.Children.Add(buttons);

            _eraseButton = new MyButton("Erase.png");
            _eraseButton.SelectedChanged += new EventHandler(_eraseButton_SelectedChanged);
            buttons.Children.Add(_eraseButton);

            _drawButton = new MyButton("167-Painting.png") { IsSelected = true };
            _drawButton.SelectedChanged += new EventHandler(_drawButton_SelectedChanged);
            buttons.Children.Add(_drawButton);

            _typeButton = new SwitchButton("109-AdminUser.png", "108-Group.png")
            {
                Margin = new Thickness(12,0,0,0)
            };
            _typeButton.DisplayedSwitched += new EventHandler(_typeButton_DisplayedSwitched);
            buttons.Children.Add(_typeButton);
        }
Ejemplo n.º 9
0
        public override void OnApplyTemplate()
        {
            if (painter != null)
                Strokes = painter.Strokes;

            if (text != null)
                Name = text.Text;

            if (GetTemplateChild("btnReset") != null)
            {
                reset = GetTemplateChild("btnReset") as SurfaceButton;
                reset.Click += new RoutedEventHandler(btnReset_Click);
            }

            if (GetTemplateChild("txtName") != null)
            {
                text = GetTemplateChild("txtName") as SurfaceTextBox;
                text.TextChanged += new TextChangedEventHandler(text_TextChanged);
                text.Text = Name;
            }

            if (GetTemplateChild("lblName") != null)
            {
                label = GetTemplateChild("lblName") as Label;
                label.Content = Name;
            }

            if (GetTemplateChild("Painter") != null)
            {
                painter = GetTemplateChild("Painter") as SurfaceInkCanvas;
                // Set up the DrawingAttributes for the pen.
                var inkDA = new DrawingAttributes();
                inkDA.Color = Colors.Black;
                inkDA.Height = 1;
                inkDA.Width = 1;
                inkDA.FitToCurve = false;
                painter.UsesTouchShape = false;

                painter.DefaultDrawingAttributes = inkDA;
                if(Strokes != null)
                    painter.Strokes = Strokes;
            }  
            base.OnApplyTemplate();
        }
Ejemplo n.º 10
0
        private void addDrawingFromInkCanvas(SurfaceInkCanvas inkCanvas)
        {
            WorldDrawing drawing = currentWorld.createNewDrawing();

            inkCanvas.Clip = new EllipseGeometry(new Point(inkCanvas.ActualWidth / 2, inkCanvas.ActualHeight / 2), inkCanvas.ActualWidth, inkCanvas.ActualHeight);

            //Save strokes
            FileStream fileStream = new FileStream(drawing.StrokesFilePath, FileMode.Create, FileAccess.Write);

            inkCanvas.Strokes.Save(fileStream);
            fileStream.Close();

            //Save bitmap
            fileStream = new FileStream(drawing.BitmapFilePath, FileMode.Create, FileAccess.Write);
            int marg = int.Parse(inkCanvas.Margin.Left.ToString());
            RenderTargetBitmap rtb =
                new RenderTargetBitmap((int)inkCanvas.ActualWidth - marg,
                                       (int)inkCanvas.ActualHeight - marg, 0, 0,
                                       PixelFormats.Pbgra32);

            rtb.Render(inkCanvas);
            PngBitmapEncoder png = new PngBitmapEncoder();

            png.Frames.Add(BitmapFrame.Create(rtb));
            png.Save(fileStream);
            fileStream.Close();

            Image image = new Image();

            image.Source = new ImageSourceConverter().ConvertFromString(drawing.BitmapFilePath) as ImageSource;

            Ball ball = new Ball(count, (int)(800 / 2 - 64), (int)(800 / 2 - 64), 128, 128, drawing, true, 800);

            planet.addBall(ball);

            inkCanvas.Strokes.Clear();
        }
Ejemplo n.º 11
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

                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
 public void loadInkCanvas(SurfaceInkCanvas canvas, string path)
 {
     FileStream fs = new FileStream(path, FileMode.Open);
     System.Windows.Ink.StrokeCollection collection = new System.Windows.Ink.StrokeCollection(fs);
     canvas.Strokes.Add(collection);
 }
Ejemplo n.º 13
0
 public PenSettings(SurfaceInkCanvas targetInkCanvas)
 {
     _SurfacetargetInkCanvas = targetInkCanvas;
 }
Ejemplo n.º 14
0
        public void MakeNewPathCanvas()
        {
            currentPathCanvas = new SurfaceInkCanvas();
            currentPathCanvas.DefaultDrawingAttributes.FitToCurve = true;
            inkCanvases.Add(currentPathCanvas);
            currentPathCanvas.Width = 1920;
            currentPathCanvas.Height = 1080;
            currentPathCanvas.UsesTouchShape = true;
            currentPathCanvas.Background = Brushes.Transparent;
            Canvas.SetZIndex(currentPathCanvas, 50);
            artModeWin.ImageArea.Children.Add(currentPathCanvas);
            TourEvent fadeIn = new FadeInPathEvent(currentPathCanvas, 1);
            fadeIn.type = TourEvent.Type.fadeInPath;
            TourEvent fadeOut = new FadeOutPathEvent(currentPathCanvas, 1);
            fadeOut.type = TourEvent.Type.fadeOutPath;

            TourParallelTL tourtl = new TourParallelTL();
            tourtl.type = TourTLType.path;
            tourtl.inkCanvas = currentPathCanvas;
            tourtl.displayName = "Drawing";
            tourtl.file = getNextFile("Path");
            currentPathCanvasFile = tourtl.file;
            BiDictionary<double, TourEvent> tlbidict = new BiDictionary<double, TourEvent>();
            double start = authorTimerCountSpan.TotalSeconds;
            if (start < 1) start = 1;
            authorTimerCountSpan = TimeSpan.FromSeconds(start);
            tlbidict.Add(start - 1, fadeIn);
            tlbidict.Add(start + 1, fadeOut);
            tourBiDictionary.Add(tourtl, tlbidict);
            if (!tourAuthoringOn)
                currentPathCanvas.IsHitTestVisible = false;
            tourAuthoringUI.refreshUI();
        }
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (AddStrokesMode == "ADD")
            {

                InkLayer.Children.Remove(GISInkCanvas);
                GISInkCanvas = new SurfaceInkCanvas();
                InkLayer.Children.Add(GISInkCanvas);
                GISInkCanvas.DefaultDrawingAttributes.Color = Colors.Red;
               GISInkCanvas.GotTouchCapture+=new EventHandler<TouchEventArgs>(GISInkCanvas_TouchDown);

                GISInkCanvas.DefaultDrawingAttributes.Height = 15;
                GISInkCanvas.DefaultDrawingAttributes.Width = 15;

            }
        }
Ejemplo n.º 16
0
        public void saveInkCanvas(SurfaceInkCanvas canvas, string path)
        {
            if (File.Exists(path))
                File.Delete(path);

            FileStream fs = new FileStream(path, FileMode.CreateNew);
            canvas.Strokes.Save(fs);
            fs.Close();
        }
Ejemplo n.º 17
0
 public void addNewRule(List<String> rule, SurfaceInkCanvas canvas)
 {
     RuleSample sample = new RuleSample(this, rule, canvas);
     sample.RemoveSample.Click += RemoveSample_Click;
     gestures.Items.Add(sample);
 }
Ejemplo n.º 18
0
 public void StopDrawingPath()
 {
     if (currentPathCanvas == null)
         return;
     currentPathCanvas.EditingMode = SurfaceInkEditingMode.None;
     currentPathCanvas.IsHitTestVisible = false;
     saveInkCanvas(currentPathCanvas, currentPathCanvasFile);
     currentPathCanvas = null;
     currentPathCanvasFile = null;
 }
Ejemplo n.º 19
0
 public FadeOutPathEvent(SurfaceInkCanvas canvas, double durationParam)
 {
     type = TourEvent.Type.fadeOutPath;
     duration = durationParam;
     inkCanvas = canvas;
 }
Ejemplo n.º 20
0
 public void changeCanvas(bool isPath, SurfaceInkCanvas canvas, string file)
 {
     if (isPath)
     {
         canvas.DefaultDrawingAttributes.Width = 3;
         canvas.DefaultDrawingAttributes.Height = 3;
         canvas.DefaultDrawingAttributes.Color = System.Windows.Media.Color.FromRgb(0,0,0);
         canvas.UsesTouchShape = true;
         currentPathCanvas = canvas;
         currentPathCanvasFile = file;
         return;
     }
     canvas.DefaultDrawingAttributes.Width = 50;
     canvas.DefaultDrawingAttributes.Height = 50;
     canvas.DefaultDrawingAttributes.Color = System.Windows.Media.Color.FromRgb(0, 0, 0);
     currentHighlightCanvas = canvas;
     currentHighlightCanvasFile = file;
 }