private void DisplayBrightGetBtn_Click(object sender, EventArgs e) { byte brightness = 0; Display_API.DISPLAY_GetBright(ref brightness); DisplayBrightComBox.Text = brightness.ToString(); }
private void DisplayOffRadioBtn_CheckedChanged(object sender, EventArgs e) { UInt16 LastErrCode = Display_API.DISPLAY_ScreenOff(); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("DISPLAY_ScreenOff fail!"); } }
private void Display_Load(object sender, EventArgs e) { UInt16 LastErrCode = Display_API.DISPLAY_Available(); if (LastErrCode == IMC_ERR_DISPLAY_FUNCTION_OK_SUPPORT) { DisplayBrightComBox.Enabled = true; DisplayBrightGetBtn.Enabled = true; DisplayBrightSetBtn.Enabled = true; DisplayOnRadioBtn.Enabled = true; DisplayOffRadioBtn.Enabled = true; } else if (LastErrCode == IMC_ERR_DISPLAY_FUNCTION_OK_ONLY_SCREEN_CONTROL) { MessageBox.Show("Platform only support screen on/off function!"); DisplayBrightComBox.Enabled = false; DisplayBrightGetBtn.Enabled = false; DisplayBrightSetBtn.Enabled = false; } else if (LastErrCode == IMC_ERR_DISPLAY_FUNCTION_OK_ONLY_BRIGHTNESS) { MessageBox.Show("Platform only support brightness control function!"); DisplayOnRadioBtn.Enabled = false; DisplayOffRadioBtn.Enabled = false; } else { MessageBox.Show("Platform not support display function!"); DisplayBrightComBox.Enabled = false; DisplayBrightGetBtn.Enabled = false; DisplayBrightSetBtn.Enabled = false; DisplayOnRadioBtn.Enabled = false; DisplayOffRadioBtn.Enabled = false; } if ((LastErrCode == IMC_ERR_DISPLAY_FUNCTION_OK_SUPPORT) || (LastErrCode == IMC_ERR_DISPLAY_FUNCTION_OK_ONLY_BRIGHTNESS)) { Display_API.IMC_DISPLAY_GET_BRIGHT_RANGE Parm_GBR = new Display_API.IMC_DISPLAY_GET_BRIGHT_RANGE(); DisplayBrightComBox.Items.Clear(); unsafe { byte max = 0; Parm_GBR.maximum = &max; byte min = 0; Parm_GBR.minimum = &min; byte step = 0; Parm_GBR.stepping = &step; Display_API.DISPLAY_GetBrightRange(ref Parm_GBR); byte ChangeScale = (byte)((max - min) / step); for (int i = 0; i <= ChangeScale; i++) { int TempScale = i * step; DisplayBrightComBox.Items.Add(TempScale.ToString()); } } } byte[] byLibVersion = new byte[Display_API.IMC_LIB_VERSION_SIZE]; LastErrCode = Display_API.DISPLAY_GetLibVersion(byLibVersion); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get library version"); return; } int nRealSize; StaticLibVersionValue.Text = ConvertByte2String(byLibVersion, byLibVersion.Length, out nRealSize); }
private void DisplayBrightSetBtn_Click(object sender, EventArgs e) { byte brightness = Convert.ToByte(DisplayBrightComBox.Text); Display_API.DISPLAY_SetBright(brightness); }