I’ve been trying to get WPF working on my N18 Display but no matter what I try it displays a black screen. Here is a sample of code I an trying to use.
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace GPSTest
{
public partial class Program
{
Window mMainWindow = null;
Canvas mCanvas = null;
Border mBackground = null;
void ProgramStarted()
{
display.Initialize(4000);
mMainWindow = display.WPFWindow;
mCanvas = new Canvas();
mMainWindow.Child = mCanvas;
//Add a gray background.
mBackground = new Border();
mBackground.Background = new SolidColorBrush(Colors.Gray);
mBackground.Width = 128;
mBackground.Height = 160;
mCanvas.Children.Add(mBackground);
Canvas.SetLeft(mBackground, 0);
Canvas.SetTop(mBackground, 0);
}
}
}
Does anyone have any information on why WPF won’t display. I have been able to use SimpleGraphics, but I need to be able to update labels on the display without clearing and redrawing.
Apparently the Hydra has multiple issues with displays. They are supposed to release a new SDK today or tomorrow. I’d wait before trying to debug until it comes out. I’m personally having issues with both the TE35 and CP7 with the Hydra.
It’s actually been a bug in our driver that we did not catch before the most recent SDK was released. The only work around we have right now is to download the source of the latest driver from http://gadgeteer.codeplex.com/ under Main/Modules/GHIElectronics/Display N18/Software/Display N18. Add the Display_N18_42 project as an existing project to your solution and reference it. To fix the bug, you need to change line the “public Display_N18(int socketNumber) : base(WPFRenderOptions.Ignore)” to “public Display_N18(int socketNumber) : base(WPFRenderOptions.Intercepted)”. Then your code and WPF should work. (Make sure to drop the call to display.Initialize() as that method was taken out.)
Thanks,
I added the Display_N18_42 project to my Gadgeteer solution and got WPF working with N18 display in my Cobra II compatible G120 board.
However, I’d like to learn NETMF programming by testing non-Gadgeteer WPF Application examples e.g. SimpleWPFApplication that can be found in the Microsoft.NET Micro Framework 4.2\Samples directory and many other nice examples in various NETMF books.
Now based on my testing it seems impossible to initialize N18 display with this driver in the ordinary WPF applications as it is made for the Gadgeteer framework. On the otherhand it would require a lot of work to modify all those projects to Gadgeteer applications.
I’d like to know if anybody is interested in to modify the Display_N18_42 driver project so that non-Gadgeteer WPF applications work by using G120 Module and N18 Display?
My N18 display can show WPF UIElements in Gadgeteer applications i.e. associates to a WPF Window in ProgramStarted() using mainWindow = Display_N18.WPFWindow;
My problem is how to initiate and associate the N18 Display driver in non-Gadgeteer WPF applications I.e. I want to omit Program.generated.cs and use of the Sockets based SPI and Digital Ouput pin configurations.
The code above is not gadgeteer. The first step is to get the display to work without gadgeteer. Use console application for start, no WPF yet.
The second step is then to make a window app that uses WPF. All you have to do is overload the draw method (forgot what was called) and then inside your overload you will put the code above.
Thanks, I will try to get the display working in a console application first.
Yes, I’ve been aware of the Glide and I have a plan to test it later when I have learned the capabilities with the basic WPF
I agree that it is a good idea to test the GUI design in the emulator first. Anyway, now I want to ensure my HW is working
Am I on the right track with my modified constructor to by-pass Gadgeteer Sockets with direct access to SPI and Output Ports?
…
My quick and dirty non-Gadgeteer N18 driver modification works in a console application.
I have replaced Cobra II Socket 6 with direct access to SPI2 and Output Pins in the G120 module and modified the Bitmap conversions to use GHI.Util. However, I could not get rid of all Gadgeteer dependencies.
Any advice how to continue to get the driver working in WPF applications?
Its getting clearer when reading excellent Programmers Heaven C# School. A stupid programmer with non-object oriented background trying to destroy my driver class
Yes, unfortunately this is getting too much time consuming for me to solve all the required changes in the driver.
I’d eventually like to start developing my GUI application instead of programming the platform, so maybe it is then the gadgeteer way with Glide.
Hello, you can check out if this article works of your black screen problem.
http:// www. windowspasswordsrecovery .com/fix-windows/black-screen-of-death.html