Esempio n. 1
0
        private void Btn_comReconnect_Click(object sender, RoutedEventArgs e)
        {
            serialPortIO8_name = SerialPortIO8.Locate_serialPortIO8();
            if (String.Equals(serialPortIO8_name, ""))
            {
                run_comState.Text          = "Can't Find the COM Port for DLP-IO8!";
                run_comState.Background    = new SolidColorBrush(Colors.Orange);
                run_comState.Foreground    = new SolidColorBrush(Colors.Red);
                run_instruction.Text       = "Please connect it correctly and reCheck!";
                run_instruction.Background = new SolidColorBrush(Colors.Orange);
                run_instruction.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                btn_comReconnect.Visibility = Visibility.Hidden;
                btn_comReconnect.IsEnabled  = false;
                run_comState.Text           = "Found the COM Port for DLP-IO8!";
                run_comState.Background     = new SolidColorBrush(Colors.White);
                run_comState.Foreground     = new SolidColorBrush(Colors.Green);
                run_instruction.Text        = "Can start trials now";
                run_instruction.Background  = new SolidColorBrush(Colors.White);
                run_instruction.Foreground  = new SolidColorBrush(Colors.Green);
            }

            if (textBox_NHPName.Text != "" && serialPortIO8_name != null)
            {
                btn_start.IsEnabled = true;
            }
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            btn_start.IsEnabled  = false;
            btn_stop.IsEnabled   = false;
            btn_pause.IsEnabled  = false;
            btn_resume.IsEnabled = false;



            // Get the first not Primary Screen
            swf.Screen showMainScreen = Utility.Detect_oneNonPrimaryScreen();

            // Show the  MainWindow on the Touch Screen
            sd.Rectangle Rect_showMainScreen = showMainScreen.WorkingArea;
            this.Top  = Rect_showMainScreen.Top;
            this.Left = Rect_showMainScreen.Left;

            // Get the touch Screen Rectangle
            Rect_touchScreen = Utility.Detect_PrimaryScreen_Rect();


            // locate serial Port Name
            serialPortIO8_name = SerialPortIO8.Locate_serialPortIO8();
            if (String.Equals(serialPortIO8_name, ""))
            {
                btn_start.IsEnabled           = false;
                btn_comReconnect.Visibility   = Visibility.Visible;
                btn_comReconnect.IsEnabled    = true;
                textblock_comState.Visibility = Visibility.Visible;

                run_comState.Text          = "Can't Find the COM Port for DLP-IO8!";
                run_comState.Background    = new SolidColorBrush(Colors.Orange);
                run_comState.Foreground    = new SolidColorBrush(Colors.Red);
                run_instruction.Text       = "Please connect it correctly and reCheck!";
                run_instruction.Background = new SolidColorBrush(Colors.Orange);
                run_instruction.Foreground = new SolidColorBrush(Colors.Red);
            }
            else
            {
                btn_comReconnect.Visibility   = Visibility.Hidden;
                btn_comReconnect.IsEnabled    = false;
                textblock_comState.Visibility = Visibility.Hidden;
            }

            // Load Default Config File
            LoadConfigFile("");
            targetDiaPixal = Utility.cm2pixal(targetDiaCM);

            if (textBox_NHPName.Text != "" && serialPortIO8_name != null)
            {
                btn_start.IsEnabled = true;
            }
        }
Esempio n. 3
0
        private void BtnOpenStartpad_Click(object sender, RoutedEventArgs e)
        {
            btn_OpenStartpad.IsEnabled  = false;
            btn_CloseStartpad.IsEnabled = true;

            SerialPortIO8.Open_serialPortIO8(serialPort_IO8, cboPort.Text, 115200);

            // listen2Startpad thread
            Thread_Listen2SerialPortIO8 = new Thread(new ThreadStart(Listen2SerialPortIO8));
            Thread_Listen2SerialPortIO8.Start();
        }
Esempio n. 4
0
        private void BindSerialPortNames()
        {
            string[] ports   = SerialPort.GetPortNames();
            string   portIO8 = SerialPortIO8.Locate_serialPortIO8();

            for (int i = 0; i < ports.Length; i++)
            {
                string port = ports[i];
                cboPort.Items.Add(port);
                if (portIO8 != "" && port == portIO8)
                {
                    cboPort.SelectedIndex = i;
                }
            }
            if (portIO8 == "")
            {
                btn_OpenStartpad.IsEnabled  = false;
                btn_CloseStartpad.IsEnabled = false;
                btn_StartJuicer.IsEnabled   = false;
                btn_CloseJuicer.IsEnabled   = false;
            }
        }