Mixing Concrete

From this site:

A very simple and easy way to remember a popular concrete formula is the 1:2:3 ratio. What this means is one part cement, two parts sand and three parts gravel. Once you become efficient at estimating how much cement you need for a project you can simply multiply these ratios to save time.


ICommand – there is a very good if somewhat old (so what?) step through of the principles and possible implementations on MSDN.


Trying it out on a Visual Studio App template:


This btw could be useful for MVVM stuff:


Back to the app – I really want to set up my own INPC/Observable Collection/ICommand implementation/template that I can apply to a new project and have something running within say 30 minutes. Back to the app, I said…

The generated solution gives you not a lot:


Except that StandardStyles.xaml is massive and worthy of some investigation. Create a folder and the helper class to implement ICommand (should be in its own folder or project, but anyway):


The stubbed implementation of ICommand, waiting for stuff:



Trying a naive implementation of the Execute method…


, I forgot that it is an interface – it expects an object as a parameter to Execute:



Time for bed. More tomorrow maybe – it sometimes amazes me that I do a 12 hour day at the office, and I come home, and I want to do more. Actually it’s different. Someone do the dishes for me? Thought not. BTW those people who are following me… Thanks! 🙂 I’m trying to get more of a mix of stuff, i.e. stuff not related to IT, onto the pages.. but not trying hard enough. You guys will be shocked in a good way when you say what I’ve been doing to Bamboo! No, not Wacom, I mean bamboo:


It looks alien, like Alien. But it has no answer to this…


(Cue Evil laugh.)

So accepting that this doesn’t even work:

public class SimpleCommand : ICommand {
		public bool CanExecute(object parameter) {
			throw new NotImplementedException();

		public void Execute<T>(Action<T> parameter) {
			throw new NotImplementedException();

		public event EventHandler CanExecuteChanged;

… let’s bring it back to something that at least does work. I’m creating a Console application now, set that as the startup project, reference the SimpleCommand class, and run it:

Hm, no you don’t apparently:


Hm, can’t immediately see why a  console app cannot use a reference to a Windows App. Let’s dispense with that approach then, and plug it all into a console app.


Just 2 bits then. The implementation of ICommand:




, and the program to run:


namespace ConsoleApplication1 {
	using System;
	using System.Windows.Input;

	public class SimpleCommand : ICommand {
		public bool CanExecute(object parameter) {
			if (parameter != null) {
				Console.WriteLine("[CanExecute:] Yes, you can execute)");
				return true;
			Console.WriteLine("[CanExecute:] No, you will not execute");
			return false;

		public void Execute(object action) {
			Console.WriteLine("[Execute:] [action] was [{0}]. Can I execute?", action != null ? "Not null" : "null");

			if (CanExecute(action)) {
				Console.WriteLine("[Execute:] Oh good. Apparently, I can Execute.");
			Console.WriteLine("[Execute:] Bother. Apparently, I cannot Execute.");

		public event EventHandler CanExecuteChanged;

using System;

namespace ConsoleApplication1 {
	public class Program {
		private static void Main(string[] args) {

		private static void ClickIt() {
			var o = new object();
			var simpleCommand = new SimpleCommand();



Time for a part 2, I think…