예제 #1
0
 private void lowResDisplayMenuItem_Click(object sender, RoutedEventArgs e)
 {
     wrapMain.Width = 600;
     UTIL.WriteRegistry(UTIL.KEY.LAST_LAYOUT, "LOW");
 }
예제 #2
0
        private void connectButton_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            UpdateInfo();
            batteryTimer.Stop();
            if (UBT.connected)
            {
                if (UBT.Disconnect())
                {
                    // ucComboDisplay.Refresh();
                    ucActionList.Refresh();
                    ucActionDetail.Refresh();
                    RefreshBoardConfig();
                }
            }
            else
            {
                if (UBT.Connect(portsComboBox.Text))
                {
                    UTIL.WriteRegistry(UTIL.KEY.LAST_CONNECTION, portsComboBox.Text);
                    // ucComboDisplay.Refresh();
                    ucActionList.Refresh();
                    RefreshBoardConfig();
                }
            }
            if (UBT.connected)
            {
                byte   mode;
                string ssid, ip;
                UInt16 port;
                if (UBT.GetNetwork(out mode, out ssid, out ip, out port))
                {
                    if (mode == 0)
                    {
                        lblSSID.Foreground = Brushes.Red;
                        lblSSID.Content    = "No Network";
                        lblIP.Content      = "";
                    }
                    else
                    {
                        lblSSID.Content = ssid;
                        lblIP.Content   = String.Format("{0}:{1}", ip, port);
                        switch (mode)
                        {
                        case 1:
                            lblSSID.Foreground = Brushes.LightBlue;
                            break;

                        case 2:
                            lblSSID.Foreground = Brushes.LightPink;
                            break;

                        default:
                            lblSSID.Foreground = Brushes.Red;
                            break;
                        }
                    }
                }
                else
                {
                    lblSSID.Foreground = Brushes.Red;
                    lblSSID.Content    = "Unknown Network";
                    lblIP.Content      = "";
                }
                UpdateBattery();
                batteryTimer.Start();
            }
            SetStatus();
            Mouse.OverrideCursor = null;
            // TODO: check servo setting
            if (UBT.connected)
            {
                if (SYSTEM.configObject.max_servo != UBT.config.maxServo)
                {
                    MessageBox.Show(String.Format("*** 舵机数目不符 ***\n\n上位机设定为: {0}\n主控板设定为: {1}\n舵机数目不符, 系统会出现不正常反应.\n\n请尽快修正错误设定", SYSTEM.configObject.max_servo, UBT.config.maxServo), "上位机跟主控有冲突", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                }
            }
        }