Switch Cameras Surface Pro 4 - wpf

I have an application written using .Net 4.5 and WPF and mainly for use in Windows 10. In this application, I have created a custom window for capturing images and videos, using leadtools (directshow) to control the camera. Everything looks great with my camera on most devices that I have tried it on except the Surface Pro 4, and that is the device that we have bought multiple of for testing the application. If the tablet is moving while I try to set the selected camera, it takes a little over 10 seconds for the cameras to actually switch. The time doesn't change much (within a 10 milliseconds) whether the tablet is moving a little at the moment I tell it to switch cameras or if I shake the tablet wildly till the 10 seconds passes and the preview starts back up. Then, if I leave my Surface Pro 4 on its stand on my desk and tell it to switch cameras, it switches cameras in less than half a second. Has anyone else seen this problem? Any idea how to fix this problem?

Related

Full screen touch application hangs when a user touches the lower edge

I am working on a wpf touchscreen application for a tabletop monitor. The monitor is a 46" 3M monitor. All the touch responses seem to work fine until someone touches the lower edge of the screen, then it appears to hang. No button responses or drag options work until the finger or hand is moved. I think it has something to do with the touch being in the region of the taskbar even though the taskbar itself does not appear.
The program does not hang if the user touches the side or top in the same way or even if they place their entire hand in the middle of the screen.
Since this is a tabletop monitor, it is very common for a user to lean on the monitor and unknowingly touch the lower edge with their hand.
It appears that this is a bug related to Windows 7 and multitouch drivers for Windows 7. I can reliably reproduce this bug with Windows 7 with a multitouch display and a bezel flat enough to have touch contact on the lower edge.
Using the same program and multitouch display with Windows 8, the problem does not occur.

Performance issue on complex WPF application, how to solve that?

I have my main window at something like 6000 x 6000 px. In that window, I can have a lot of controls (more than 5000) and we can zoom/pan where we want.
I added 10 "television screens" controls in my application, and each of them have a refresh rate of 100ms.
When I start this, everything crash...
10 objects with a refresh rate of 100ms each is too much, WPF cannot draw them at the time. I conclude that WPF is very slow to draw what I have....
Everything is drawn in vector, but I tried to add .CacheMode on them and it doesn't work either..
What can I do?
P.S. My PC is 8 core, 8 GB Ram, 256 Mb video card (nvidia quadro nvs 295) on win7 64bits
WPF uses software rendering in case you exceed maximum supported resolution of you graphics adapter. Moreover, 5k controls! Incredible. WPF is not a silver bullet for everything you imagine. You need to redesign your app or change technology you're using.
Work on reducing the number of controls in your application. 5K is quite a bit, and I think there is probably a way to reduce that number.
For example, use TextBlocks instead of Labels as TextBlocks render as 1 control while Labels render as 3 in 4.0 (I think its more than 3 in older versions)
Also, check and see if you can use UI Virtualization with some of your controls. Something like a ListBox of 100 items can be virtualized to only render 10 of them at a time.
Take a look at ZoomableCanvas - 1 million items. This is the best example out there of what WPF can do when using every optimisation in the book. I suggest you take that example and run it at the maximum resolution on your monitors. If that fails to perform well, then WPF cannot do this.
I was unaware that WPF default to software rendering if the resolution exceeds that of the video card. A good caveat to know about!
Regarding high performance graphical APIs I second Keiren and say use DirectX (SlimDX provides a managed wrapper) instead.

Windows Phone 7 swimming tiles effect

I wonder how to achieve effect of swiming tiles (like in windows phone 7, when you start arrange start menu tiles - other ones swim softly and randomly).
Someone have any ideas?
Check out the HubTile implementation in the Windows Phone toolkit, full open source is up at http://silverlight.codeplex.com/ - it has a hub tile service that manages such communication.

24/7 Video Player in WPF

I'm having a problem with creating 24/7 video player for my application on WPF and .NET Framework 4.0. Application shall run on kiosk and displays video clips from my playlist in a loop.
The problem is that after about 8 - 24 hours of continues playback the video frame freezes. Application does not raise any exception and continue work in normal mode: sound from video is played, video files are changed but the screen does not change.
I have been tried WPF MediaElement control and WPFMediaKit MediaUrlElement.
All tests have been done on Windows 7 (x32 and x64).
I have been tried play my playlist in a Windows Media Player 11 and it does not freeze after a few days of playback.
I have been using media files with different codec (mp4 H.263, .flv, .avi, .mkv, .wmv).
I’m using K-Lite Codec Pack Standard on all machines.
Does anybody know what the problem with video renderer in Windows 7 or Framework .NET 4.0 and how to find workaround for it?
Instead of continuously playing the playlist in a loop, you might try clearing and re-assigning the source to the mediaelement or creating a new mediaelement everytime the playlist reaches the start.
I realise that this doesn't solve the root cause of the problem, but it may be a workable workaround.
Yesterday I have removed K-Lite Codec pack from my machine and installed instead ffsshow + Haali Matroska Splitter and run another test. This test is running already about 25 hrs without any video problem.
So, hope, this was the codec issue and my test will work more then couple of days.

WPF MediaElement video playback tearing

I'm trying to use the MediaElement control in WPF to play back video. It works great in Vista, but when I run it on an XP machine I get tearing in the display. It looks as if it's not using the vertical synch, and just updating the screen mid-draw.
Anyone know how to fix this problem?
This has more to do with the way WPF renders to the screen under XP compared to Vista. Under Vista, apps render to an offscreen buffer which is then composited with other windows that have changed and is presented to the screen at the appropriate intervals by a process called DWM.exe. That can (and presumably does) present WPF's window updates to the video buffer synchronized with the refresh interval.
On XP WPF uses DirextX to render straight to the screen and updates the video buffer whenever it wants to. There might be some way to get it to synchronise with the refresh interval, but I haven't looked into it because I don't use XP any more.

Resources