private void connectToSmartboard()
        {
            try
            {
                Sbsdk = new SBSDKBaseClass2();
            }
            catch (Exception e)
            {
                MessageBox.Show("A SMARTboard cannot be found.  Please check your connection to the SMARTboard.");
                return;
                //Logger.log("Exception in Main: " + e.Message);
            }
            if (Sbsdk != null)
            {
                SbsdkEvents = (_ISBSDKBaseClass2Events_Event)Sbsdk;
            }
            if (SbsdkEvents != null)
            {
                SbsdkEvents.OnEraser += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnEraserEventHandler(this.OnEraser);
                SbsdkEvents.OnNoTool += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnNoToolEventHandler(this.OnNoTool);
                SbsdkEvents.OnPen += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnPenEventHandler(this.OnPen);
                SbsdkEvents.OnBoardStatusChange += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnBoardStatusChangeEventHandler(this.OnBoardStatusChange);
            }

            if (Sbsdk != null)
            {
                Sbsdk.SBSDKAttachWithMsgWnd(mainMeTLWindowPtr.ToInt32(), false, mainMeTLWindowPtr.ToInt32());
                Sbsdk.SBSDKSetSendMouseEvents(mainMeTLWindowPtr.ToInt32(), _SBCSDK_MOUSE_EVENT_FLAG.SBCME_ALWAYS, -1);
            }
            isConnected = true;
            SMARTboardConsole("Connected to SMARTboard");
        }
 private void connectToSmartboard(object _unused)
 {
     try
     {
         Main_Loaded();
         Sbsdk = new SBSDKBaseClass2();
     }
     catch (Exception e)
     {
         Logger.Log("SmartboardConnector::connectToSmartboard Exception: " + e.Message);
         return;
     }
     if (Sbsdk != null)
     {
         SbsdkEvents = (_ISBSDKBaseClass2Events_Event)Sbsdk;
     }
     if (SbsdkEvents != null)
     {
         SbsdkEvents.OnEraser += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnEraserEventHandler(this.OnEraser);
         SbsdkEvents.OnNoTool += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnNoToolEventHandler(this.OnNoTool);
         SbsdkEvents.OnPen += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnPenEventHandler(this.OnPen);
         SbsdkEvents.OnBoardStatusChange += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnBoardStatusChangeEventHandler(this.OnBoardStatusChange);
     }
     if (Sbsdk != null)
     {
         Sbsdk.SBSDKAttachWithMsgWnd(mainMeTLWindowPtr.ToInt32(), false, mainMeTLWindowPtr.ToInt32());
         Sbsdk.SBSDKSetSendMouseEvents(mainMeTLWindowPtr.ToInt32(), _SBCSDK_MOUSE_EVENT_FLAG.SBCME_ALWAYS, -1);
     }
     isConnected = true;
     Commands.RequerySuggested(smartboardCommands);
     SMARTboardConsole("Connected to SMARTboard");
 }
        public SMARTBoardTouchInputProvider(Window window)
        {
            mainWindow = window;
            Sbsdk = new SBSDKBaseClass2();
            SbsdkEvents = (_ISBSDKBaseClass2Events_Event)Sbsdk;

            Init();
        }
        public SmartBoard(Canvas _canvas)
        {
            #region Instantation of the SDK
            try
            {
                sbsdk = new SBSDKBaseClass2();
                Trace("[SDK] SBSDKBaseClass2Class instantiated.");
            }
            catch (Exception)
            {
                Trace("[SDK] SBSDKBaseClass2Class instantation FAILED !");
            }
            if (sbsdk != null)
            {
                try
                {
                    sbsdkEvents      = (_ISBSDKBaseClass2Events_Event)sbsdk;
                    sbsdkHoverEvents = (_ISBSDKBaseClass2HoverEvents_Event)sbsdk;
                }
                catch (Exception)
                {
                    Trace("[SDK] Event/Hover instantation FAILED");
                }
            }
            #endregion Instantiation of the SDK


            #region Initialization.
            canvas = _canvas;
            Trace("SmartBoard(canvas) entered.");

            output = new Output(canvas);
            // Here, initialization of the first set of object.
            reactableMenu = new RectangleFocusMenu(canvas, LeftClosePoint, new Path(), true);
            reactableMenu.addImageFocusMenu();
            //reactableMenu.Show();


            // new reactable object just to see what happened
            Filter fil1 = new Filter(canvas, 750, 400, 75);
            Filter fil2 = new Filter(canvas, 850, 500, 75);
            Filter fil3 = new Filter(canvas, 1000, 550, 75);
            Filter fil4 = new Filter(canvas, 350, 300, 75);

            Oscillator osc1 = new Oscillator(canvas, 200, 150, 75);
            Oscillator osc2 = new Oscillator(canvas, 1200, 600, 75);

            OscillatorController control  = new OscillatorController(canvas, 75, 75, 75);
            OscillatorController control2 = new OscillatorController(canvas, 75, 200, 75);

            /* OscillatorController control3 = new OscillatorController(canvas, 75, 200, 75);
             * OscillatorController control4 = new OscillatorController(canvas, 75, 200, 75);
             * OscillatorController control5 = new OscillatorController(canvas, 75, 200, 75);*/

            //ReactableObject.ReactableObjectList.Add(fil1);

            #endregion Initialization.


            canvas.MouseDown += new System.Windows.Input.MouseButtonEventHandler(canvas_MouseDown);



            #region Event Handlers section.
            if (sbsdkEvents != null)
            {
                // Adding the handlers for the touchscreen
                sbsdkEvents.OnXYDown += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnXYDownEventHandler(OnXYDown);
                sbsdkEvents.OnXYMove += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnXYMoveEventHandler(OnXYMove);
                sbsdkEvents.OnXYUp   += new SBSDKComWrapperLib._ISBSDKBaseClass2Events_OnXYUpEventHandler(OnXYUp);
            }
            #endregion Event Handlers section.

            #region SDK COM Stuff
            if (sbsdk != null)
            {
                HwndSource hwndSource = PresentationSource.FromVisual(canvas) as HwndSource;
                sbsdk.SBSDKAttach(hwndSource.Handle.ToInt32(), false);
                sbsdk.SBSDKSetSendMouseEvents(hwndSource.Handle.ToInt32(), SBSDKComWrapperLib._SBCSDK_MOUSE_EVENT_FLAG.SBCME_NEVER, -1);
                Trace("SmartBoard(canvas) entered2.");
            }
            #endregion SDK COM Stuff
        }