Ejemplo n.º 1
0
        private void functionbutton_Load(object sender, RoutedEventArgs routedEventArgs)
        {
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Application.Current.Shutdown();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            TwoButton = (bool)jobject.TwoButton;
            if (TwoButton)
            {
                ButtonNumber = 2;
                vm.Hidden    = true;
            }
            else
            {
                ButtonNumber = 5;
            }

            Trace.WriteLine("FunctionButton_Load");
            HotTabDLL.WinIO_SetDevice2State(0x3E);  //close barcode power
            Trace.WriteLine("Init KeyboardHook");
            mKeyboardHook = new KeyboardHook((int)GetHandle(this), true);
            WinIO_FunctionButtonLock();
            this.DataContext = vm;
        }
Ejemplo n.º 2
0
 private void slValue_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     if (IsTablet)
     {
         HotTabDLL.SetBrightness((byte)Convert.ToInt16(slValue.Value));
     }
 }
Ejemplo n.º 3
0
 private void SwitchLedCustom()
 {
     if (IsLedRfEnabled % 2 == 1)
     {
         buttonRFLEDTest.Foreground = Brushes.Green;
         buttonRFLEDTest.Content    = "ON";
         HotTabDLL.WinIO_SetDeviceState(0x77);
         HotTabDLL.WinIO_SetDevice2State(0x4E);
         if (IsDebugMode)
         {
             Trace.WriteLine("LED - SetDeviceState(0x77), SetDeviceState(0x4E)");
         }
     }
     else if (IsLedRfEnabled % 2 == 0)
     {
         buttonRFLEDTest.Foreground = Brushes.Red;
         buttonRFLEDTest.Content    = "ON";
         HotTabDLL.WinIO_SetDeviceState(0x37);
         HotTabDLL.WinIO_SetDevice2State(0x0E);
         if (IsDebugMode)
         {
             Trace.WriteLine("LED - SetDeviceState(0x37), SetDeviceState(0x0E)");
         }
     }
 }
Ejemplo n.º 4
0
        void DevicePowerOffAndOn(string deviceName)
        {
            Trace.WriteLine("Disable Device Power : " + deviceName);
            switch (deviceName)
            {
            case "ExtendPort":
            //if (TestProduct.Equals("BTZ1")) HotTabDLL.WinIO_SetDevice2State(0x0F); // 00001111
            //break;
            case "GPS":
                if (TestProduct.Equals("BTZ1"))
                {
                    HotTabDLL.WinIO_SetDeviceState(0xF2);                                 // LED / Touch / RearCam / BT / X / GPS / WWAN / X
                }
                else if (TestProduct.Equals("IB80"))
                {
                    HotTabDLL.WinIO_SetDeviceState(0xB3);                                      // AllLED / - / RearCam / BT / - / GPS / 3G / WIFI, Bit6 : Charge Control, 設成1時EC會停止充電
                }
                break;
            }
            Thread.Sleep(3000);

            Trace.WriteLine("Enable Device Power : " + deviceName);
            EnableDevicePower(TestProduct);
            Thread.Sleep(3000);
        }
Ejemplo n.º 5
0
        private void TestLedOnOffRF()
        {
            if (IsBiosTestModeEnabled)
            {
                if (IsLedRfEnabled.Equals(1)) // 沒有 GPS 獨立燈號
                {
                    TestMode.SetTestModeLED((byte)TestMode.ListLED.RF);
                    if (IsDebugMode)
                    {
                        Trace.WriteLine("BTZ1 RF LED ON");
                    }
                }
                else if (IsLedRfEnabled.Equals(0)) // 沒有 GPS 獨立燈號
                {
                    TestMode.SetTestModeLED(0x00);
                    if (IsDebugMode)
                    {
                        Trace.WriteLine("BTZ1 RF LED OFF");
                    }
                }
            }
            else
            {
                if (TestProduct.Equals("IBWH"))
                {
                    SwitchLedCustom();
                }
                else
                {
                    SwitchLedRF();
                }
            }

            MessageBoxResult Result = ShowDialogMessageBox("Please confirm RF LED Status?\r\n( ON = Yes, OFF = No )", "Attention", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if ((Result.Equals(MessageBoxResult.Yes) && IsLedRfEnabled.Equals(1)) ||
                (Result.Equals(MessageBoxResult.No) && IsLedRfEnabled.Equals(0)))
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("RF LED PASS");
                }
                checkSuccessCount++;
            }
            else
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("RF LED FAIL");
                }
            }

            HotTabDLL.WinIO_SetDeviceState(0xB7);
            if (IsDebugMode)
            {
                Trace.WriteLine("LED - SetDeviceState(0xB7)");
            }
            checkTestStatus("CheckIt");
        }
Ejemplo n.º 6
0
        private void brightness_Load(object sender, RoutedEventArgs routedEventArgs)
        {
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Application.Current.Shutdown();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            IsAutoModeBrightness    = (bool)jobject.IsAutoModeBrightness;
            TestProduct             = jobject.TestProduct.ToString();
            TimerIntervalBrightness = (int)jobject.TimerIntervalBrightness;
            IsSensorHubExist        = (bool)jobject.IsSensorHubExist;
            BrightnessMaximum       = (int)jobject.BrightnessMaximum;
            BrightnessMinimum       = (int)jobject.BrightnessMinimum;
            BrightnessMidValue      = BrightnessMaximum / 2;

            Trace.WriteLine("Brightness_Load");

            HotTabDLL.SetTestProduct(TestProduct);
            HotTabDLL.InitBrightness(GetHandle(this), 0);

            if (!IsTablet)
            {
                checkTestStatus("Non-TPC models cannot test Brightness.");
                return;
            }

            if (IsTablet)
            {
                HotTabDLL.SetBrightness(0);
            }

            slValue.Maximum = BrightnessMaximum;


            // 用Timer自動切換Brightness階數, 最後需要OP人工確認Panel是否正常
            if (IsAutoModeBrightness)
            {
                slValue.Value   = 0;
                TimerBrightness = new System.Windows.Forms.Timer();
                //設定計時器的速度
                TimerBrightness.Interval = TimerIntervalBrightness;
                TimerBrightness.Tick    += new EventHandler(TimerBrightness_Tick);
                TimerBrightness.Start();
            }
            // 純手動移動TrackBar(或是Button), 先調到最暗再調到最亮, 最後需要OP人工確認Panel是否正常
            else
            {
            }
        }
Ejemplo n.º 7
0
 public static void SwitchToExtendBattery()
 {
     if (!IsExtendBatteryUsed)
     {
         HotTabDLL.WinIO_SetHotSwap();
         if (IsDebugMode)
         {
             Trace.WriteLine("Hotswap to Extend battery.");
         }
     }
 }
Ejemplo n.º 8
0
        void IsRotationLocked(bool lockStatus)
        {
            if (IsDebugMode)
            {
                Trace.WriteLine("IsRotationLocked - Status : " + lockStatus);
            }
            if (!isSensorHubExist && isRotationSupport && HotTabWMIInformation.IsWindows7)
            {
                if (IsTablet)
                {
                    return;
                }

                if (lockStatus)
                {
                    HotTabDLL.WinIO_SetRotationLock(1);
                }
                else
                {
                    HotTabDLL.WinIO_SetRotationLock(0);
                }
            }
            else if (isRotationSupport && HotTabWMIInformation.IsWindows8or10)
            {
                HotTabRegistry.RegistryRead("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AutoRotation", "Enable", ref Win8RotationFlag);
                if (IsDebugMode)
                {
                    Trace.WriteLine("Rotation Flag = " + Win8RotationFlag);
                }

                if ((lockStatus && Win8RotationFlag.Equals("1")) ||
                    (!lockStatus && Win8RotationFlag.Equals("0"))
                    )
                {
                    HotTabDLL.keybd_event(0x5B, 0x00, 0x00, 0); // home key down
                    HotTabDLL.keybd_event(0x4F, 0x00, 0x00, 0); // home key down
                    HotTabDLL.keybd_event(0x4F, 0x00, 0x02, 0); // home key up
                    HotTabDLL.keybd_event(0x5B, 0x00, 0x02, 0); // home key up
                }
            }
            else
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("Screen Rotation Unlock Error. The system version is lower than the minimum OS version");
                }
            }
        }
Ejemplo n.º 9
0
        void EnableDevicePower(string ProductName)
        {
            // 將HotTab功能全開(開啟所有電源), 確保測試時一切功能正常
            if (IsDebugMode)
            {
                Trace.WriteLine("Open all device power.");
            }
            if (IsTablet)
            {
                // SetDevice
                if (ProductName.Equals("IBWD"))
                {
                    HotTabDLL.WinIO_SetDeviceState(Device1AllPowerOnIBWD); // 10110111, WindyBox Bit6 : Charge Control, 設成1時EC會停止充電
                }
                else if (ProductName.Equals("BTZ1"))
                {
                    HotTabDLL.WinIO_SetDeviceState(Device1AllPowerOnBTZ1); // 11110110
                }
                else
                {
                    HotTabDLL.WinIO_SetDeviceState(Device1AllPowerOnOthers);// ID82 Bit6(3G_Antenna) Bit7(GPS_Antenna) 會偵測到有無Docking才會切換到外部天線
                }

                // SetDevice2
                if (ProductName.Equals("FMB8"))
                {
                    HotTabDLL.WinIO_SetDevice2State(Device2AllPowerOnFMB8); // FMB80 : Bit0 = Screen close, Bit1 = Docking Lamp
                }
                else if (ProductName.Equals("BTZ1"))
                {
                    HotTabDLL.WinIO_SetDevice2State(Device2AllPowerOnBTZ1); // 00011111
                }
                else if (ProductName.Equals("101P"))
                {
                    HotTabDLL.WinIO_SetDevice2State(Device2AllPowerOn101P); // 01011111
                }
                else
                {
                    HotTabDLL.WinIO_SetDevice2State(0x3E); // IB80 Bit6(Battery_Max_Charge) 只會讓電池充到50%
                }
                // IBxx & IHxx 系列需開啟Bit5(ExpUSBEn)電源, 才有辦法測試背後接點
            }
        }
Ejemplo n.º 10
0
        private void led_Load(object sender, RoutedEventArgs routedEventArgs)
        {
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Application.Current.Shutdown();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            TestProduct           = jobject.TestProduct.ToString();
            IsAutoModeBatteryLED  = (bool)jobject.IsAutoModeBatteryLED;
            EnablePower           = (bool)jobject.EnablePower;
            EnableHDD             = (bool)jobject.EnableHDD;
            EnableRF              = (bool)jobject.EnableRF;
            EnableBattery         = (int)jobject.EnableBattery;
            IsBiosTestModeEnabled = (bool)jobject.IsBiosTestModeEnabled;

            if (IsDebugMode)
            {
                Trace.WriteLine("LED_Load");
            }

            timer          = new System.Windows.Forms.Timer();
            timer.Interval = 750;
            timer.Tick    += new EventHandler(Timer_Tick);
            timer.Start();

            // 當MCU測項有打開就連到MCU_Comport
            if (TestProduct.Equals("IBWD"))
            {
                if (HotTabDLL.DeviceConnect(9600, MCU_Comport) == 0)
                {
                    if (IsDebugMode)
                    {
                        Trace.WriteLine("MCU_Comport : " + MCU_Comport);
                    }
                    //groupBoxWindyBox.Visible = true;
                    //groupBoxWindyBox.Location = new Point(652, 304);
                }
                else
                {
                    if (IsDebugMode)
                    {
                        Trace.WriteLine("Can't connect to MCU_Comport : " + MCU_Comport);
                    }
                    ShowDialogMessageBox("Can't connect to MCU comport : " + MCU_Comport, "Attention", MessageBoxButton.OK, MessageBoxImage.Error);
                    checkSuccessCount = -1;
                    checkTestStatus("CheckIt");
                }
            }
            else
            {
                if (EnablePower)
                {
                    TotalTestLEDCount++;
                    groupPower.Visibility = Visibility.Visible;
                }

                if (EnableBattery.Equals(1))
                {
                    TotalTestLEDCount++;
                    BatteryLED.Visibility = Visibility.Visible;
                    if (IsFixtureExisted && IsAutoModeBatteryLED)
                    {
                        buttonBatteryLEDPass.IsEnabled  = false;
                        buttonBatteryLEDFail.IsEnabled  = false;
                        buttonBatteryLEDTest.Visibility = Visibility.Visible;
                        TotalTestLEDCount++; // Battery LED 需要各偵測ON/OFF狀態各1次
                    }
                    else
                    {
                        //buttonBatteryLEDPass.IsEnabled = true;
                        labelTestBattery.Visibility = Visibility.Visible;
                    }
                }
                else if (EnableBattery.Equals(2))
                {
                    TotalTestLEDCount    += 2;
                    BatteryLED.Visibility = Visibility.Visible;
                    //groupBattery2.Visible = true;
                }

                if (EnableHDD)
                {
                    TotalTestLEDCount++;
                    groupHDD.Visibility = Visibility.Visible;
                }

                if (EnableGPS) // 除ID82 / IB10X 外, 其他機種不顯示GPS LED項目
                {
                    TotalTestLEDCount++;
                    //groupGPS.Visible = true;
                }

                // SupportModelName, LED
                if (TestProduct.Equals("FMB8"))
                {
                    TotalTestLEDCount += 3;
                    groupRF.Visibility = Visibility.Visible;
                    //groupBoxBluetooth.Visible = true;
                    //groupBoxWiFi.Visible = true;
                    //groupBoxStop.Visible = true;
                    // 預設將 BT / WiFi / Stop LED 先開啟
                    HotTabDLL.WinIO_WriteToECSpace(0x46, 0x01); // BTLED
                    HotTabDLL.WinIO_WriteToECSpace(0x3D, 0x01); // WIFILED
                    HotTabDLL.WinIO_WriteToECSpace(0x47, 0x01); // STOPLED
                }
                else if (EnableRF)
                {
                    if (TestProduct.Equals("IBWH")) // HandHeld 8"
                    {
                        groupRF.Content = "Custom LED";
                    }
                    TotalTestLEDCount        += 2; // RF 需要各偵測ON/OFF狀態各1次
                    groupRF.Visibility        = Visibility.Visible;
                    buttonRFLEDPass.IsEnabled = false;
                    buttonRFLEDFail.IsEnabled = false;
                }

                if (IsBiosTestModeEnabled)
                {
                    // TotalTestLEDCount ++; // Battery LED 需要各偵測ON/OFF狀態各1次
                    TestMode.SetTestModeLED(0x07);
                    buttonBatteryLEDTest.Visibility = Visibility.Visible;
                    buttonBatteryLEDTest.IsEnabled  = true;
                    buttonBatteryLEDTest.Content    = "Test";
                    buttonBatteryLEDTest.Foreground = Brushes.Blue;
                    buttonRFLEDTest.Content         = "Test";
                    buttonRFLEDTest.Foreground      = Brushes.Blue;
                    buttonBatteryLEDPass.IsEnabled  = false;
                    buttonBatteryLEDFail.IsEnabled  = false;
                    // buttonRFLEDPass.Enabled = false;
                    // buttonRFLEDFail.Enabled = false;
                }
            }
        }
Ejemplo n.º 11
0
 private void SwitchLedRF()
 {
     if (EnableGPS) // 有 GPS 獨立燈號
     {
         if (IsLedRfEnabled.Equals(1) && IsLedGpsEnabled % 2 == 1)
         {
             buttonRFLEDTest.Foreground = Brushes.Green;
             buttonRFLEDTest.Content    = "ON";
             HotTabDLL.WinIO_SetDeviceState(0xFF);
             if (IsDebugMode)
             {
                 Trace.WriteLine("LED - SetDeviceState(0xFF)");
             }
         }
         else if (IsLedRfEnabled.Equals(1) && IsLedGpsEnabled % 2 == 0)
         {
             buttonRFLEDTest.Foreground = Brushes.Green;
             buttonRFLEDTest.Content    = "ON";
             HotTabDLL.WinIO_SetDeviceState(0x7B);
             if (IsDebugMode)
             {
                 Trace.WriteLine("LED - SetDeviceState(0x7B)");
             }
         }
         else if (IsLedRfEnabled.Equals(0) && IsLedGpsEnabled % 2 == 1)
         {
             buttonRFLEDTest.Foreground = Brushes.Red;
             buttonRFLEDTest.Content    = "OFF";
             HotTabDLL.WinIO_SetDeviceState(0xAC);
             if (IsDebugMode)
             {
                 Trace.WriteLine("LED - SetDeviceState(0xAC)");
             }
         }
         else
         {
             buttonRFLEDTest.Foreground = Brushes.Red;
             buttonRFLEDTest.Content    = "OFF";
             HotTabDLL.WinIO_SetDeviceState(0x00);
             if (IsDebugMode)
             {
                 Trace.WriteLine("LED - SetDeviceState(0x00)");
             }
         }
     }
     else if (IsLedRfEnabled.Equals(1)) // 沒有 GPS 獨立燈號
     {
         buttonRFLEDTest.Foreground = Brushes.Green;
         buttonRFLEDTest.Content    = "ON";
         HotTabDLL.WinIO_SetDeviceState(0xB7);
         if (IsDebugMode)
         {
             Trace.WriteLine("LED - SetDeviceState(0xB7)");
         }
     }
     else if (IsLedRfEnabled.Equals(0)) // 沒有 GPS 獨立燈號
     {
         buttonRFLEDTest.Foreground = Brushes.Red;
         buttonRFLEDTest.Content    = "OFF";
         HotTabDLL.WinIO_SetDeviceState(0x37);
         if (IsDebugMode)
         {
             Trace.WriteLine("LED - SetDeviceState(0x37)");
         }
     }
 }
Ejemplo n.º 12
0
        void TimerRotationWin8_Tick(object sender, EventArgs e)
        {
            // HotTabDLL.GetPortValExV(out RotationModeNow); // old method
            HotTabDLL.GetAngleDirection(out RotationModeNow);
            RotationMode.Text = ShowRotationState();

            if (tempRotationState != RotationModeNow)
            {
                try
                {
                    Int32 hwndMainForm;
                    hwndMainForm = HotTabDLL.FindWindow(null, "MainForm");
                    HotTabDLL.PostMessage(hwndMainForm, KeyboardHookEventArgs.ECEvent_CloseAllForm, 0, 0);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                tempRotationState = RotationModeNow;

                #region StartOrientation Switch Case
                // 依照StartOrientation分成4個模式, 是因為G-SENSOR擺的位置可能是不一樣的
                switch (StartOrientation)
                {
                case 0:     // ID90-250
                    switch (RotationModeNow)
                    {
                    case 0:
                        HotTabDLL.HotKey_ScreenRotation(180);
                        registryHandler.RegistryWrite("RotationState", "2");
                        break;

                    case 1:
                        HotTabDLL.HotKey_ScreenRotation(270);
                        registryHandler.RegistryWrite("RotationState", "3");
                        break;

                    case 2:
                        HotTabDLL.HotKey_ScreenRotation(0);
                        registryHandler.RegistryWrite("RotationState", "0");
                        break;

                    case 3:
                        HotTabDLL.HotKey_ScreenRotation(90);
                        registryHandler.RegistryWrite("RotationState", "1");
                        break;
                    }
                    break;

                case 1:
                    switch (RotationModeNow)
                    {
                    case 0:
                        HotTabDLL.HotKey_ScreenRotation(90);
                        registryHandler.RegistryWrite("RotationState", "1");
                        break;

                    case 1:
                        HotTabDLL.HotKey_ScreenRotation(180);
                        registryHandler.RegistryWrite("RotationState", "2");
                        break;

                    case 2:
                        HotTabDLL.HotKey_ScreenRotation(270);
                        registryHandler.RegistryWrite("RotationState", "3");
                        break;

                    case 3:
                        HotTabDLL.HotKey_ScreenRotation(0);
                        registryHandler.RegistryWrite("RotationState", "0");
                        break;
                    }
                    break;

                case 2:
                    switch (RotationModeNow)
                    {
                    case 0:
                        HotTabDLL.HotKey_ScreenRotation(0);
                        registryHandler.RegistryWrite("RotationState", "0");
                        break;

                    case 1:
                        HotTabDLL.HotKey_ScreenRotation(90);
                        registryHandler.RegistryWrite("RotationState", "1");
                        break;

                    case 2:
                        HotTabDLL.HotKey_ScreenRotation(180);
                        registryHandler.RegistryWrite("RotationState", "2");
                        break;

                    case 3:
                        HotTabDLL.HotKey_ScreenRotation(270);
                        registryHandler.RegistryWrite("RotationState", "3");
                        break;
                    }
                    break;

                case 3:
                    switch (RotationModeNow)
                    {
                    case 1:
                        HotTabDLL.HotKey_ScreenRotation(0);
                        registryHandler.RegistryWrite("RotationState", "0");
                        break;

                    case 2:
                        HotTabDLL.HotKey_ScreenRotation(90);
                        registryHandler.RegistryWrite("RotationState", "1");
                        break;

                    case 3:
                        HotTabDLL.HotKey_ScreenRotation(180);
                        registryHandler.RegistryWrite("RotationState", "2");
                        break;

                    case 0:
                        HotTabDLL.HotKey_ScreenRotation(270);
                        registryHandler.RegistryWrite("RotationState", "3");
                        break;
                    }
                    break;
                }
                #endregion
            }
            #endregion
        }
Ejemplo n.º 13
0
        void TimerRotation_Tick(object sender, EventArgs e)
        {
            IsAccelerometerExist = HotTabDLL.GetAccelerometer(out AxisX, out AxisY, out AxisZ);
            if (IsDebugMode)
            {
                Trace.WriteLine("Is Accelerometer Exist? = " + IsAccelerometerExist + " , x = " + AxisX + " , y = " + AxisY + " , z = " + AxisZ);
            }
            SensorX.Text      = AxisX.ToString();
            SensorY.Text      = AxisY.ToString();
            SensorZ.Text      = AxisZ.ToString();
            RotationMode.Text = ShowRotationState();

            if (IsAutoModeRotation)
            {
                AccelerometerDetectCount++;
                if ((MinAxisX < AxisX) && (AxisX < MaxAxisX) &&
                    (MinAxisY < AxisY) && (AxisY < MaxAxisY) &&
                    (MinAxisZ < AxisZ) && (AxisZ < MaxAxisZ))
                {
                    if (AccelerometerStableCount < ThresholdSensorStable)
                    {
                        AccelerometerStableCount++;
                    }
                    else
                    {
                        IsAccelerometerStable = true;
                        DisplaySettingsChangedEvent();
                    }
                }
                else if (AccelerometerDetectCount > ThresholdTimeoutAutoMode)
                {
                    checkTestStatus(string.Format("AccelerometerDetectCount: {0} > ThresholdTimeoutAutoMode: {1}", AccelerometerDetectCount, ThresholdTimeoutAutoMode));
                }
            }

            if (IsAccelerometerExist)
            {
                if ((AxisY < -0.55))
                {
                    RotationModeNow = 0;
                }
                else if ((AxisY > 0.55))
                {
                    RotationModeNow = 2;
                }
                else if ((AxisX < -0.55))
                {
                    RotationModeNow = 3;
                }
                else if ((AxisX > 0.55))
                {
                    RotationModeNow = 1;
                }

                if (tempRotationState != RotationModeNow)
                {
                    try
                    {
                        Int32 hwndMainForm;
                        hwndMainForm = HotTabDLL.FindWindow(null, "MainForm");
                        HotTabDLL.PostMessage(hwndMainForm, KeyboardHookEventArgs.ECEvent_CloseAllForm, 0, 0);
                    }
                    catch (Exception ex)
                    {
                        if (IsDebugMode)
                        {
                            Trace.WriteLine(ex.Message);
                        }
                    }

                    tempRotationState = RotationModeNow;
                    switch (RotationModeNow)
                    {
                    case 0:
                        RotationMode0 = true;
                        HotTabDLL.HotKey_ScreenRotation(0);
                        registryHandler.RegistryWrite("RotationState", "0");
                        break;

                    case 1:
                        RotationMode90 = true;
                        HotTabDLL.HotKey_ScreenRotation(90);
                        registryHandler.RegistryWrite("RotationState", "1");
                        break;

                    case 2:
                        RotationMode180 = true;
                        HotTabDLL.HotKey_ScreenRotation(180);
                        registryHandler.RegistryWrite("RotationState", "2");
                        break;

                    case 3:
                        RotationMode270 = true;
                        HotTabDLL.HotKey_ScreenRotation(270);
                        registryHandler.RegistryWrite("RotationState", "3");
                        break;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        void camera_Load(object sender, EventArgs e)
        {
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Exit();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            ShowWindow                 = (bool)jobject.ShowWindow;
            CameraAmount               = (int)jobject.CameraAmount;
            IsAutoModeCamera           = (bool)jobject.IsAutoModeCamera;
            TimerIntervalCamaraCapture = (int)jobject.TimerIntervalCamaraCapture;
            ConfirmTagContextBarcode   = jobject.ConfirmTagContextBarcode.ToString();
            TestProduct                = jobject.TestProduct.ToString();
            IsFM08 = (bool)jobject.IsFM08;

            if (ShowWindow)
            {
                this.Opacity       = 100;
                this.ShowInTaskbar = true;
            }
            if (IsDebugMode)
            {
                Trace.WriteLine("Camera_Load, Is8MCameraUsed : " + Is8MCameraUsed);
            }

            TestCamera = 0; // 確認測試過的相機數是初始值的0, Winmate Kenkun modify on 2017/07/07

            if (IsDeveloperMode)
            {
                UpdateDeviceList();
            }
            else if (HotTabCamera.GetCameraCount() <= 0)
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("Camera Not Found");
                }
                comboBoxCameraDevices.Items.Add("Device Not Found");
                comboBoxCameraDevices.SelectedIndex = 0;
                checkTestStatus("Camera Not Found.");
                return;
            }
            else
            {
                FangtecCameraDLL.ALC_Initialization(0, "");  // About 1.3 Sec

                // 將Camera轉90度, 需搭配廠商提供的Rotation Driver
                if (TestProduct.Equals("FMB8") && !IsFM08)
                {
                    HotTabDLL.FangtecRotate090();                                        // 由於DLL改版, 只有FM10用, Winmate Kenkun modify on 2015/12/14
                }
                UpdateDeviceList();
            }

            if (IsAutoModeCamera)
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("Camera - AutoMode");
                }
                groupBoxCapturePreview.Visible    = false;
                groupBoxPositionOfCapture.Visible = false;
                CaptureDecoder = new decoder();
            }
        }
Ejemplo n.º 15
0
        private void Barcode_Load(object sender, EventArgs e)
        {
            CloseWidget();
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Exit();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            ShowWindow                 = (bool)jobject.ShowWindow;
            IsHardwareTrigger          = (bool)jobject.IsHardwareTrigger;
            BarcodeType                = (int)jobject.BarcodeType;
            PortAddressBarcode         = jobject.PortAddressBarcode.ToString();
            BarcodeReadTime            = (int)jobject.BarcodeReadTime;
            IsConfirmTagContextBarcode = (bool)jobject.IsConfirmTagContextBarcode;
            ConfirmTagContextBarcode   = jobject.ConfirmTagContextBarcode.ToString();

            if (ShowWindow)
            {
                this.Opacity       = 100;
                this.ShowInTaskbar = true;
            }

            if (IsDebugMode)
            {
                Trace.WriteLine("Barcode_Load");
            }
            Trace.WriteLine("Open all device power.");
            HotTabDLL.WinIO_SetDevice2State(Device2AllPowerOnOthers); // IB80 Bit6(Battery_Max_Charge) 只會讓電池充到50%
            if (TimerBarcode == null)
            {
                TimerBarcode = new System.Windows.Forms.Timer();
            }
            TimerBarcode.Tick += new EventHandler(TimerBarcode_Tick);
            // 給予使用者指定秒數讓Barcode進行掃描, 時間到就啟動Timer關閉Barcode
            TimerBarcode.Interval = BarcodeReadTime;

            if (IsHardwareTrigger)
            {
                buttonFAIL.Enabled = true;
                TimerBarcode.Start();
            }
            else
            {
                PublicFunctionBarcode.BarcodeType = Convert.ToUInt16(BarcodeType);
                if (IsDebugMode)
                {
                    Trace.WriteLine("Barcod Port : " + PortAddressBarcode + " , Type : " + PublicFunctionBarcode.BarcodeType);
                }

                PublicFunctionBarcode.IsdcRsApiInit();

                try
                {
                    barcodeConnect();
                }
                catch (Exception ex)
                {
                    checkTestStatus(ex.Message);
                }
            }
        }
Ejemplo n.º 16
0
        private void barcodeConnect()
        {
            if (IsDebugMode)
            {
                Trace.WriteLine("barcodeConnect - Port : " + PortAddressBarcode + " , Type : " + PublicFunctionBarcode.BarcodeType);
            }
            try
            {
                if (!HotTabDLL.CheckComExist(PortAddressBarcode)) // 檢查指定的Comport是否存在(掃描Barcode Comport,先開啟Comport一次後關閉)
                {
                    DialogResult dr = ShowDialogMessageBox(PortAddressBarcode + " can't use or not find.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    if (dr == DialogResult.OK)
                    {
                        checkTestStatus(PortAddressBarcode + " can't use or not find.");
                    }
                    return;
                }

                if (mBarcodePublicFunction != null)
                {
                    mBarcodePublicFunction.free(); // Release Barcode佔用的資源
                    mBarcodePublicFunction = null;
                }
                if (mBarcodePublicFunction == null)
                {
                    mBarcodePublicFunction = new PublicFunctionBarcode(PortAddressBarcode, Handle); // 開啟新的COM
                    mBarcodePublicFunction.initinalBarCode();
                }

                if (PublicFunctionBarcode.BarcodeVisible == 0)
                {
                    if (PublicFunctionBarcode.BarcodeType == 2)
                    {
                        Visible = true; // for ISDC_RS use fixed WM_ISCP_FRAME and WM_RAW_DATA can't receive
                        Thread.Sleep(BarcodeReadTime);
                    }
                    Visible = false;
                }
                else
                {
                    Visible = true;
                }

                lblVersionString.Text = mBarcodePublicFunction.GetBarcodeName2();

                buttonFAIL.Enabled = true; // 如果沒有Barcode初始化完就可以直接按FAIL

                buttonScan.Enabled = true;

                if (mBarcodePublicFunction.IsComportReady() && mBarcodePublicFunction.IsSupportBarCode())  // driver usb-comport ready
                {
                    textBoxReceiveTag.Focus();
                }
                else if (mBarcodePublicFunction.IsComportReady())
                {
                    mBarcodePublicFunction.IsForceOpticonMDI3100();
                    textBoxReceiveTag.Focus();
                }
                else
                {
                    ShowDialogMessageBox("Module is instable, please check Device power or relogin Windows", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    checkTestStatus("Module is instable, please check Device power or relogin Windows");
                    return;
                }
                ReadyToScanTag();
            }
            catch (Exception ex)
            {
                checkTestStatus("barcodeConnect() Exception : " + ex.Message);
                ShowDialogMessageBox("barcodeConnect() Exception : " + ex.Message, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }