.NET Client Profile + WPF = Superb Apps

For those of you that have been asking where is Marlon? “Why did he stop blogging for these past 3 weeks?”
Well I’ve been really really busy packaging 2 new hot products. I currently work at Uniblue Systems where we develop system utilities that help you keep you PC healthy and clean. I have been working at Uniblue for 2 years but never in these 2 years I was excited as I am today. We released our first 2 products using WPF, packaged with .NET Framework Client Profile.

.NET Framework Client Profile is really superb, it enables us at Uniblue to distribute our products to the end user in a fast and easy way. Before .NET Client Profile, it was very hard for companies such as Uniblue to ship software with .NET Framework because the download of the framework alone is massive. Our customers hate to wait ( don’t yours? ). With .NET Client Profile the download + installation is really fast and that’s why our customers love it!

Client Profile not only installs the basic .NET Framework components, but it installs .NET 3.5 SP1 (Client Only) which means you get all the WPF goodness + all new super stuff that .NET 3.5 SP1 provides. So yea we can also go crazy with user interfaces!  If you want to check out one of our new products (developed fully with WPF) check it out here …. please submit as many feedback as possible… I can’t wait to see what you think ….

 

SUMP 

Showing a notification Window(like msn) in WPF

I was playing around creating a notification window just like the one of MSN with WPF and I found a problem. In order the place the window in the Bottom, Right corner of the screen I tried to do the following

   1: Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width
   2: Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height

 

The window was not showing up on screen and I got confused. After some thinking I realized that the problem was that WPF uses DPI while the other measurement was in Pixels. In order to set the correct location we must convert the Screen.Primary.WorkingArea.Width and Height which is in Pixels to DPI. The question is HOW?

I found a good post on the forums that helped me a lot here. In order to convert the Screen.Primary.WorkingArea.Width and Height and fix the Top and Left of the window to be the Bottom, Right corner we have to do the following

   1: Loaded +=
   2:         delegate
   3:         {
   4:             PresentationSource source = PresentationSource.FromVisual(this);
   5:  
   6:             if (source != null)
   7:             {
   8:                 Left = (Screen.PrimaryScreen.WorkingArea.Width * source.CompositionTarget.TransformFromDevice.M11) - Width;
   9:                 Top = (Screen.PrimaryScreen.WorkingArea.Height * source.CompositionTarget.TransformFromDevice.M11) - Height;
  10:             }
  11:         };

 

one of the questions you might be asking yourself would be;

Why is he doing it in the Loaded Event of the Window?
Basically PresentationSource.FromVisual will return null if the Window is not shown yet.

 

I hope this helps ….

ClickOnce installer when the server does not have FrontPage Server Extensions

Let me start by saying that I am NOT a ClickOnce expert, yet today I encountered a problem and thought of sharing with you guys my experience. So I was deploying a ClickOnce installer on a server and when I clicked “Publish Now”, I got an error saying “….The Web server does not appear to have FrontPage Server Extensions installed……”.

The first thing I tried was to change the “Publish Folder Location” to my local IIS (localhost) which worked fine on my machine, yet when I tried the ClickOnce installer on another machine it did not work because setup.exe was trying to connect to my machine to download the *.application file. After some research I found out that you can publish the ClickOnce to a location and instruct it to do download from another location. In order to do this you have to put the URL of the live server in the “Installation Folder URL” textbox which is located below the “Publishing Folder Location” textbox (as shown in the image below).

To summarize you can put in 2 different URL, where to Publish the ClickOnce and where the ClickOnce will be actually downloaded from. In my case I set the “Publishing Folder Location” to the localhost (that had IIS) and set the “Installation Folder URL” to the actual server URL (the one that the clients would be using to download the actual installer). Then once I am happy I just upload the files from the localhost to the actual live server, and everything just works 🙂

clickonce

 

Hope this helps….