Silverlight 5 - 3D - RenderModeReason - TemporarilyUnavailable - silverlight

I'm trying to create a simple Silverlight 3d application...
I have a good enough PC, but when I run the Silverlight application I get this:
RenderModeReason - TemporarilyUnavailable... WTF is that? o_O
PS: The sample 3D applications where made by MS and are compiling and working.

In order to be able to use 3D acceleration in your app (and all the XNA namespaces), you must enable HardwareAcceleration during plugin initialization. Fortunately, it's easy:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
[...]
<param name="enableGPUAcceleration" value="true" />
[...]
</object>
To enable GPU acceleration for Out of browser apps, set the enable GPU acceleration option on the project property page.

Related

Web scraping on silverlight 4 page

There is a web page with a silver light application embedded and I want to scrape it. I wonder if there is a web scraping solution or browser automation solution (or any trick/hack) that supports silverlight in either C#, Java or Python.
I am currently trying silvernium but it is quite outdated project and doesn't seem to work properly with silverlight 4.
Here is some of the html information of the SL object in the page:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="PATH/WebSilverlight.xap"/>
<param name="onerror" value="onSilverlightError"/>
<param name="background" value="white"/>
<param name="minRuntimeVersion" value="4.0.50524.0"/>
<param name="autoUpgrade" value="true"/>
<param name="windowless" value="true"/>
<param name="enableautozoom" value="true"/>
...
I have worked successfully with Telerik testing framework for an
automation solution that supports silverlight in C#
It's free and once you get to used to it - very easy, because of the rich API and the cross-browser compatibility. Maybe the trickiest part is to initially config the tests.
Simple example:
Settings mySettings = new Settings();
mySettings.Web.DefaultBrowser = BrowserType.InternetExplorer;
Manager myManager = new Manager(mySettings);
myManager.Start();
myManager.LaunchNewBrowser();
myManager.ActiveBrowser.NavigateTo("http://www.example.com");
Element mybtn = myManager.ActiveBrowser.Find.ByTagIndex("input", 3);
myManager.ActiveBrowser.Actions.Click(mybtn);
myManager.Dispose();
A good addition to it is the Windows Inspect tool. It'll enable you to select any UI element and view the element's accessibility data in some tricky cases.
Update:
I've searched some helpful documentation links that I've used back in the days. Look at Getting started with Silverlight UI Automation and Locating elements.
In the end, I implemented a workaround using the computer vision based technology SikuliX and getting a printed PDF out of the Silverlight web app like normal normal user would to get the information. Here is an script that shows how to run this along with Selenium.
Another alternative is to hack the requests and keep the session alive while navigating to the information you need using either Scrapy, abot, crawler4j or any other similar technology.

CEFsharp & Cefglue (chromium embedded) media player plugins not working in WPF controls. (NPAPI)

I'm using javascript to replace html5 video tag's with references to VLC or Windows Media Player browser plugins in order to be able to play h.264 video's in a chromium embedded WPF control.
For example:
<object type="application/x-vlc-plugin" width="300px" height="150px" spellcheck="true" uimode="full"><param name="autostart" value="true"><param name="url" value="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"></object>
This technique works in cefclient.exe and in CEFsharp and Cefglue Winforms controls. However when doing this in either CEFsharp WPF control or Cefglue WPF control, the screen just stays blank and the console shows no errors. Even debugging on level verbose shows no errors. I've tried referencing the paths to the plugins:
CefRuntime.AddWebPluginPath(#"C:\Program Files (x86)\VideoLAN\VLC\npvlc.dll");
CefRuntime.AddWebPluginDirectory(#"C:\Program Files (x86)\VideoLAN\VLC");
But the players (VLC and WMP) still don't show.
I got a feeling that WPF is somehow not allowed to access the plugins.
I really hope you can help me with this one, because using Winforms is not an option for me as I need to be able to perform a rotatetransform on the control.
UPDATE:
Just realised that this probably has something to do with CEF3 offscreen rendering. Is it possible to disable OSR in CEF3, and will this impact performance much?

How to make sure GPUAcceleration for Silverlight is really on?

I can have a lot of controls in my layoutroot (a canvas). And as the tree gets bigger, performance naturally fades and eventually the application becomes unresponsive to most actions.. To give my creep a little push, I am trying to use the GPUAcceleration but I havenT seen any enhancement in the performance and more importantly I couldnT find a way to make sure if it is even trying.
Say I have this set on the Aspx host page of an SL app:
<asp:Silverlight ID="O2PSilverlightXaml" runat="server" Source="O2PSilverlight.xap"
EnableFrameRateCounter="true" MinimumVersion="3.0.40307.0" Width="100%" Height="100%"
EnableGPUAcceleration="true" />
How do i make sure if it worked? How do I know that my graphics card is supported or that it wasnT ignored due to the security settings of the browser ...etc?
This is for Silverlight 4.
From the page you are linking to:
During profiling and performance tuning phases of application
development, you can set EnableCacheVisualization (Silverlight Plug-in
Object) to true to produce an overlay visualization of the areas in
your UI that are being hardware accelerated.
This will give you a visual clue.

Firefox selecting whole silverlight area causing browser scroll bars to become enabled

This only seems to be a problem now with firefox 3.6
When you click anywhere on the page which is one big embedded silverlight object the little broken outline appears, the same as when you say click on a link. This is causing the page to go one pixel over horizontally and vertically which is causing scroll bars to appear.
Any idea?
Try setting outline-width:0 for your object tag either in your CSS file or directly inline on the object tag for the plugin:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" style="outline-width:0">
Seems to be the side effect of some kind of focus ring usability bug that was fixed for 3.6, which is causing this with Silverlight, Flash, Java Applets, etc.
http://www.blog.lessrain.com/firefox-36-draws-one-pixel-border/

Silverlight 2.0 binding to images vs. Silverlight 3.0

I have a Silverlight 2.0 application which binds a listbox to a collection of classes that contain a BitMap property (which are used for navigation). I've both included the images in the XAP as content and created the BitMap manually and set it as the controls source and I have also embedded the images as resources in the DLL and got the image from the manifestresourcestream and set the image. Both of these routes work great when the XAP is displayed using the Silverlight 2.0 plugin so I know my images are being deployed correctly. Unfortunately, when viewed on a machine with the Silverlight 3.0 plugin, neither of these methods display the images in the listbox.
Note that this problem only occurs when the binding takes place in an ItemTemplate of a Listbox. If I set the same property outside of the listbox it appears to find the images and work fine.
Any idea what has changed in ListBox binding between 2.0 and 3.0? I do have build 3.0.40307 of the Silverlight plugin on the machine I can reproduce the error on.
-Kevin
Ok...a solution was found (thanks to some help on the Silverlight boards):
First, it only works with the full release of the Silverlight 3.0 plug-in. Which poses a strange problem (described below).
Second, I had to switch from binding directly to an Image or Bitmap class and instead use an Imagesource class (which can be easily instantiated with a Bitmap passed to the constructor). Simple enough... Don't know why this is required in SL 3.0 but not 2.0 but it broke my code. My code is still written and compiled against the 2.0 plug-in but just runs in the 3.0 plug-in on computers that have it.
Which brings me to the strange issue...I have VM's or desktops with SL 2.0, SL 3.0 (Beta), and SL 3.0 (Full Release) available for testing. My plug-in now works fine in SL 2.0 and SL 3.0 (Full Release) but not in SL 3.0 (Beta). I get no warning and it opens fine, just that my images do not bind. So my concern is that a number of developer/techy oriented people will have the beta of 3.0 which still runs 2.0 plug-ins as it's backward compatible. They aren't forced to upgrade for any reason to run my site.
If you have any of these environments available here is a link to the site in question: http://stlouisdayofdotnet.com/DayOfDotnet.html

Resources