My Software Studio

Moving Back To ASP.NET (For now…)

I’ve been busy with converting PJB.Janus and PJB.Vulcan to WPF the past few months and in-between work, study and life it’s been quite a drawn-out process and I wish I could have some cloned versions of me take care of those various aspects so I can actually get to accomplishing more but, at least as far as work and PJB.Janus goes things are looking good.

Work has gotten to a point where if all the planets fall in line I may just lead the project I have been wanting to tackle for YEARS!!!  It involves a great deal of what I’ve been interested in and developing on the side except now I’ll actually get paid to do it.  Watch this space for more feedback.

PJB.Janus has reached a point of finality and I’ve gotten quite far in making PJB.Vulcan run inside it.  Still… I’m not so sure that I’m enjoying working with WPF.  Maybe the added freedom is just too much.  When I create a tree control I just want it to work and not worry about the fact that I can make it look any way I want to.  Frankly, I care less about the look and feel than I do about simply checking the Checked property and having check-boxes appear than digging through code project to figure out how to do it through templates etc.

I think when I have the Screen Builder for PJB.Vulcan done I’ll look at WPF again but from the perspective of simply generating the UI code rather than having to hand-craft it.

I’ve decided to stop maintaining the project on CodePlex, at the moment it’s just myself working on it and what I’d rather do is just do a release here whenever something changes which will also MAKE me focus on more tutorials and documentation.

Now, where does the ASP.Net fit in?  Well, I was building a reservation system for a friend of mine when another friend of mine indicated the need for the same kind of app only they needed theirs online.  So, the logical step would be to develop a Web-based version and supply the same app to both people one running on the web and one as an intranet site.

I haven’t done any web development for about four years now so I am rusty but at least I’ve conquered splitter bars that allows my navigation tree to be sizable to the left and right. 

Another motivation, other than that the app can actually go places is that it gives me a good indication as to what I’ll need to build as far as my APS.Net compiler for PJB.Vulcan goes.  It’s so much easier to build an application generator with a working model than to simply build bits and pieces and hack together a test app.

June 26, 2008 Posted by pjbadenhorst | A Slice of Life | | No Comments

Loading Skins in WPF (Part 1)

Skinning an application used to be something that was quite tedious if done manually and usually ended up in the domain of 3rd party developers who could validate the investment in time and effort.  With WPF managing skins isn’t as difficult as it once was because…

Read more »

May 26, 2008 Posted by pjbadenhorst | Janus, WPF | , , , , , , , , | 2 Comments

Where you go to when you want to learn how to develop using WPF

If, like me, you want to learn how to develop using Windows Presentation Foundation for your user interfaces you’ll find that it’s more like a learning cliff than a curve. My two biggest stumbling blocks are:

  • My experience with WinForms.
  • Lack of tools to just make things happen.

Prior experience.

Josh Smith explained this point eloquently in his article “Why use WPF if it is not RAD yet” by stating:

For those of us who approach WPF with a strong background in Windows Forms, however, you are pretty much required to remove your brain from your skull, rotate it 180 degrees, and put it back in.

RAD Tools

The hard-core WPF guru’s who can pump out markup with their eyes closed will probably scoff at the idea but, I do sometimes find it easier to learn how to do something by looking at how the generated markup looks for a simple solution. It gives you a frame of reference to start learning and extending from. A lot of the work that needs to get done in XML does seem a bit tedious and overwhelming.

Now what?

Neither one of these challenges are insurmountable it just takes some time and effort. A bit of patience to unlearn some things that have become reflex and knowing that working with the markup directly rather than depending on RAD tools will, in the end, give me a much better understanding of WPF. Until then let’s get to the good stuff that can make the journey a little smoother.

Blogs

Blogs are your friends. Keeping an eye on them will help keep you up to speed on things that you may need to know but didn’t know you had to ask about. Some of my favourites are:

Josh Smith on WPF. His blog is chock full up WPF articles, examples, tips, apps, you name it.

Learn WPF. I mainly use this site as the source for my free stuff. It was from here that I discovered Inkscape a free graphics application which can be used in conjunction with ViewerSVG to create and import .svg files into my applications as xaml. Apparently Inkscape will get a xaml export but till then ViewerSVG does a good job.

Designer WPF. Lots of articles here.

Clip Art

It won’t take you long to realise that using bitmap images is not as cool as it used to be. For menus and tree views it my still cut it but now that we can go big vector graphics are the way to go. The problem being that I just don’t have the time to spend drawing nice ones.

Check out Open Clip Art Library. all the files have bot a .png and .svg version available for download which in conjunction with ViewerSVG gives you a seamless solution to getting some nice images into your apps.

Code Project

If you don’t know about Code Project then go there now. Yes, right now. Click here.

Among all the WPF samples and articles you’ll find this gem:

Sacha Barber’s very helpful 5-part newbie guide to WPF:

WPF: A Beginner’s Guide - Part 1 of n
An introduction into the WPF layout system

WPF : A Beginners guide part 2 of n
An introduction into XAML / code and WPF resources

WPF : A Beginners guide part 3 of n
An introduction into RoutedEvents / RoutedCommands

WPF: A Beginner’s Guide - Part 4 of n
An introduction into WPF Dependancy Properties

WPF: A Beginner’s Guide - Part 5 of n
An introduction into WPF Databinding

WPF: A Beginner’s Guide - Part 6 of n
An introduction into WPF Styles And Templates

And the rest?

There are lots more good resources out there but I’ll sign off with these and hopefully you’ll leave any of your favourites that weren’t mentioned here as comments to this post.

April 24, 2008 Posted by pjbadenhorst | WPF | , , , , , , , , | 2 Comments

Technology may help alleviate the dwang Eskom & the South African Government collectiveley dropped us in.

Just when you thought that things couldn’t get any worse and that you seriously have to consider counseling to deal with the unspeakable emotions that the ROLLING BLACKOUTS aka Load Shedding are bringing to the surface of what used to be a tranquil mind, technology comes to the party and makes things better.

If you don’t know yet, since January this year South Africans have been made painfully and abruptly aware that along with all the other uncertainties they have to deal with they can also no longer depend on electricity supply. The only provider of electricity, the para-statal named ESKOM has apparently collapsed because it was more profitable not to buy coal and maintain power stations and that actually providing electricity, their one product is really not a priority.

That was a really simplistic way of looking at the problem and all parties involved have taken the now deeply entrenched South African way of dealing with adversity - blame someone else. Do a Google search if you’d like to see more about Eskom’s darkest hour and who blames who.

For us on the ground the end of that story is that as usual we can do nothing about it and we have rolling blackouts that has not only turned traffic which was hell into something worse, disrupted industry but has also ensured that the Australian Job Expo was sold out months before the event. So, while we evaluate our options abroad here is something to help deal with the crisis.

You can download an energy monitor from myenergy.co.za. It’s a little app that runs in the Notification Area of your Taskbar. You can add your suburb to the list and it’ll make sure you have the latest rolling blackout schedule.

The app also allows you to execute commands and so on when a rolling blackout is imminent but sadly this is useless functionality because, and I apologise for the profanity that is about to follow, the dumb fucks in charge of the power switches can’t fucking read a schedule and are pretty much switching power on and off at random.

April 23, 2008 Posted by pjbadenhorst | A Slice of Life | , , , , , , | No Comments

A new take on coding standards…

“Do they have much in the line of coding conventions?”

“No, all they told me to do was to change all the upper case characters of my public variables to lower case.”

“What!?  They want public variable names to be all lower case!?”

“Yes, apparently they don’t like upper-case characters here.”

April 7, 2008 Posted by pjbadenhorst | That's what they said! | | No Comments

What I’ve been up to…

For the past couple of weeks this blog has been pretty dead.  Hopefully things are going to work out in such a way that I’ll be able to post a bit more but till then here is the quick and dirty.

PJB.* Open Source Projects.

I have created three projects on CodePlex named: PJB.Janus, PJB.Vulcan and PJB.Valkyrie. As far as the projects themselves go I haven’t spent a lot of time updating them but I have been spending a great deal of time with the conversion of WinForms to WPF.

My strategy has been to take the WinForms version of PJB.Vulcan and turn it into a WPF application hosted in the PJB.Janus framework.  This has not only fast-tracked my understanding of WPF but has also given me a chance to do a lot of re-factoring where it was needed.

Work-wise

For the next two months I am not going to be working at my regular offices.  Which means that I have limited Internet access, pretty much what I’m able to squeeze in at night while I’m studying, making sure I remain married, working on PJB.* and so on.

However, I do have a brand new bad software joke in the next post…

April 7, 2008 Posted by pjbadenhorst | A Slice of Life | | No Comments

PJB.Janus - Tutorial 2: Adding your own splash screen

To use this tutorial you need: [Release 2008-03-09 of the PJB.Janus project which you can find on CodePlex]

Building from the solution we have created in Tutorial 1 we’ll continue to add the splash window of our application.

Before we continue with the implementation of the splash window let’s first deal with cases where you do not want a splash window. Simply set the UseSplashWindow property of the StartupInfo object to false:

startupInfo.UseSplashWindow = false;

In the Application_Startup method type the following code:


StartupInfo startupInfo = new StartupInfo();

BitmapImage bitmapImage = new BitmapImage(new Uri(@”/Images/tutorialsplash.png”, UriKind.Relative));

startupInfo.BitmapResourceDictionary = new Dictionary();
startupInfo.BitmapResourceDictionary.Add(”SplashWindow”, (BitmapSource)bitmapImage);
startupInfo.SplashWindowImageResourceKey = “SplashWindow”;
startupInfo.SplashWindowLabel = “The application version number could go here!”;

ShellController.Instance.Start(startupInfo);

Going through the code you can see that we are, firstly, instantiating a startupInfo object. After that we are retrieving the image file which has been embedded into the application. We instantiate the BitmapResourceDictionary which will hold all of the images we need to pass to our ShellController. The images are added to the dictionary. In this case there is only the one but this would be the place where all other image resource could be added.

The SplashWindowImageResourceKey is set to let the ShellController know which image resource to use since there could potentially be a large number of them. The final touch is the SplashWindowLabel which is simply a static text message that will be displayed on the footer of the SplashWindow.

We start the application by passing the startupInfo to the ShellController.

March 9, 2008 Posted by pjbadenhorst | Janus, WPF | , , | No Comments

PJB.Janus-Tutorial 1: Setting up the Application.

To use this tutorial you need: [Release 2008-03-09 of the PJB.Janus project which you can find on CodePlex]

The first step in building a Janus Application is the creation of a startup project. You could use the default PJB.Janus.Wpf.StartUp.exe and simply change the configuration file but that doesn’t allow you to change some of the resource files included in that app. It’s much easier to create your own project and be able to take advantage of the Built-in One-click install and so on.

In order to use the framework, you need to build a WPF Application project, reference the Shell dll and call the start method on the

Step 1: Create a new WPF Application project.

tutorial1_image001.jpg

Step 2: Add the required references.
You’ll need to add references to both PJB.Janus.Wpf.Shell.dll and PJB.Janus.Wpf.Shared.dll

tutorial1_image002.jpg

Step 3: Delete the Window1.xaml Window definition.
Step 4: Modify the App.xaml file.

When you open the default App.xaml file it will look like this:

<Application x:Class=”Tutorial1.App”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
StartupUri=”Window1.xaml”>
<Application.Resources>
</Application.Resources>
</Application>

The StartupUri property should be changed to Startup which allows us to attach an event handler. After editing it should look like this:

<Application x:Class=”Tutorial1.App”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
Startup=”Application_Startup”>
<Application.Resources>
</Application.Resources>
</Application>

Step 5: Call the Start Method of the ShellController.

Edit the code behind the App.xaml file:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;


namespace Tutorial1
{

    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            PJB.Janus.Wpf.Shell.ShellController.Instance.Start();
        }
    }
}

Step 6: Run the app.

When the app starts you will see the blank splash window anf after about five seconds the default host form will appear. Because we haven’t included a configuration file nor did we reference any modules the app doesn’t do much but from here the overhead work to building a composite application is mainly configuration.

tutorial1_image003.jpg

March 9, 2008 Posted by pjbadenhorst | Janus, WPF | , , | No Comments

Going? Going? Going?

“Where THE HELL do you think you’re going? You think your work here is done? I don’t think so!” - Russel

March 7, 2008 Posted by pjbadenhorst | That's what they said! | | No Comments

PJB.Janus on CodePlex

The CodePlex project for PJB.Janus (WPF Edition) has been published! For the next few days I’ll be posting tutorials, documentation and making some breaking changes to the code.

March 3, 2008 Posted by pjbadenhorst | Janus, WPF | | No Comments