A little missing...

Aug 4, 2010 at 3:21 PM

Hello Joshua,

first of all grat job and great book! Keep up the good work!

I noticed a little missing while I was studying your code:

in "SurfaceTouchDevice.cs" ContactUp event the contact is never removed from the dictionary.

private static void ContactUp(object sender, ContactEventArgs e)
        {
            int id = e.Contact.Id;
            if (!deviceDictionary.Keys.Contains(id))
            {
                ContactDown(sender, e);
            }
            SurfaceTouchDevice device = deviceDictionary[id];

            if (device != null &&
                device.IsActive)
            {
                device.ReportUp();
                device.Deactivate();
            }
        }

I think that it would be better:

                device.ReportUp();
                device.Deactivate();

                deviceDictionary.Remove(id);

Regards

Coordinator
Aug 4, 2010 at 6:11 PM

Nanus,

Thanks!

You're right, I never remove the device from the dictionary. I'll update it and include in my next commit.

Thanks,

Josh

Coordinator
Aug 4, 2010 at 6:12 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Sep 17, 2010 at 1:03 AM

Catching up on closing work items, this issue was fixed in changeset 65688.