public void llenarCmbModulo() { ModuloControl moduloControl = new ModuloControl(); List <Modulo> moduloList = moduloControl.obtenerAllModulo(); Cmb_Modulo.ValueMember = "MODULO"; Cmb_Modulo.DisplayMember = "NOMBRE"; Cmb_Modulo.DataSource = moduloList; }
public void FromRegistry() { RegistryKey key = Registry.CurrentUser.OpenSubKey(registryPath); if (key != null) { try { this.GoogleMapsCookie = (string)key.GetValue("GoogleMapsCookie"); this.HomeLon = float.Parse(key.GetValue("HomeLon").ToString(),CultureInfo.InvariantCulture); this.HomeLat = float.Parse(key.GetValue("HomeLat").ToString(), CultureInfo.InvariantCulture); this.HomeAlt = float.Parse(key.GetValue("HomeAlt").ToString(), CultureInfo.InvariantCulture); this.videoCaptureStr = (string)key.GetValue("VideoCaptureStr"); this.telemetria = (Telemetria)key.GetValue("Telemetry"); this.videosystem = (VideoSystem)key.GetValue("VideoSystem"); this.commPort = (string)key.GetValue("CommPort"); this.commBps = (int)key.GetValue("CommBauds"); this.CacheMapsPath = (string)key.GetValue("CacheMapsPath"); this.FlightLogPath = (string)key.GetValue("FlightLogPath"); this.cells1 = (int)key.GetValue("CellCount1"); this.cells2 = (int)key.GetValue("CellCount2"); this.moduloTX = (Singleton.ModuloControl)(int)key.GetValue("ModuloTX"); try { for (int i = 0; i < servo_ch.Length; i++) { this.servo_min[i] = (int)key.GetValue("ServoMin" + i); this.servo_center[i] = (int)key.GetValue("ServoCenter" + i); this.servo_max[i] = (int)key.GetValue("ServoMax" + i); this.servo_rev[i] = (int)key.GetValue("ServoRev" + i) == 1; this.servo_ch[i] = (byte)((int)key.GetValue("ServoCh" + i)); } for (int i = 0; i < 16; i++) { this.joy_buttons[i] = (byte)((int)key.GetValue("JoyButtom" + i)); } this.tipo_mezcla = (Mezclas)key.GetValue("TipoMezcla"); // this.tipo_control = (ModoControl)key.GetValue("TipoControl"); this.rev_mix = (int)key.GetValue("rev_mix") == 1; this.rev_flap = (int)key.GetValue("rev_flap") == 1; this.full_flap = float.Parse(key.GetValue("full_flap").ToString()); this.step_flap = float.Parse(key.GetValue("step_flap").ToString()); this.pantilt_speed = float.Parse(key.GetValue("pantilt_speed").ToString()); this.enable_axis = (int)key.GetValue("AXISenable") == 1; this.enable_pan = (int)key.GetValue("PANenable") == 1; this.enable_tilt = (int)key.GetValue("TILTenable") == 1; this.enable_headtrack = (int)key.GetValue("enable_headtrack") == 1; object pepe = key.GetValue("headtrack_panCh"); this.headtrack_panCh = (byte)((int)key.GetValue("headtrack_panCh")); this.headtrack_tiltCh = (byte)((int)key.GetValue("headtrack_tiltCh")); this.uplinkVmax = float.Parse(key.GetValue("uplinkVmax").ToString(), CultureInfo.InvariantCulture); this.uplinkVmin = float.Parse(key.GetValue("uplinkVmin").ToString(), CultureInfo.InvariantCulture); this.uplinkValarm = float.Parse(key.GetValue("uplinkValarm").ToString(), CultureInfo.InvariantCulture); this.uplinkLipo = (int)key.GetValue("uplinkLipo") == 1; this.uplinkNumCells = (int)key.GetValue("uplinkNumCells"); this.useEmisora = (int)key.GetValue("useEmisora") == 1; this.txNumCanales = (byte)((int)key.GetValue("txNumCanales")); ; this.txPeriodo = (int)key.GetValue("txPeriodo"); ; this.txSeparador = (int)key.GetValue("txSeparador"); this.txPolarity = (int)key.GetValue("txPolarity") == 1; } catch (Exception) { }; //Configuracion joystick try { this.Idioma = (int)key.GetValue("Language"); this.SistemaMetrico = (int)key.GetValue("SistemaMetrico"); } catch (Exception) { } this.NombrePiloto = key.GetValue("NombrePiloto").ToString(); this.portUDPinout = (int)key.GetValue("portUDPinout"); this.portWebServer = (int)key.GetValue("portWebServer"); this.enableWebServer = (int)key.GetValue("enableWebServer") == 1; this.enableUDPinout = (int)key.GetValue("enableUDPinout") == 1; try { this.AlarmAltitude_enabled = (int)key.GetValue("AlarmAltitude_enabled") == 1; this.AlarmAltitude = float.Parse(key.GetValue("AlarmAltitude").ToString(), CultureInfo.InvariantCulture); this.AlarmAscenso_enabled = (int)key.GetValue("AlarmAscenso_enabled") == 1; this.AlarmAscenso = float.Parse(key.GetValue("AlarmAscenso").ToString(), CultureInfo.InvariantCulture); this.AlarmCellVoltage_enabled = (int)key.GetValue("AlarmCellVoltage_enabled") == 1; this.AlarmCellVoltage = float.Parse(key.GetValue("AlarmCellVoltage").ToString(), CultureInfo.InvariantCulture); this.AlarmDistance_enabled = (int)key.GetValue("AlarmDistance_enabled") == 1; this.AlarmDistance = float.Parse(key.GetValue("AlarmDistance").ToString(), CultureInfo.InvariantCulture); this.AlarmFastDescentRate_enabled = (int)key.GetValue("AlarmFastDescentRate_enabled") == 1; this.AlarmFastDescentRate = float.Parse(key.GetValue("AlarmFastDescentRate").ToString(), CultureInfo.InvariantCulture); } catch (Exception) { }; try { this.enableAntTrack = (int)key.GetValue("enableAntTrack") == 1; this.enableCasaAntTrack = (int)key.GetValue("enaleCasaAntTrack")==1; } catch (Exception){}; try { for (int i = 0; i < asignaciones.Length; i++) { this.asignaciones[i] = (int)key.GetValue("TeclaAsignada" + i); } } catch (Exception) { }; try { // Uplink debug values this.uplink_pid_ail_P = float.Parse(key.GetValue("uplink_pid_ail_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_I = float.Parse(key.GetValue("uplink_pid_ail_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_D = float.Parse(key.GetValue("uplink_pid_ail_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_IL = float.Parse(key.GetValue("uplink_pid_ail_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_DL = float.Parse(key.GetValue("uplink_pid_ail_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_P = float.Parse(key.GetValue("uplink_pid_ele_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_I = float.Parse(key.GetValue("uplink_pid_ele_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_D = float.Parse(key.GetValue("uplink_pid_ele_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_IL = float.Parse(key.GetValue("uplink_pid_ele_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_DL = float.Parse(key.GetValue("uplink_pid_ele_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_P = float.Parse(key.GetValue("uplink_pid_thr_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_I = float.Parse(key.GetValue("uplink_pid_thr_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_D = float.Parse(key.GetValue("uplink_pid_thr_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_IL = float.Parse(key.GetValue("uplink_pid_thr_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_DL = float.Parse(key.GetValue("uplink_pid_thr_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_P = float.Parse(key.GetValue("uplink_pid_tail_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_I = float.Parse(key.GetValue("uplink_pid_tail_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_D = float.Parse(key.GetValue("uplink_pid_tail_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_IL = float.Parse(key.GetValue("uplink_pid_tail_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_DL = float.Parse(key.GetValue("uplink_pid_tail_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_offX = float.Parse(key.GetValue("uplink_IR_offX").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_offY = float.Parse(key.GetValue("uplink_IR_offY").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_gain = float.Parse(key.GetValue("uplink_IR_gain").ToString(), CultureInfo.InvariantCulture); this.uplink_rumbo_ail = float.Parse(key.GetValue("uplink_rumbo_ail").ToString(), CultureInfo.InvariantCulture); this.uplink_altura_ele = float.Parse(key.GetValue("uplink_altura_ele").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_rev_P = (int)key.GetValue("uplink_IR_rev_P") == 1; this.uplink_IR_rev_R = (int)key.GetValue("uplink_IR_rev_R") == 1; this.uplink_IR_cross = (int)key.GetValue("uplink_IR_cross") == 1; this.uplink_IR_rev_cross = (int)key.GetValue("uplink_IR_rev_cross")==1; } catch (Exception) { }; this.PicturePath = (string)key.GetValue("PicturePath", "C:\\Fotos"); this.VideosPath = (string)key.GetValue("VideosPath", "C:\\Videos"); try { this.trocearVideo = (int)key.GetValue("trocearVideo") == 1; this.trocearTamMB = (int)key.GetValue("trocearTamMB"); this.calidadVideo = (int)key.GetValue("calidadVideo"); this.fpsVideo = (int)key.GetValue("fpsVideo"); } catch (Exception) { }; } catch (Exception) { } } else Registry.CurrentUser.CreateSubKey(registryPath); }
public void FromRegistry() { RegistryKey key = Registry.CurrentUser.OpenSubKey(registryPath); if (key != null) { try { this.GoogleMapsCookie = (string)key.GetValue("GoogleMapsCookie"); this.HomeLon = float.Parse(key.GetValue("HomeLon").ToString(), CultureInfo.InvariantCulture); this.HomeLat = float.Parse(key.GetValue("HomeLat").ToString(), CultureInfo.InvariantCulture); this.HomeAlt = float.Parse(key.GetValue("HomeAlt").ToString(), CultureInfo.InvariantCulture); this.videoCaptureStr = (string)key.GetValue("VideoCaptureStr"); this.telemetria = (Telemetria)key.GetValue("Telemetry"); this.videosystem = (VideoSystem)key.GetValue("VideoSystem"); this.commPort = (string)key.GetValue("CommPort"); this.commBps = (int)key.GetValue("CommBauds"); this.CacheMapsPath = (string)key.GetValue("CacheMapsPath"); this.FlightLogPath = (string)key.GetValue("FlightLogPath"); this.cells1 = (int)key.GetValue("CellCount1"); this.cells2 = (int)key.GetValue("CellCount2"); this.moduloTX = (Singleton.ModuloControl)(int) key.GetValue("ModuloTX"); try { for (int i = 0; i < servo_ch.Length; i++) { this.servo_min[i] = (int)key.GetValue("ServoMin" + i); this.servo_center[i] = (int)key.GetValue("ServoCenter" + i); this.servo_max[i] = (int)key.GetValue("ServoMax" + i); this.servo_rev[i] = (int)key.GetValue("ServoRev" + i) == 1; this.servo_ch[i] = (byte)((int)key.GetValue("ServoCh" + i)); } for (int i = 0; i < 16; i++) { this.joy_buttons[i] = (byte)((int)key.GetValue("JoyButtom" + i)); } this.tipo_mezcla = (Mezclas)key.GetValue("TipoMezcla"); // this.tipo_control = (ModoControl)key.GetValue("TipoControl"); this.rev_mix = (int)key.GetValue("rev_mix") == 1; this.rev_flap = (int)key.GetValue("rev_flap") == 1; this.full_flap = float.Parse(key.GetValue("full_flap").ToString()); this.step_flap = float.Parse(key.GetValue("step_flap").ToString()); this.pantilt_speed = float.Parse(key.GetValue("pantilt_speed").ToString()); this.enable_axis = (int)key.GetValue("AXISenable") == 1; this.enable_pan = (int)key.GetValue("PANenable") == 1; this.enable_tilt = (int)key.GetValue("TILTenable") == 1; this.enable_headtrack = (int)key.GetValue("enable_headtrack") == 1; object pepe = key.GetValue("headtrack_panCh"); this.headtrack_panCh = (byte)((int)key.GetValue("headtrack_panCh")); this.headtrack_tiltCh = (byte)((int)key.GetValue("headtrack_tiltCh")); this.uplinkVmax = float.Parse(key.GetValue("uplinkVmax").ToString(), CultureInfo.InvariantCulture); this.uplinkVmin = float.Parse(key.GetValue("uplinkVmin").ToString(), CultureInfo.InvariantCulture); this.uplinkValarm = float.Parse(key.GetValue("uplinkValarm").ToString(), CultureInfo.InvariantCulture); this.uplinkLipo = (int)key.GetValue("uplinkLipo") == 1; this.uplinkNumCells = (int)key.GetValue("uplinkNumCells"); this.useEmisora = (int)key.GetValue("useEmisora") == 1; this.txNumCanales = (byte)((int)key.GetValue("txNumCanales"));; this.txPeriodo = (int)key.GetValue("txPeriodo");; this.txSeparador = (int)key.GetValue("txSeparador"); this.txPolarity = (int)key.GetValue("txPolarity") == 1; } catch (Exception) { }; //Configuracion joystick try { this.Idioma = (int)key.GetValue("Language"); this.SistemaMetrico = (int)key.GetValue("SistemaMetrico"); } catch (Exception) { } this.NombrePiloto = key.GetValue("NombrePiloto").ToString(); this.portUDPinout = (int)key.GetValue("portUDPinout"); this.portWebServer = (int)key.GetValue("portWebServer"); this.enableWebServer = (int)key.GetValue("enableWebServer") == 1; this.enableUDPinout = (int)key.GetValue("enableUDPinout") == 1; try { this.AlarmAltitude_enabled = (int)key.GetValue("AlarmAltitude_enabled") == 1; this.AlarmAltitude = float.Parse(key.GetValue("AlarmAltitude").ToString(), CultureInfo.InvariantCulture); this.AlarmAscenso_enabled = (int)key.GetValue("AlarmAscenso_enabled") == 1; this.AlarmAscenso = float.Parse(key.GetValue("AlarmAscenso").ToString(), CultureInfo.InvariantCulture); this.AlarmCellVoltage_enabled = (int)key.GetValue("AlarmCellVoltage_enabled") == 1; this.AlarmCellVoltage = float.Parse(key.GetValue("AlarmCellVoltage").ToString(), CultureInfo.InvariantCulture); this.AlarmDistance_enabled = (int)key.GetValue("AlarmDistance_enabled") == 1; this.AlarmDistance = float.Parse(key.GetValue("AlarmDistance").ToString(), CultureInfo.InvariantCulture); this.AlarmFastDescentRate_enabled = (int)key.GetValue("AlarmFastDescentRate_enabled") == 1; this.AlarmFastDescentRate = float.Parse(key.GetValue("AlarmFastDescentRate").ToString(), CultureInfo.InvariantCulture); } catch (Exception) { }; try { this.enableAntTrack = (int)key.GetValue("enableAntTrack") == 1; this.enableCasaAntTrack = (int)key.GetValue("enaleCasaAntTrack") == 1; } catch (Exception) {}; try { for (int i = 0; i < asignaciones.Length; i++) { this.asignaciones[i] = (int)key.GetValue("TeclaAsignada" + i); } } catch (Exception) { }; try { // Uplink debug values this.uplink_pid_ail_P = float.Parse(key.GetValue("uplink_pid_ail_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_I = float.Parse(key.GetValue("uplink_pid_ail_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_D = float.Parse(key.GetValue("uplink_pid_ail_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_IL = float.Parse(key.GetValue("uplink_pid_ail_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ail_DL = float.Parse(key.GetValue("uplink_pid_ail_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_P = float.Parse(key.GetValue("uplink_pid_ele_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_I = float.Parse(key.GetValue("uplink_pid_ele_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_D = float.Parse(key.GetValue("uplink_pid_ele_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_IL = float.Parse(key.GetValue("uplink_pid_ele_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_ele_DL = float.Parse(key.GetValue("uplink_pid_ele_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_P = float.Parse(key.GetValue("uplink_pid_thr_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_I = float.Parse(key.GetValue("uplink_pid_thr_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_D = float.Parse(key.GetValue("uplink_pid_thr_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_IL = float.Parse(key.GetValue("uplink_pid_thr_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_thr_DL = float.Parse(key.GetValue("uplink_pid_thr_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_P = float.Parse(key.GetValue("uplink_pid_tail_P").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_I = float.Parse(key.GetValue("uplink_pid_tail_I").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_D = float.Parse(key.GetValue("uplink_pid_tail_D").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_IL = float.Parse(key.GetValue("uplink_pid_tail_IL").ToString(), CultureInfo.InvariantCulture); this.uplink_pid_tail_DL = float.Parse(key.GetValue("uplink_pid_tail_DL").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_offX = float.Parse(key.GetValue("uplink_IR_offX").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_offY = float.Parse(key.GetValue("uplink_IR_offY").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_gain = float.Parse(key.GetValue("uplink_IR_gain").ToString(), CultureInfo.InvariantCulture); this.uplink_rumbo_ail = float.Parse(key.GetValue("uplink_rumbo_ail").ToString(), CultureInfo.InvariantCulture); this.uplink_altura_ele = float.Parse(key.GetValue("uplink_altura_ele").ToString(), CultureInfo.InvariantCulture); this.uplink_IR_rev_P = (int)key.GetValue("uplink_IR_rev_P") == 1; this.uplink_IR_rev_R = (int)key.GetValue("uplink_IR_rev_R") == 1; this.uplink_IR_cross = (int)key.GetValue("uplink_IR_cross") == 1; this.uplink_IR_rev_cross = (int)key.GetValue("uplink_IR_rev_cross") == 1; } catch (Exception) { }; this.PicturePath = (string)key.GetValue("PicturePath", "C:\\Fotos"); this.VideosPath = (string)key.GetValue("VideosPath", "C:\\Videos"); try { this.trocearVideo = (int)key.GetValue("trocearVideo") == 1; this.trocearTamMB = (int)key.GetValue("trocearTamMB"); this.calidadVideo = (int)key.GetValue("calidadVideo"); this.fpsVideo = (int)key.GetValue("fpsVideo"); } catch (Exception) { }; } catch (Exception) { } } else { Registry.CurrentUser.CreateSubKey(registryPath); } }