private void cmdPlayCode_Click(object sender, RoutedEventArgs e) { // Create the timeline. // This isn't required, but it allows you to configure details // that wouldn't otherwise be possible (like repetition). MediaTimeline timeline = new MediaTimeline(new Uri("test.mpg", UriKind.Relative)); timeline.RepeatBehavior = RepeatBehavior.Forever; // Create the clock, which is shared with the MediaPlayer. MediaClock clock = timeline.CreateClock(); MediaPlayer player = new MediaPlayer(); player.Clock = clock; // Create the VideoDrawing. VideoDrawing videoDrawing = new VideoDrawing(); videoDrawing.Rect = new Rect(150, 0, 100, 100); videoDrawing.Player = player; // Assign the DrawingBrush. DrawingBrush brush = new DrawingBrush(videoDrawing); this.Background = brush; // Start the timeline. clock.Controller.Begin(); }
public ReactVideoView() { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(250.0); _timer.Start(); _player = new MediaPlayer(); _drawing = new VideoDrawing(); _drawing.Rect = new Rect(0, 0, 100, 100); // Set the initial viewing area _drawing.Player = _player; _brush = new DrawingBrush(_drawing); this.Background = _brush; }
private void tmp_Click(object sender, System.Windows.RoutedEventArgs e) { // TODO: Add event handler implementation here. // Insert code required on object creation below this point. Reset(); reflector.LayoutTransform = new ScaleTransform { ScaleY = -1, CenterY = 0.5 }; //设置自己的布局 LinearGradientBrush maskBrush = new LinearGradientBrush { StartPoint = new Point(0, 0), EndPoint = new Point(0, 1) }; GradientStop stopOne = new GradientStop { Color = Colors.Black, Offset = 0.875 }; GradientStop stopTwo = new GradientStop { Color = Colors.Transparent, Offset = 0 }; maskBrush.GradientStops.Add(stopOne); maskBrush.GradientStops.Add(stopTwo); reflector.OpacityMask = maskBrush; //以下是联合VideoDrawing和MediaPlayer的设置 MediaPlayer player = new MediaPlayer();//使用MediaPlayer对象 player.Clock = clock; VideoDrawing drawing = new VideoDrawing(); drawing.Rect = new Rect(150, 0, 100, 100); drawing.Player = player; //将MediaPlayer赋给VideoDrawing DrawingBrush brush = new DrawingBrush(drawing); //得到使用的绘图画刷 Rectangle border = new Rectangle(); border.Stretch = Stretch.Fill; orgin.Child = border; border.Fill = brush; orgin.Child = border; reflector.Fill = brush; clock.Controller.Stop(); start.IsEnabled = true; pause.IsEnabled = false; resume.IsEnabled = false; stop.IsEnabled = false; }
public SpeechView() { InitializeComponent(); _player = new MediaPlayer(); _videoDrawing = new VideoDrawing(); _videoDrawing.Rect = new Rect(150, 0, 100, 100); _videoDrawing.Player = _player; _brush = new DrawingBrush(_videoDrawing); PlayVideoArea.Background = _brush; _player.MediaEnded += Player_MediaEnded;; _player.MediaOpened += Player_MediaOpened; _timer = new Timer((state) => UpdatePlayTime(), null, Timeout.Infinite, Timeout.Infinite); }
public WpfWrapper() { InitializeComponent(); player = new MediaPlayer(); var vd = new VideoDrawing(); vd.Player = player; vd.Rect = new Rect(0, 0, 1, 1); var db = new DrawingBrush(); db.Drawing = vd; video.Fill = db; }
public void SetVideoBrush(string videoPath) { if (shape != null) { Uri uri = new Uri(videoPath); MediaPlayer mp = new MediaPlayer(); mp.Open(uri); VideoDrawing vd = new VideoDrawing(); vd.Player = mp; vd.Rect = Rect; DrawingBrush db = new DrawingBrush(vd); shape.Fill = db; mp.Play(); } }
public void PlayAdvert() { Player = new MediaPlayer(); Player.Open(new Uri(@"c:\\KioskVideo\\1.mp4", UriKind.Relative)); VideoDrawing drawing = new VideoDrawing { Rect = new Rect(0, 0, 1000, 600), Player = Player }; Player.Play(); DrawingBrush brush = new DrawingBrush(drawing); Background = brush; }
public Window1() { InitializeComponent(); MediaPlayer player = new MediaPlayer(); player.Open(new Uri("cat.wmv", UriKind.Relative)); VideoDrawing videoDrawing = new VideoDrawing(); videoDrawing.Rect = new Rect(0, 0, 50, 50); videoDrawing.Player = player; lakeBrush.Drawing = videoDrawing; player.Play(); }
public VideoPlayer() { InitializeComponent(); this.mediaPlayer = new MediaPlayer(); this.mediaPlayer.ScrubbingEnabled = true; this.mediaPlayer.MediaOpened += MediaOpenedHandler; this.mediaPlayer.MediaEnded += MediaEndedHandler; VideoDrawing drawing = new VideoDrawing(); drawing.Rect = new Rect(0, 0, 100, 100); drawing.Player = this.mediaPlayer; DrawingBrush brush = new DrawingBrush(drawing); this.videoCanvas.Background = brush; }
private void Button_Click(object sender, RoutedEventArgs e) { var player = new MediaPlayer(); player.Open(new Uri("thomasOnBoard.wmv", UriKind.Relative)); var drawing = new VideoDrawing(); drawing.Player = player; drawing.Rect = new Rect(0, 0, 290, 200); var brush = new DrawingBrush(drawing); rect.Fill = brush; player.Play(); }
public WindowsMediaPlayer() { _player.MediaOpened += PlayerMediaOpened; _player.MediaEnded += (s, e) => Stop(); _player.MediaFailed += (s, e) => HandleMediaFailedException(e.ErrorException); _positionTimer.Interval = TimeSpan.FromMilliseconds(250); _positionTimer.Tick += PositionTimerTick; Error = PlayerError.NoError; var videoDrawing = new VideoDrawing { Player = _player, Rect = new Rect(0, 0, 1, 1) }; VideoBrush = new DrawingBrush(videoDrawing); }
private void Window_Loaded(object sender, RoutedEventArgs e) { MediaPlayer oynt = new MediaPlayer(); oynt.Open(new Uri(@"..\..\Videos\Wildlife.wmv", UriKind.Relative)); VideoDrawing videod = new VideoDrawing(); videod.Rect = new Rect(100, 100, 10, 10); videod.Player = oynt; DrawingBrush fircam = new DrawingBrush(); fircam.Drawing = videod; ellipseVideo.Fill = fircam; oynt.Play(); }
private void VideoDrawingAnimationWindow_OnLoaded(object sender, RoutedEventArgs e) { var player = new MediaPlayer(); player.MediaEnded += PlayerOnMediaEnded; player.Open(new Uri(@"AnimationPerformanceDemo\Assets\1.mp4", UriKind.RelativeOrAbsolute)); var videoDrawing = new VideoDrawing { Rect = new Rect(0, 0, 1920, 1080), Player = player }; var brush = new DrawingBrush(videoDrawing); Background = brush; player.Play(); }
private void DrawVideoOnMesh(VideoDrawing vd, GeometryModel3D gm3d, Uri uri) { MediaPlayer mp = new MediaPlayer(); mp.Open(uri); mp.MediaEnded += new EventHandler(mp_MediaEnded); vd.Player = mp; vd.Rect = new Rect(0, 0, 5, 10); DrawingBrush db = new DrawingBrush(); db.Drawing = vd; Brush br = db as Brush; MaterialGroup mg = new MaterialGroup(); mg.Children.Add(new DiffuseMaterial(br)); gm3d.Material = mg; vd.Player.Play(); }
public MainWindow() { InitializeComponent(); var mediaPlayer = new MediaPlayer(); mediaPlayer.Open(new Uri("pack://application:,,,/KufayunurharnaLuragaruker;component/Video.mp4")); var videoDrawing = new VideoDrawing() { Player = mediaPlayer, Rect = new Rect(new Size(Width, Height)) }; var drawingBrush = new DrawingBrush(videoDrawing); Background = drawingBrush; mediaPlayer.Play(); }
public void Start() { if (_mediaPlayer == null) { _mediaPlayer = new MediaPlayer(); videoDrawing = new VideoDrawing(); brush = new DrawingBrush(videoDrawing); _mediaPlayer.MediaOpened += _mediaPlayer_MediaOpened; //videoDrawing.Rect = new Rect(new Point(), MeasureArrangeHelper(this.RenderSize)); videoDrawing.Player = _mediaPlayer; _Border = new Canvas(); brush.Stretch = Stretch.Fill; RenderOptions.SetBitmapScalingMode(_Border, BitmapScalingMode.Fant); _Border.UseLayoutRounding = true; Content = VideoBorder; } var open = new OpenFileDialog(); var r = open.ShowDialog(); if (!r.HasValue || !r.Value) { return; } fileName = open.FileName; CreateMediaClock(); _mediaPlayer.Clock = CurrentMediaClock; if (CurrentMediaClock != null && CurrentMediaClock.Controller != null) { if (CurrentMediaClock.IsPaused) { CurrentMediaClock.Controller.Resume(); if (!isPlayed) { Begin(); } } else { Begin(); } isPlayed = true; } }
protected override void OnRender(DrawingContext drawingContext) { if (null == player) { player = new MediaPlayer(); player.Open(new Uri(@"file://e:\new.wmv", UriKind.Absolute)); aVideoDrawing = new VideoDrawing(); aVideoDrawing.Rect = new Rect(0, 0, 100, 100); aVideoDrawing.Player = player; // Play the video once. player.Play(); } base.OnRender(drawingContext); /// drawingContext.DrawDrawing(aVideoDrawing); }
private void addStackPanel(Grid stackPanel, int row, int column, int count) { VideoDrawing drawing = new VideoDrawing(); drawing.Rect = new Rect(0, 0, 400, 300); drawing.Player = getMediaPlayer(count - 1); DrawingBrush brush = new DrawingBrush(drawing); Label sp = new Label(); Console.WriteLine("margin " + web.marginMainGrid.ToString()); sp.Margin = new Thickness(web.marginMainGrid); sp.Background = brush; sp.Opacity = 100; sp.Uid = count.ToString(); sp.MouseDown += clickGame; sp.BorderThickness = new Thickness(1); stackPanel.Children.Add(sp); Grid.SetColumn(sp, column); Grid.SetRow(sp, row); }
/// <summary> /// Enumerates through the drawing group of a visual to extract the geometries. /// </summary> /// <param name="dg"></param> /// <param name="currentParent"></param> private static void EnumerateDrawingGroup(DrawingGroup dg, GeometryGroup currentParent) { for (int i = 0; i < dg.Children.Count; i++) { if (dg.Children[i] is GeometryDrawing) { GeometryDrawing geometryDrawing = dg.Children[i] as GeometryDrawing; if (geometryDrawing != null) { Geometry geometry = geometryDrawing.Geometry; currentParent.Children.Add(geometry); } } else if (dg.Children[i] is DrawingGroup) { EnumerateDrawingGroup((DrawingGroup)dg.Children[i], currentParent); } else if (dg.Children[i] is GlyphRunDrawing) { GlyphRunDrawing glyphrunDrawing = dg.Children[i] as GlyphRunDrawing; GlyphRun glyphrun = glyphrunDrawing.GlyphRun; if (glyphrun != null) { Geometry geometry = glyphrun.BuildGeometry(); currentParent.Children.Add(geometry); } } else if (dg.Children[i] is ImageDrawing) { ImageDrawing imagedrawing = dg.Children[i] as ImageDrawing; RectangleGeometry rg = new RectangleGeometry(imagedrawing.Rect); currentParent.Children.Add(rg); } else if (dg.Children[i] is VideoDrawing) { VideoDrawing videodrawing = dg.Children[i] as VideoDrawing; RectangleGeometry rg = new RectangleGeometry(videodrawing.Rect); currentParent.Children.Add(rg); } } }
private void cmdPlayCode_Click(object sender, RoutedEventArgs e) { // Create the MediaPlayer. MediaPlayer player = new MediaPlayer(); player.Open(new Uri("test.mpg", UriKind.Relative)); // Create the VideoDrawing. VideoDrawing videoDrawing = new VideoDrawing(); videoDrawing.Rect = new Rect(150, 0, 100, 100); videoDrawing.Player = player; // Assign the DrawingBrush. DrawingBrush brush = new DrawingBrush(videoDrawing); this.Background = brush; // Start playback. player.Play(); }
private void Grid_OnDrop(object sender, DragEventArgs e) { MediaPlayer?.Close(); var fileList = (string[]?)e.Data.GetData(DataFormats.FileDrop); if (fileList is not null && fileList.Length > 0) { var mediaPlayer = MediaPlayer = new MediaPlayer(); mediaPlayer.Open(new Uri(fileList[0])); var videoDrawing = new VideoDrawing() { Player = mediaPlayer, Rect = new Rect(new Size(Width, Height)) }; var drawingBrush = new DrawingBrush(videoDrawing); Background = drawingBrush; mediaPlayer.Play(); } }
/// <summary> /// This summary has not been prepared yet. NOSUMMARY - pantal07 /// </summary> public static Brush MakeVideoBrush(Uri videoUri, int seekTimeInMs) { VideoDrawing vd = new VideoDrawing(); MediaTimeline mt = new MediaTimeline(videoUri); MediaClock mc = mt.CreateClock(); //changes for MediaAPI BC - shakeels //mc.MediaOpened += new EventHandler( MediaClock_MediaOpened ); //vd.MediaClock = mc; MediaPlayer mp = new MediaPlayer(); mp.Clock = mc; mp.MediaOpened += new EventHandler(MediaClock_MediaOpened); vd.Player = mp; //end change vd.Rect = new Rect(0, 0, 256, 256); DrawingBrush db = new DrawingBrush(); db.Drawing = vd; return(db); }
private void OnPlayViaCode(object sender, RoutedEventArgs e) { // Create the MediaPlayer. var player = new MediaPlayer(); player.Open(new Uri("test.mpg", UriKind.Relative)); // Create the VideoDrawing. var videoDrawing = new VideoDrawing { Rect = new Rect(150, 0, 100, 100), Player = player }; // Assign the DrawingBrush. var brush = new DrawingBrush(videoDrawing); Background = brush; // Start playback. player.Play(); }
public VideoDrawingExample() { // <SnippetVideoDrawingExampleInline> // // Create a VideoDrawing. // // <SnippetVideoDrawingExampleInline1> MediaPlayer player = new MediaPlayer(); // </SnippetVideoDrawingExampleInline1> // <SnippetVideoDrawingExampleInline2> player.Open(new Uri(@"sampleMedia\xbox.wmv", UriKind.Relative)); // </SnippetVideoDrawingExampleInline2> // <SnippetVideoDrawingExampleInline3> VideoDrawing aVideoDrawing = new VideoDrawing(); // </SnippetVideoDrawingExampleInline3> // <SnippetVideoDrawingExampleInline4> aVideoDrawing.Rect = new Rect(0, 0, 100, 100); // </SnippetVideoDrawingExampleInline4> // <SnippetVideoDrawingExampleInline5> aVideoDrawing.Player = player; // </SnippetVideoDrawingExampleInline5> // <SnippetVideoDrawingExampleInline6> // Play the video once. player.Play(); // </SnippetVideoDrawingExampleInline6> // </SnippetVideoDrawingExampleInline> // <SnippetRepeatingVideoDrawingExampleInline> // // Create a VideoDrawing that repeats. // // <SnippetRepeatingVideoDrawingExampleInline1> // Create a MediaTimeline. MediaTimeline mTimeline = new MediaTimeline(new Uri(@"sampleMedia\xbox.wmv", UriKind.Relative)); // Set the timeline to repeat. mTimeline.RepeatBehavior = RepeatBehavior.Forever; // </SnippetRepeatingVideoDrawingExampleInline1> // <SnippetRepeatingVideoDrawingExampleInline2> // Create a clock from the MediaTimeline. MediaClock mClock = mTimeline.CreateClock(); // </SnippetRepeatingVideoDrawingExampleInline2> // <SnippetRepeatingVideoDrawingExampleInline3> MediaPlayer repeatingVideoDrawingPlayer = new MediaPlayer(); repeatingVideoDrawingPlayer.Clock = mClock; // </SnippetRepeatingVideoDrawingExampleInline3> // <SnippetRepeatingVideoDrawingExampleInline4> VideoDrawing repeatingVideoDrawing = new VideoDrawing(); repeatingVideoDrawing.Rect = new Rect(150, 0, 100, 100); repeatingVideoDrawing.Player = repeatingVideoDrawingPlayer; // </SnippetRepeatingVideoDrawingExampleInline4> // </SnippetRepeatingVideoDrawingExampleInline> // Create a DrawingGroup to combine the drawings. DrawingGroup videoDrawings = new DrawingGroup(); videoDrawings.Children.Add(aVideoDrawing); videoDrawings.Children.Add(repeatingVideoDrawing); // // Use a DrawingImage and an Image control // to display the drawing. // DrawingImage exampleDrawingImage = new DrawingImage(videoDrawings); // Freeze the DrawingImage for performance benefits. exampleDrawingImage.Freeze(); Image anImage = new Image(); anImage.Source = exampleDrawingImage; anImage.Stretch = Stretch.None; anImage.HorizontalAlignment = HorizontalAlignment.Left; // // Place the image inside a border and // add it to the page. // Border exampleBorder = new Border(); exampleBorder.Child = anImage; exampleBorder.BorderBrush = Brushes.Gray; exampleBorder.BorderThickness = new Thickness(1); exampleBorder.HorizontalAlignment = HorizontalAlignment.Left; exampleBorder.VerticalAlignment = VerticalAlignment.Top; exampleBorder.Margin = new Thickness(10); this.Margin = new Thickness(20); this.Background = Brushes.White; this.Content = exampleBorder; }
private static Drawing SimplifyVideoDrawing(VideoDrawing videoDrawing) { return((Drawing)videoDrawing); }
/*This function displays a node on the screen. It is called only when a node is in the selected state to display its content. * Parameters * Int16[,] NodeProp- Node location * string textColor - Node's text color * double top - Top or y coordinate of the cluster location on screen * double left - Left or x coordinate of the cluster location on screen * Canvas PaintCanvas - The paintcanvas where it is to be displayed * int details - this parameter is unused and can be removed */ public void displayNode(Int16[,] NodeProp, string textColor, double top, double left, Canvas PaintCanvas, int details) { //stop and close any of the videos playing in previously selected node MainWindow.mp.Stop(); MainWindow.mp.Close(); //Create the ellipse for this node and assign values to its parameters Ellipse ellipse = new Ellipse(); ellipse.Height = NodeProp[0, 2]; ellipse.Width = NodeProp[0, 2]; ellipse.StrokeThickness = 0; BrushConverter bc = new BrushConverter(); Brush brush = (Brush)bc.ConvertFrom(color); ImageBrush im = new ImageBrush(); Label img = new Label(); /*This code finds the previously selected node on the paint canvas and removes any related nodes from it and hides its information content * because now another node is being selected for information */ foreach (FrameworkElement element in MainWindow.PaintCanvas.Children) { if (element is Grid) { Grid g = element as Grid; if (g != null && g.Children.Count > 6) { Ellipse e = g.Children[0] as Ellipse; Label l = new Label(); Label l1 = new Label(); l1 = g.Children[6] as Label; Label l2 = g.Children[5] as Label; l = g.Children[7] as Label; Label l3 = g.Children[4] as Label; BrushConverter BC = new BrushConverter(); Brush b = (Brush)BC.ConvertFrom(l.Content); TextBlock t = g.Children[1] as TextBlock; if (e.Fill != null && e.Height > 200) { e.Fill = b; t.Text = l3.Content.ToString(); t.Visibility = System.Windows.Visibility.Visible; e.Height = 240; e.Width = 240; } else if (e.Fill != null && e.Height > 100) { e.Visibility = System.Windows.Visibility.Hidden; t.Visibility = System.Windows.Visibility.Hidden; } } } } // store node's name in Textblock TextBlock txt = new TextBlock(); txt.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; txt.VerticalAlignment = System.Windows.VerticalAlignment.Center; txt.FontSize = 20; txt.Foreground = (Brush)bc.ConvertFrom(textColor); txt.FontWeight = System.Windows.FontWeights.Bold; txt.TextWrapping = System.Windows.TextWrapping.Wrap; txt.TextTrimming = TextTrimming.CharacterEllipsis; txt.Margin = new Thickness(15, 12, 15, 10); txt.Text = name; txt.Visibility = System.Windows.Visibility.Hidden; // Assign values to Labels for storing node's parent ID, //node's state, node's name, node's type,node's subject/discipline, and the node's fill color for the ellipse. Label lbl = new Label(); lbl.Content = nodeID; lbl.Visibility = System.Windows.Visibility.Hidden; Label lbl1 = new Label(); lbl1.Content = state; lbl1.Visibility = System.Windows.Visibility.Hidden; Label lbl2 = new Label(); lbl2.Content = name; lbl2.Visibility = System.Windows.Visibility.Hidden; Label lbl3 = new Label(); lbl3.Content = type; lbl3.Visibility = System.Windows.Visibility.Hidden; Label lbl4 = new Label(); lbl4.Content = subject; lbl4.Visibility = System.Windows.Visibility.Hidden; Label lbl5 = new Label(); lbl5.Content = color; lbl5.Visibility = System.Windows.Visibility.Hidden; //Add the children to the node grid. Each node grid consists of ellipse to show content, Textblock to store textual content, Labels for storing node's parent ID, //node's state, node's name, node's type,node's subject/discipline, and the node's fill color for the ellipse. Grid grid = new Grid(); grid.Height = NodeProp[0, 2]; grid.Width = NodeProp[0, 2]; grid.Children.Add(ellipse); grid.Children.Add(txt); grid.Children.Add(lbl); grid.Children.Add(lbl1); grid.Children.Add(lbl2); grid.Children.Add(lbl3); grid.Children.Add(lbl4); grid.Children.Add(lbl5); grid.MouseLeftButtonDown += new MouseButtonEventHandler(MainWindow.node_leftClick); //if this node has a video or image content, get its path and play/display it if (imgLink != "") { MainWindow.mp.Open(new Uri(@imgLink, UriKind.Relative)); VideoDrawing vDrawing = new VideoDrawing(); vDrawing.Rect = new Rect(0, 0, 100, 100); vDrawing.Player = MainWindow.mp; DrawingBrush db = new DrawingBrush(vDrawing); ellipse.Fill = db; MainWindow.mp.Play(); } //if this node does not have a video or image content, display its text information else { txt.Visibility = System.Windows.Visibility.Visible; txt.Text = content; txt.FontSize = 13; BrushConverter BC = new BrushConverter(); Brush b = (Brush)BC.ConvertFrom(color); ellipse.Fill = b; } PaintCanvas.Children.Add(grid); //this code animates the node and makes it get larger gradually when selected DoubleAnimation da = new DoubleAnimation(1.1, new Duration(TimeSpan.FromSeconds(2))); ScaleTransform sc = new ScaleTransform(); TransformGroup tg = new TransformGroup(); tg.Children.Add(sc); //add scaleTransform grid.RenderTransform = tg; grid.RenderTransformOrigin = new Point(0, 0); sc.BeginAnimation(ScaleTransform.ScaleXProperty, da); sc.BeginAnimation(ScaleTransform.ScaleYProperty, da); Canvas.SetLeft(grid, NodeProp[0, 1] + left); Canvas.SetTop(grid, NodeProp[0, 0] + top); // this loop deals with displaying all the related nodes of this particular node for (int i = 0; i < relNodes.Count; i++) { ellipse = new Ellipse(); ellipse.Height = NodeProp[i + 1, 2]; ellipse.Width = NodeProp[i + 1, 2]; ellipse.StrokeThickness = 1.5; bc = new BrushConverter(); brush = (Brush)bc.ConvertFrom(relNodes.ElementAt(i).color); ellipse.Fill = brush; txt = new TextBlock(); txt.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; txt.VerticalAlignment = System.Windows.VerticalAlignment.Center; txt.FontSize = 16; txt.Foreground = (Brush)bc.ConvertFrom(textColor); txt.FontWeight = System.Windows.FontWeights.Bold; txt.TextWrapping = System.Windows.TextWrapping.Wrap; txt.TextTrimming = TextTrimming.CharacterEllipsis; txt.Margin = new Thickness(15, 12, 15, 10); txt.Text = name; lbl = new Label(); lbl.Content = relNodes.ElementAt(i).nodeID; lbl.Visibility = System.Windows.Visibility.Hidden; lbl1 = new Label(); lbl1.Content = relNodes.ElementAt(i).state; lbl1.Visibility = System.Windows.Visibility.Hidden; lbl2 = new Label(); lbl2.Content = relNodes.ElementAt(i).name; lbl2.Visibility = System.Windows.Visibility.Hidden; lbl3 = new Label(); lbl3.Content = relNodes.ElementAt(i).type; lbl3.Visibility = System.Windows.Visibility.Hidden; lbl4 = new Label(); lbl4.Content = subject; lbl4.Visibility = System.Windows.Visibility.Hidden; lbl5 = new Label(); lbl5.Content = color; lbl5.Visibility = System.Windows.Visibility.Hidden; txt.Text = relNodes.ElementAt(i).name; grid = new Grid(); grid.Height = NodeProp[i + 1, 2]; grid.Width = NodeProp[i + 1, 2]; grid.Children.Add(ellipse); grid.Children.Add(txt); grid.Children.Add(lbl); grid.Children.Add(lbl1); grid.Children.Add(lbl2); grid.Children.Add(lbl3); grid.Children.Add(lbl4); grid.Children.Add(lbl5); PaintCanvas.Children.Add(grid); Canvas.SetLeft(grid, 0); Canvas.SetTop(grid, 0); // this code moves the related nodes from the top left corner of the screen onto the selected node DoubleAnimationUsingPath doublePathLR = new DoubleAnimationUsingPath(); DoubleAnimationUsingPath doublePathUD = new DoubleAnimationUsingPath(); TranslateTransform tr = new TranslateTransform(); grid.RenderTransform = tr; PathGeometry pg = new PathGeometry(); PathFigure pFigure = new PathFigure(); LineSegment lSegment = new LineSegment(); PathSegmentCollection collection = new PathSegmentCollection(); collection.Add(lSegment); lSegment.Point = new Point(NodeProp[i + 1, 1] + left, NodeProp[i + 1, 0] + top); //(200, 70); collection.Add(lSegment); pFigure.Segments = collection; PathFigureCollection conn = new PathFigureCollection(); conn.Add(pFigure); pg.Figures = conn; doublePathLR.PathGeometry = pg; doublePathLR.Duration = TimeSpan.FromSeconds(3); doublePathLR.Source = PathAnimationSource.X; doublePathUD.PathGeometry = pg; doublePathUD.Duration = TimeSpan.FromSeconds(3); doublePathUD.Source = PathAnimationSource.Y; //this actually makes the node move; it activates the animation tr.BeginAnimation(TranslateTransform.XProperty, doublePathLR); tr.BeginAnimation(TranslateTransform.YProperty, doublePathUD); } }
static void RenderTo(this VideoDrawing drawing, d.Graphics graphics, double opacity) { Utility.Warning("Ignoring Video at {0}", drawing.Bounds); }