ARHT Update

Not dead, despite what many may wish. Been sick and rather busy.

Work on ARHT has been fragmented, and squeezed into gaps when I’m not working on DIVA. It is largely functional in terms of what it needs to do; only major missing component is the library, which I’m hoping to work on tonight.

I did create an installer for it using InstallShield light, but have had all sorts of issues with the results. I made some changes to include the “private” SQL CE 4 binaries, so it can run without need it explicitly installed. I was finding that it was including a reference to a different version of EntityFramework.dll though. Didn’t have time to check what version were being included, so just hard copied over the one from the build directory. Also been hit and miss as to if it actually works on a machine. Tried it on a very non-dev laptop, and nothing happened, but it worked fine on the machine it’s being built for. I have a suspicion it’s still problems with SQL CE dependancies, but for now it works.

ARHT Day 6

Been a few days since I’ve been able to work on this, but I’ve done a few hours today.

I’ve added a command binding system to by ViewModelBase class, which works with RoutedCommands. I’ve set it up so that CanExecute can be bound easily to a property, so it makes buttons automatically enable/disable based on their state.

Missions are validating and being inserted to the DB. I’ve decided to just use a ListBox for the list of cameras remaining to import at this stage. The spec only allows for each camera to be imported once per mission, so I just nuke the camera from the collection once I’ve got it.

I’ve designed a structure for keeping track of what has been imported already for the mission, which I’m also using to track the import starts (files retrieved, remaining, etc). Most of the code for that is in place, as well as a BackgroundWorker for handling the import. I don’t think I’m going to bother with a byte by byte progress bar, just blocks of each file size. Cancel will be implemented at the start of foreach(file) loop, that way I know I have a complete file, and there’s something still there worth canceling.

Biggest debate was the UI for the import progress dialog. I’ve gone really simple for now. Once I’ve got VLC previews in the library system, I might add them to the import screen.

ARHT Day 5

Sounds like I’ve got more time than I expected on this project. It’s going to be at least a month until the cameras are mounted to the helicopters. I’ve got a large chunk of work to do on DIVA ASAP too, so that’ll take priority this weekend. I’d still like to get ARHT done this weekend too if possible.

I’m playing with displaying validation messages based on a ListBox SelectedItem. Looks like it’ll just work, but it needs to look half pretty.  Not sure if I’m going to style this properly or not.  The clients are getting screenshots, so I don’t want to make it look drastically different at the last moment.

I’d like to get validation from the EF models sorted tonight, so that the error messages aren’t there by default. You also have to lose focus on a control before the validation updates.  Maybe TwoWay binding will solve that?

Update 21:20

Setting the binding to UpdateSourceTrigger=PropertyChanged makes the validation update in real time. I might just live with the errors being initially shown for now.

<TextBox x:Name="txtDescription"
    Text="{Binding Mission.Description,
        UpdateSourceTrigger=PropertyChanged,
        ValidatesOnDataErrors=True}" />

Lozol

ARHT Day 4

Not much work tonight. I’ve setup the EF model for a Mission, and built an Import view model. Got pretty much all the Mission fields linked.

I’m having some weird issues where the validation errors are displayed before I do anything. I probably need to modify my error tracking on the models to see if anything has actually changed. Sounds like a good excuse to build that base class.

Had an expected database issue once I’d added the Mission model to the DbSet. Migrations would be the way to go, but it was easier just to nuke the DB in the debug directory for now. Since I’m using Code-First, I don’t have a DB in my solution.  Not sure how well migrations would work without that.

ARHT Day 3

I’ve been away the last two days, so no work as been done on the project. The last day was interrupted by Monaco F1 free practice :)

I now have the project all set up with Prism, and integrated with my default set of libraries, including Ninject for the DI.

The plan for today is to get SQL CE 4 running with EF Code First, and get the aircraft manager in place. If this goes well (unlikely), then I’d like to get the mission builder built, validating, and create the DB records to match.

Another thing I might implement is a modification of something I currently do as standard.  I have an IConfiguration interface, and two classes which implement it, one using the NINI library, and the other using a set of database tables which are part of my default data set. I inject one of the two implementations based on the application type.  I usually keep a flag in the config marking that initial setup has been completed. If not, then the user is forced to complete the setup when the app runs.
I might modify this, so that rather than keeping a flag, I validate the config every time on load. If anything fails validation, I can then display the config screen.
As well as automatically testing for anyone breaking the config, it also allows me to add new config options in the future, which require a value. There’s usually a default value for each option, but I feel it’s better to prompt them for it. I recently added default email settings to Fusion (my core web interface), so prompting for a default sending address is ideal.

Update: 12:38

This is going much better than expected. Everything is just binding. Reminds me again how awesome the Microsoft stack is right now. I’ve used my ISession interface and created a custom EF repository for this project which is getting DI’d.  Going to add a set of fields for adding a new aircraft now and see how that works.

Update 16:19

I’ve got that all working. I also managed to get the EF validation attributes working in WPF, which will be nice for DIVA one day. I’ve hacked it in explicitly to the model for now, but I’ll write a base class for it one day.

Starting to get the hang of WPF/XAML. Got lots of data triggers on buttons and controls now, changing text and visibility.  It really makes a lot of sense when it finally clicks.

ARHT Day 2

I’m not going to use Caliburn Micro.

It looks very nice and all, and I plan on migrating DIVA2 applications to it, but I don’t have time, patience, or ability for the learning curve at the moment.

I’ll throw in a Nuget reference to Prism, and stick with what I (half) know. I’ve also had the realisation that I’ve never displayed Entity Framework models in a WPF application before, only data from REST calls. I’m not expecting it to be majorly different, though I’m not sure how the save calls to the dbcontext are going to be integrated.

I’m certainly not going to look at another ORM at this point.

The plan tonight is to get a basic config tab up and running, and maybe get the aircraft manager working between EF and WPF.

Two Week Project

I’ve had a quick project pop up, which I’m going to try and post updates about daily as I work on it.

Basically the Auckland Rescue Helicopter Trust (or the Westpac Rescue Helicopter), have a system of minicams on their helicopters. The crews manually copy the recorded files after each mission. We’re going to try and make that process a little bit easier for them.

The goal is to streamline the import system, ensure all the data is imported, and keep a library for archiving purposes. The footage is also often used in reality television programs such as Rescue One, so we’re going to build in an export system as well.

I’ve decided to go with WPF, for forwards styling compatibility, plus I now like using the the MVVM methodology. I’m currently using Prism with the DIVA2 Windows Client, but I’ve always thought it “smelt” bad.  A tweeted a few people I know who have been using WPF (thanks @kiwipom!), and they’ve recommended Caliburn Micro as a much better starting place.

@kiwipom “+1 for the ultimate troll! Prism, indeed….”

So it appears I’ve fallen into my old trap of having to do something easy and deciding to use something I’ve never used before.

Should be fun!