I’m about to release my own take on coroutines, and as a complementary app, I created a very simple sample that lets developers (hopefully) experience the fundamental behavioral difference of returning a sequence of values through the yield keyword.
There’s a lot of great material that can be read about iterator blocks (Google is your friend), and I’m not planning to add another article on top of that. So, stop reading and:
- Download the sample (VS2010).
- Quickly glance at the few lines in the code-behind of the window.
- Run the app.
- Bow in front of the power of iterators 😉
Download Sample Application
I finally got round to implement on-the-fly text formatting for Sketchables, which will allow you to define text formatting while typing (similar to wikis or forum posts). Sketchables will parse such strings and format them on the fly for you:
the star renders *bold* text
I didn’t rely on regular expressions here, but wrote a simple forwarding parser to process markup text. As it makes a pretty neat tool, I extracted it into a little sample app that shows a possible use for it. The presented implementation just creates nested text blocks, but you should be able to easily adjust it to your needs.
Latest Update: 2010.11.07 – Fixed issue with single character chunks.
Download Sample Application
The blog (and myself) has been dormant a while – I’ve been literally working my *** off (doing over 600 hours in just two months isn’t too healthy) and have rewarded myself by travelling the US for three weeks. However, I’m back in Switzerland now and will try to reply to pending posts and questions asap (read: once I get rid of my current sleep deprivation), along with an update on Sketchables.
I wanted to officially release Sketchables weeks ago, but business just got in the way – and it turned out that my plan to just working at night / on weekends didn’t work either because, well, business got in the way there, too.
However, my deadline ends in little more than a week (and I’ll have quite some time at my hands in August), so I’ll be able to finally package Sketchables, record some more videos, and of course add a few goodies. For now, I’ve prepared a preview release of the package which already works quite solid:
If you compare this package to the contents in the YouTube video, the most prominent addition is built-in navigation support which gives you point-and-click navigation, and allows you to trigger other actions for a Sketchable’s items:
(Click on screenshot to show in full size)
As always, critical feedback is appreciated – happy sketching! 🙂
SketchFlow is a great addition to Blend, but I was missing the ability to create quick mockups of user interfaces. I’m a huge fan of productivity tools such as Balsamiq, and I was sorely missing its ease and speed in SketchFlow.
Meet Sketchables. Sketchables is a simple framework complemented by a set of controls that allow you to quickly create common controls in a matter of seconds. Here’s a screenshot from one of the samples, which was created in just a few minutes:
…and here’s a complementary recording that shows how the above mockup was created:
Sketchables will be free software, requires Blend 4 RTM and fully supports both WPF and Silverlight SketchFlow projects. Version 1.0 is approaching completion, so I hope I’ll be able to release it as soon as Blend 4 goes live.
Still time for you to slip in some last-minute feature requests though 😉
Up until now, I’ve dealt with temporary data in my .NET applications using local files and FileInfo instances. This worked just fine – until I needed a solution that works under both .NET and Silverlight.
The problem: In Silverlight, you can’t just create a temporary file on the file system for security reasons. Instead, there’s the concept of isolated storage that provides you with the means to store data in files and directories. The API is very similar to working with the local file system, but it doesn’t use the FileInfo class. As a result, I needed to get rid of the (proprietary) concept of FileInfo in my temporary file handling and came up with a simple yet generic solution.
Download Sample Project
Here’s a sample usage of the API. This code transparently creates temporary storage, and works in both .NET and Silverlight:
private void Foo(ITempStreamFactory factory)
using (Stream stream = factory.CreateTempStream())
//write to the stream, read from it
//once we get outside the "using" block, temporary data has been discarded
The snippet above relies on a factory of type ITempStreamFactory that returns a simple Stream instance. I do not need to know anything about this returned stream – it’s the factory’s responsibility to return a Stream instance that will clean up after itself once it is being disposed.