private void timer1_Tick(object sender, EventArgs e) { byte[] buff; buff = fc.getChar((byte)t_i); fp.WriteCharSet(t_i, buff); t_i++; progressBar1.Value = t_i; progressBar1.Invalidate(); if (t_i > 255) { timer1.Enabled = false; fp.Close(); progressBar1.Value = 0; progressBar1.Invalidate(); } }
void mouseEvent(Panel panel, MouseEventArgs e, FileCharset charset) { int c = e.X / (FileCharset.CharWidth + 2); int f = e.Y / (FileCharset.CharHeight + 2); byte id = (byte)((f * 16) + c); if (e.Button == MouseButtons.Left) { character = charset.getChar(id); panel3.Invalidate(); } else if (e.Button == MouseButtons.Right) { if (charset != null && character != null) { charset.setChar(id, character); } panel.Invalidate(); } }
private void button1_Click(object sender, EventArgs e) { FlightPlanUSB fp = new FlightPlanUSB(); if (fp.IsOpen()) { IkarusBasicConfig basiccfg = new IkarusBasicConfig(); basiccfg.LoadDefaults(); basiccfg.LoadFromXmlString(global::UAVConsole.Properties.Resources.osd_config); basiccfg.videoPAL = (byte)(1 - comboBoxVideoSystem.SelectedIndex); basiccfg.BaudRate = (byte)comboBoxGPSBaudRate.SelectedIndex; basiccfg.Modo_PPM = (byte)comboBoxModoPPM.SelectedIndex; basiccfg.PPM_Channel = (byte)(comboBoxCanalPPM.SelectedIndex + 4); TimeSpan rafa = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime()); basiccfg.TimeZone = (sbyte)rafa.Hours; fp.WriteConfig(basiccfg); IkarusAutopilotConfig autocfg = new IkarusAutopilotConfig(); autocfg.LoadDefaults(); autocfg.LoadFromXmlString(global::UAVConsole.Properties.Resources.autopilot_config); autocfg.tipo_mezcla = (byte)comboBoxTipoMezcla.SelectedIndex; fp.WriteConfigAutopilot(autocfg); if (checkBoxActualizarHUDs.Checked) { IkarusScreenConfig scr = new IkarusScreenConfig(); scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD1); fp.WriteScreen(0, scr); // HUD 0 scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD2); fp.WriteScreen(1, scr); // HUD 1 scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD3); fp.WriteScreen(2, scr); // HUD 2 scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.Failsafe); fp.WriteScreen(3, scr); // FailSafe scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.Resumen); fp.WriteScreen(4, scr); // Resumen } if (checkBoxActualizarCharSet.Checked) { MemoryStream stream = new MemoryStream(global::UAVConsole.Properties.Resources.Ikarus); FileCharset fc = new FileCharset(new StreamReader(stream)); byte[] buff; for (int i = 0; i < 256; i++) { buff = fc.getChar((byte)i); fp.WriteCharSet(i, buff); } } fp.Close(); if (me.Idioma == 0) { MessageBox.Show("Realizado!"); } else { MessageBox.Show("Done!"); } this.Close(); } else if (me.Idioma == 0) { MessageBox.Show("No esta conectado!"); } else { MessageBox.Show("Not connected!"); } }