Recently I was doing a project that required a signature applet. Since silverlight has ink support it was the logical choice. However, after many hours of searching around, I couldn’t seem to figure out how to save the ink without programming in C#. So here’s a solution that can turn the ink from an InkPresenter into XAML and back into ink again.
getStrokesAsString = function(inkpresenter) {
var strokes = inkpresenter.strokes;
var buffer = "<inkpresenter .Strokes>";
for (x = 0; x < strokes.Count; x++) {
buffer += "<Stroke>" +
"<stroke .DrawingAttributes>" +
"<drawingattributes Color='#FF000000' Height='1.75' Width='1.75'/>" +
"</stroke>" +
"<stroke .StylusPoints>";
var curstroke = strokes.getItem(x);
if (curstroke) {
var sps = curstroke.StylusPoints;
for (y = 0; y < sps.Count; y++) {
buffer += "<StylusPoint X='" + sps.getItem(y).X + "' Y='" + sps.getItem(y).Y + "' />";
}
}
buffer += "</stroke>";
buffer += "";
}
buffer += "</inkpresenter>";
return buffer;
}
setStrokesFromString = function(inkpresenter, silverlightobj, strokestring) {
inkpresenter.strokes.Clear();
var allstrokes = "allstrokes";
var allstrokes = silverlightobj.content.createFromXAML(strokestring);
inkpresenter.strokes = allstrokes;
}
Sorry it’t not formatted nicely — wordpress stripped all that out.
Use the getStrokesAsString method to get a XAML string representing all the strokes; just pass it the inkpresenter element.
Use the setStrokesFromString method to transfer a XAML string representing the strokes into actual strokes on the canvas. Pass it the inkpresenter element, the silverlight object (usually window.silverLight), and the XAML stroke string.
Ever wanted to play a trick on friends or coworkers by making them think their computer has crashed? The easiest way is with my new Fake Blue Screen of Death (FBSOD). Just run it, enter a sleep time, and then wait for the Blue Screen of Death to appear.
Note: This is a beta, more features WILL be available soon Another Note: You need .NET 2.0 to run this.
Sometime soon I plan on adding an easier way to change the text, and to make the error messages look more authentic, but for now, this is a good solution. Note that the FBSOD will capture all keys and key combinations (except Ctrl+Alt+Delete), so there’s no way to exit unless you know how to use the task manager, or if you know the secret.
To exit the FBSOD, move the mouse all the way to the top of the screen and click.
To change the FBSOD text, create a file called C:\windows\bsodtext.txt
Internet Connection Monitor version 3.1 has been released.
This version includes a few minor interface changes as well as a few changes to the backend. There are now 2 new options which allow you to hide outages if they are less than a certain length (default: 30 seconds), and another which allows you to disable the notifications when the connection goes down, so the tray icon simply changes color and writes the log. Here’s a total list of changes:
Under the hood:
Better error handling
More efficient log parser
Interface Changes:
Renamed a few menu items in the log viewer so they are more descriptive
Added an option to hide the notifications when the connection goes up or down (default: show notifications)
Added an option that allows the LogViewer to hide outages if the connection is down for a negligible time (default: 30 seconds)
LogViewer automatically scrolls to the end of the file
LogViewer will now open plaintext files in the viewer rather than trying to parse them out (which adds support for version 2 logs)
Just released:
Internet Connection Monitor version 3.0
Most of you have never heard of this, but it’s been a project of mine for the past 2 years, although I haven’t really actively been updating it. Just a brief history:
This was created to monitor my internet connection because it frequently cuts out for long periods of time. I needed something to show my ISP to prove to them that the service kept dropping. For this, I created a simple BASH script that would ping our ip every x seconds, and wrote a log of outages. This system was extremely limited, however, so about 6 months later, I wrote a Python version. Still, this version was buggy and inadequate. So now I release version 3.0.
It is written in C# and:
Puts an icon in the system tray that shows the current status of the connection (red for down, green for up)
Shows balloon tips when the connection drops or comes back up
Options for changing polling interval, port, server, and where to save the logfiles
A logfile viewer that parses the logfiles and tells you how long the connection was down
FilePurge: Recursively search (supports regular expression search) a directory for files that match a regular expression. Then it gives you the option to delete or rename the files. Requires .NET 2.0
If you are familiar with the AnAppADay project (http://www.anappaday.com’) you have probably heard of Jedi’s “Jedi Concentrate” app (Day 10: Jedi Concentrate). 2 hours after its release, I released a version with options for setting the opacity and fade speed.
UPDATE: Added Option for picking fade color (9/26/2006)