A prototype WPF/Silverlight layout designer

I’ve been thinking recently about how would I write a WPF UI designer that would specifically highlight the new WPF layout paradigm, and not try to mimic the old WinForms paradigm. The old VB6/WinForms designer was built around absolute positioning. It allowed for rapid WYSIWYG prototyping of interfaces, and the Dock/Anchor functionality provided a relatively…

14

How to live forever (if you’re a CLR object)

Just subscribe to a static event, or an event of a long-lived object (such as a singleton instance). That long lived object will keep alive all objects that subscribed to any of its events (including you).

2

Updated C# all-in-one file

Thanks to everyone who came up with suggestions on my Did I miss any C# syntax construct? post. The updated file is below. #error Error message#warning Warning message#pragma warning disable 414, 3021#pragma warning restore 3021#line 6#line 2 “test.cs”#line default#line hidden#define foo#if foo#else#endif#undef foo extern alias Foo; using System;using System.Collections.Generic;using System.Linq;using System.Linq.Expressions;using System.Text;using M = System.Math; #if DEBUG…

22

Did I miss any C# syntax construct?

Dear readers, I’m asking for your valuable input again. I went through some of our test files and combined a single “all-in-one” C# syntax file that I want to contain all C# 4.0 constructs. I’m specifically not looking for combinations (because there’s an infinite number, obviously), it’s enough to just mention each syntax construct once….

14

Interview answers

In the previous post, I’ve come up with this interview question: In a given .NET string, assume there are line breaks in standard \r\n form (basically Environment.NewLine). Write a method that inserts a space between two consecutive line breaks to separate any two line breaks from each other. Update: Rik Hemsley has posted an absolutely…

8

Interview question

Here’s a nice simple interview question: In a given .NET string, assume there are line breaks in standard \r\n form (basically Environment.NewLine). Write a method that inserts a space between two consecutive line breaks to separate any two line breaks from each other. Also, anyone venture a guess what is a practical application for such…

47

A million-dollar pen vs. a pencil

You know this legend about how NASA spent millions to develop a pen that can write in zero gravity, and the russians have just used a pencil? Well, I was reminded about this by Dejan’s post in response to my post about the Random Gradient Wallpaper Generator. I used an O(NxN) algorithm to generate a…

5

Bezier Curves and Car Manufacturers

Michael has asked me if it was possible to add Bezier curves to Live Geometry. So I went ahead and added a Bezier tool (and it took me about 30 minutes to do so!): This draws a cubic Bezier curve using four points: There is something beautiful and elegant about these curves. No wonder industrial…

3

Irony

(Ironically, this post is not about irony in it’s traditional sense) Irony (http://irony.codeplex.com) is an open-source .NET compiler construction framework written by Roman Ivantsov. It is a “.NET Language Implementation Toolkit”. The language grammar is described in C# (or any other .NET language). So instead of generating the scanner and the parser from a grammar…

7

Saving images (.bmp, .png, etc) in WPF/Silverlight

I’ve recently added a new feature to Live Geometry that allows users to save the current drawing as a bitmap or a .png file. Just push the save button and pick the desired image format in the Save dialog: Fortunately, both WPF and Silverlight support saving full visual contents of any visual into a file…

10