private void button5_Click(object sender, EventArgs e) { try { fc = new FileCharset(textBox1.Text); } catch (Exception) { MessageBox.Show("Error abriendo fichero. Usando buildin"); MemoryStream stream = new MemoryStream(global::UAVConsole.Properties.Resources.Ikarus); fc = new FileCharset(new StreamReader(stream)); } fp = new FlightPlanUSB(); timer1.Interval = 200; t_i = 0; if (fp.IsOpen()) { timer1.Enabled = true; } else { MessageBox.Show("Not conected!"); } }
private void paintCharset(Graphics g, FileCharset charset) { for (int f = 0; f < 16; f++) { for (int c = 0; c < 16; c++) { g.DrawRectangle(Pens.Black, c * (FileCharset.CharWidth + 2), f * (FileCharset.CharHeight + 2), FileCharset.CharWidth + 1, FileCharset.CharHeight + 1); if (charset != null) { Bitmap bmp = charset.getCharBitmap((byte)(f * 16 + c)); g.DrawImageUnscaled(bmp, c * (FileCharset.CharWidth + 2) + 1, f * (FileCharset.CharHeight + 2) + 1); } } } }
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(); } }
public Instrumentos(Graphics g, FileCharset fc) { this.g = g; this.fcs = fc; }
public Instrumentos() { fcs = new FileCharset("Ikarus.mcm"); }
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!"); } }