There's no need to be scared of this dentist chair...

There's something oddly appealing about this project. It's a simple project, no major magic, super-duper new feature, bleeding edge library, etc, etc. But it's still kind of fun to play with and not something you see every day.

Dental Chair Automation in WPF

Introduction

This is an article which explains briefly how to automate any device or equipment by taking a dental chair into consideration. My aim here is to give an overview of how WPF and C# can be ultimately used in the graphical designing and presentation of any automated projects.

Requirements

To run the project, you require the following:

  • Visual Studio 2008 OR
  • Expression Blend 4

Background

Suddenly, an idea bubbled in my mind about using WPF in the automation projects. Then, I started to think about the kind of device that can be better automated. So I thought of using Dental chair as the equipment to automate. This project requires little use of artistic skills to design the objects required for the presentation. You need to make a list of the activities that your device should perform and then proceed to design the graphic objects. So it will be appropriate for you to use it better without much modifications. The project presents how transformation objects in WPF can be used better for the presentation and the automation process.

SNAGHTML14200a36

DentalChair1

See what I mean about something you don't see every day? Tongue Out

The code is simple, straight forward and easy to follow.

private void LightPipe_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
     //Capture the previous mouse point to decide whether to move up or down
     previousheight = height;
     //Capture the mouse movement at that point
     MouseDevice d = e.MouseDevice;
     Point p = d.GetPosition(this);
     height = p.Y;     //Check whether the left button of the mouse is pressed or not.
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         //Check if the angle less than 25 to limit the rotation
         if (lightHandleangle < 25)
         {
             //If previous mouse point is greater than current
             if (previousheight >= height)
             {
                 //Increment the angle by 1.
                 lightHandleangle += 1;
                 //Assign the angle to the rotate transform object
                 lightHandleRotate.Angle = lightHandleangle;
                 //Assign the x and y axis to 0
                 lightHandleRotate.CenterX = 0;
                 lightHandleRotate.CenterY = 0;
                 //Assign the rotate trans object to handle to transform to that angle specified.
                 LightHandle.RenderTransform = lightHandleRotate;
             }
             //Perform the check to see if previous is less than current mouse position to move the light handle down and above the minmum height.
             if (previousheight <= height && previousheight != 0 && lightHandleangle > -15)
             {
                 //Decrement the angle by 1
                 lightHandleangle -= 1;
                 lightHandleRotate.Angle = lightHandleangle;
                 lightHandleRotate.CenterX = 0;
                 lightHandleRotate.CenterY = 0;
                 LightHandle.RenderTransform = lightHandleRotate;
                 return;
             }
         }
             //Check if the angle is greater then the minimum height that is -15(downwards)
         else
         {
             if (lightHandleangle > -15)
             {
                 if (previousheight <= height && previousheight != 0)
                 {
                     lightHandleangle -= 1;
                     lightHandleRotate.Angle = lightHandleangle;
                     lightHandleRotate.CenterX = 0;
                     lightHandleRotate.CenterY = 0;
                     LightHandle.RenderTransform = lightHandleRotate;
                     return;
                 }
             }
         }     }
}

So while this might not be something you'll use everyday, it might spark some UI ideas or just let you play with the dentist chair like you've always wanted too... Smiley

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.