Monthly Archives: April 2008

Disturbing "Windows Live" Picture – Caption Competition

Standard

Windows Live — Free and familiar ways to connect and share

Am I the only one that finds this picture a bit strange? 

What is Microsoft trying to say?

Why are those people so manically happy? (Obviously to see Stripey means alot to them)

Are they Live developers that are thrilled to see at least one person is using the search engine?

I’d be interested in what you believe is going on here.  Please post a comment.

 

 

Share this post :

Advertisements

PPCFinder 1.0.0.5 released

Standard

Isn't the PPCFinder dog just the cutest?

 

About a year ago we released the freeware Pocket PC search program PPCFinder.  This program has had literally thousands of downloads subsequently with only a single release.

I’m proud to announce the first public update of the program since it’s original release.  The maintenance release 1.0.0.5.

The “backstory” of PPCFinder is a plane flight home from Sydney to Brisbane.  In the past I found the inbuilt Windows Mobile search completely inadequate.  The available freeware alternatives seemed unpleasant to use and the commercial ones seemed to be as an ajunct to filemanager functionality.    It was time to write my own….In only a few days, PPCFinder was born. 

PPCFinder is a simple program that still addresses an important need on the Windows Mobile Platform.  That is the need to find files, particularly large ones (the definition of “large” has changed since the default search application in Windows Mobile was created), in order to get extra memory.

PPCFinder gives you all the “advanced” search options available to the original Windows XP search, including the cute doggy mascot that I’m sure you find excellent.

If you need all this, give PPCFinder a go.

The full release notes for the new version are available at the forum.

If you are a fan, please leave a comment and let everyone know about it.

Share this post :

Silverlight HTTP Networking Stack

Standard

image

I found a neat article by one of the Silverlight team describing the way network calls work in xap applications.

What I find particularly interesting is the fact that the host browsers communications stack is used for HTTP communication.   This means that cookies and authentication from the current browser session are sent in these calls.

This means that composite applications that support both web and Silverlight content should work really well.

Links

Silverlight HTTP Networking Stack – Part 1 (Site of Origin Communication) at scorbs

Easy InkCanvas in Winforms for capturing signatures

Standard

image

In WPF there’s an interesting control called “InkCanvas” that can be used to capture signatures and the like in Tablet PC applications.

Recently I created a prototype for a windows forms application.  I did consider using WPF, but the overhead seemed unnecessary considering the simplicity of the requirement.

I am aware there’s a specific SDK for Tablet PC that provides winforms controls for the requirement, but I thought it might be fun to create my own.  As it turns out, it was pretty easy.

The requirement was to have a signature panel which could be used to collect a bitmap that would be attached to an entity to act as an authorisation.

Signature Panel

In the prototype I decided to create the signature panel as a standalone usercontrol called it, strangely enough “SignaturePanel”.

It uses Mousedown and MouseUp events to determine stylus pressure and mousemove for drawing.  Like the WPF control it keeps a collection of strokes internally.

Unlike the wpf control, I just decided to expose a “SignatureImage” property to allow a developer to retrieve a bitmap.  This is rendered from the strokes in realtime.

I assume it works for the Tablet PC, but I don’t know for sure.

Write your signature here

An additional feature of this control is a label which tells the user the last time the signature was last updated.  I thought the user may find this helpful.

If the user hasn’t written anything then it just reads “Write your signature here”.

The user control consists of a picturebox called “inkPanel” and a button for resetting the content:

 

What the control looks like in design time

Here’s the code:

 

Public Class SignaturePanel

    Private moCurrentWriting As New List(Of Point)
    Private moRememberInk As New List(Of List(Of Point))
    Private mbPenDown As Boolean = False
    Private Sub inkPanel_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles inkPanel.MouseDown
        mbPenDown = True
    End Sub

    Private Sub inkPanel_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles inkPanel.MouseMove
        If mbPenDown Then
            moCurrentWriting.Add(e.Location)
            mdLastSignatureUpdate = Now
            Me.Refresh()
        End If
    End Sub

    Private Sub inkPanel_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles inkPanel.MouseUp
        If moCurrentWriting.Count > 2 Then
            moRememberInk.Add(moCurrentWriting)
        End If

        moCurrentWriting = New List(Of Point)
        mbPenDown = False
    End Sub

    Private Sub inkPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles inkPanel.Paint

        mRenderSignature(e.Graphics)

        Dim lsText As String = ""
        If Not Me.DesignMode Then
            If mdLastSignatureUpdate.HasValue Then
                lsText = "Signature last updated " & Me.LastSignatureUpdate.ToLongTimeString
            End If
            e.Graphics.DrawString(lsText, Me.Font, Brushes.Black, 5, inkPanel.Height - 20)
        Else
            lsText = "... Write your signature here ..."

            e.Graphics.DrawString(lsText, Me.Font, Brushes.Black, (inkPanel.Width / 2) - (e.Graphics.MeasureString(lsText, Me.Font).Width / 2), (inkPanel.Height / 2) - (e.Graphics.MeasureString(lsText, Me.Font).Height / 2))
        End If
    End Sub
    Private Sub mRenderSignature(ByVal g As Graphics)
        Using loPen As New Pen(Color.Black)
            loPen.Width = 2
            For Each loLines As List(Of Point) In moRememberInk
                g.DrawLines(loPen, loLines.ToArray)
            Next
            If moCurrentWriting.Count > 1 Then
                g.DrawLines(loPen, moCurrentWriting.ToArray)
            End If
        End Using
    End Sub
    Private Sub cmdClearInk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClearInk.Click
        moRememberInk.Clear()
        inkPanel.Refresh()
    End Sub
    Private mdLastSignatureUpdate As Nullable(Of Date) = Nothing
    <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
    Public Property LastSignatureUpdate() As Date
        Get
            Return mdLastSignatureUpdate
        End Get
        Set(ByVal value As Date)
            mdLastSignatureUpdate = value
        End Set
    End Property

    <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
    Public ReadOnly Property SignatureImage() As Image
        Get
            Dim loBitmap As New Bitmap(Me.Width, Me.Height)
            Using loGfx As Graphics = Graphics.FromImage(loBitmap)
                mRenderSignature(loGfx)
            End Using

            Return loBitmap
        End Get
    End Property

End Class

 

If anyone’s interested in a standalone sample project, post the request to this blog and I’ll see what I can do.

Possible Uses

It may be interesting to use this code as:

  • Signature recognition
  • “Mud map” style sketching for business applications
  • A basis for a drawing program 😉

Of course, if you’re using WPF, use InkPanel.  But if you don’t want the overhead, maybe this will be the foundation of a lightweight solution.

 

Share this post :

Silverlight 2 has built in Unit Testing

Standard

image

As announced by Scott Guthrie in Mix08, and now on his blog, Silverlight 2 incorporates visual unit testing.  

One of the motivations for an MVC/MVP architecture for me is better unit testing of ui logic.  Sometimes it is very difficult to created automated visual tests for some platforms, such as Winforms. 

It appears (from the demo) that Silverlight allows pretty good testing of the actual user interface.    Probably more effective than testing ui logic with mock views.

Food for thought.  Perhaps this should affect the way we think about testing frameworks.

If you’re interested, take a look at this good (and short) video demo which gives you an overview of the whole thing:

Video walkthrough of the Silverlight 2 control unit tests – Jeff Wilcox

 

Links

Open Source automation frameworks for Winforms and other Win32 Apps

 

Share this post :