Example #1
0
    private FrameworkElement CreateMediaElement(RMS.Common.Controls.VisualWrapper.VisualWrapper visualWrapper)
    {
        BitmapImage bi    = new BitmapImage(new Uri(--YOURIMAGEPATH--));     //Image path goes here
        Image       image = new Image();

        image.Source = bi;
        image.Height = 150;
        image.Width  = 150;
        //image.Margin = new Thickness(-150, -150, -150, -150);

        ImageBehavior.SetAnimatedSource(image, bi);

        BrushConverter conv = new BrushConverter();
        //SolidColorBrush brush = conv.ConvertFromString("#6C8BBA") as SolidColorBrush;
        Border border = new Border();

        border.Background = Brushes.Transparent;
        //border.BorderBrush = brush;
        //border.BorderThickness = new Thickness(3);
        //border.Margin = new Thickness(-85, -140, 0, 0);

        border.Child = image;

        return(border);
    }
Example #2
0
    private void MediaWorkerThread(object arg)
    {
        // Create the VisualTargetPresentationSource and then signal the
        // calling thread, so that it can continue without waiting for us.
        HostVisual hostVisual = (HostVisual)((object[])arg)[0];

        RMS.Common.Controls.VisualWrapper.VisualWrapper visualWrapper = (RMS.Common.Controls.VisualWrapper.VisualWrapper)((object[])arg)[1];

        VisualTargetPresentationSource visualTargetPS = new VisualTargetPresentationSource(hostVisual);

        s_event.Set();

        // Create a MediaElement and use it as the root visual for the
        // VisualTarget.
        visualTargetPS.RootVisual = CreateMediaElement(visualWrapper);

        // Run a dispatcher for this worker thread.  This is the central
        // processing loop for WPF.
        System.Windows.Threading.Dispatcher.Run();
    }