// Wizard script: private void startWizard() { print("startWizard"); bool success = WizCtl.PadConnect(); if (success) { ScriptIsRunning = true; print("Pad detected: " + WizCtl.PadWidth + " x " + WizCtl.PadHeight); switch (WizCtl.PadWidth) { case 396: Pad = new tPad("STU-300", 60, 200, 200, 8, 8, 16, 70); // 396 x 100 break; case 640: Pad = new tPad("STU-500", 300, 360, 390, 16, 22, 32, 110); // 640 x 800 break; case 800: Pad = new tPad("STU-520 or STU-530", 300, 360, 390, 16, 22, 32, 110); // 800 x 480 break; case 320: Pad = new tPad("STU-430 or ePad", 100, 130, 150, 10, 12, 16, 110); // 320 x 200 break; default: print("No compatible device found"); break; } print(Pad.Model); step1(); } else { print("Unable to connect to tablet"); } }
// Separate routine for connecting to pad so that it can be controlled by a timer which allows a delay // between connection attempts private bool connectToPad() { bool success = false; ++connectionAttempt; // If connection has previously failed then we need to destroy and recreate the WizCtl if (connectionAttempt > 1) { recreateWizCtl(); } WizCtl.Licence = "<<license>>"; success = WizCtl.PadConnect(); print("Success " + success); if (success == true) { print("Pad detected: " + WizCtl.PadWidth + " x " + WizCtl.PadHeight); switch (WizCtl.PadWidth) { case 396: Pad = new tPad("STU-300", 60, 200, 200, 8, 8, 16, 70); // 396 x 100 break; case 640: Pad = new tPad("STU-500", 300, 360, 390, 16, 22, 32, 110); // 640 x 800 break; case 800: Pad = new tPad("STU-520 or STU-530", 300, 360, 390, 16, 22, 32, 110); // 800 x 480 break; case 320: Pad = new tPad("STU-430 or ePad", 100, 130, 150, 10, 12, 16, 110); // 320 x 200 break; default: print("No compatible device found"); break; } print(Pad.Model); step1(); } else { secondsWaited += 2; print("waiting to connect..." + secondsWaited); } return(success); }