private void BUT_simmulti_Click(object sender, EventArgs e) { Form frm = new Form(); var sim = new GCSViews.Simulation(); frm.Controls.Add(sim); frm.Size = sim.Size; sim.Dock = DockStyle.Fill; frm.Show(); }
public MainV2() { log.Info("Mainv2 ctor"); ShowAirports = true; // setup adsb Utilities.adsb.UpdatePlanePosition += adsb_UpdatePlanePosition; Form splash = Program.Splash; splash.Refresh(); Application.DoEvents(); instance = this; //disable dpi scaling if (Font.Name != "宋体") //Chinese displayed normally when scaling. But would be too small or large using this line of code. Font = new Font(Font.Name, 8.25f * 96f / CreateGraphics().DpiX, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont); InitializeComponent(); MyView = new MainSwitcher(this); View = MyView; AdvancedChanged += updateAdvanced; //startup console TCPConsole.Write((byte)'S'); // full screen //this.TopMost = true; //this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; //this.WindowState = FormWindowState.Maximized; _connectionControl = toolStripConnectionControl.ConnectionControl; _connectionControl.CMB_baudrate.TextChanged += this.CMB_baudrate_TextChanged; _connectionControl.CMB_serialport.SelectedIndexChanged += this.CMB_serialport_SelectedIndexChanged; _connectionControl.CMB_serialport.Click += this.CMB_serialport_Click; _connectionControl.TOOL_APMFirmware.SelectedIndexChanged += this.TOOL_APMFirmware_SelectedIndexChanged; _connectionControl.ShowLinkStats += (sender, e) => ShowConnectionStatsForm(); srtm.datadirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "srtm"; var t = Type.GetType("Mono.Runtime"); MONO = (t != null); speechEngine = new Speech(); Warnings.CustomWarning.defaultsrc = comPort.MAV.cs; Warnings.WarningEngine.Start(); // proxy loader - dll load now instead of on config form load new Transition(new TransitionType_EaseInEaseOut(2000)); //MyRenderer.currentpressed = MenuFlightData; //MainMenu.Renderer = new MyRenderer(); foreach (object obj in Enum.GetValues(typeof(Firmwares))) { _connectionControl.TOOL_APMFirmware.Items.Add(obj); } if (_connectionControl.TOOL_APMFirmware.Items.Count > 0) _connectionControl.TOOL_APMFirmware.SelectedIndex = 0; comPort.BaseStream.BaudRate = 115200; PopulateSerialportList(); if (_connectionControl.CMB_serialport.Items.Count > 0) { _connectionControl.CMB_baudrate.SelectedIndex = 8; _connectionControl.CMB_serialport.SelectedIndex = 0; } // ** Done splash.Refresh(); Application.DoEvents(); // set this before we reset it MainV2.config["NUM_tracklength"] = "200"; // create one here - but override on load MainV2.config["guid"] = Guid.NewGuid().ToString(); // load config xmlconfig(false); MissionPlanner.Utilities.Tracking.cid = new Guid(MainV2.config["guid"].ToString()); // setup guids for droneshare if (!MainV2.config.ContainsKey("plane_guid")) MainV2.config["plane_guid"] = Guid.NewGuid().ToString(); if (!MainV2.config.ContainsKey("copter_guid")) MainV2.config["copter_guid"] = Guid.NewGuid().ToString(); if (!MainV2.config.ContainsKey("rover_guid")) MainV2.config["rover_guid"] = Guid.NewGuid().ToString(); if (config.ContainsKey("language") && !string.IsNullOrEmpty((string)config["language"])) { changelanguage(CultureInfoEx.GetCultureInfo((string)config["language"])); } this.Text = splash.Text; titlebar = splash.Text; if (!MONO) // windows only { if (MainV2.config["showconsole"] != null && MainV2.config["showconsole"].ToString() == "True") { } else { int win = NativeMethods.FindWindow("ConsoleWindowClass", null); NativeMethods.ShowWindow(win, NativeMethods.SW_HIDE); // hide window } // prevent system from sleeping while mp open var previousExecutionState = NativeMethods.SetThreadExecutionState(NativeMethods.ES_CONTINUOUS | NativeMethods.ES_SYSTEM_REQUIRED); } ChangeUnits(); if (config["theme"] != null) { ThemeManager.SetTheme((ThemeManager.Themes)Enum.Parse(typeof(ThemeManager.Themes), MainV2.config["theme"].ToString())); if (ThemeManager.CurrentTheme == ThemeManager.Themes.Custom) { try { ThemeManager.BGColor = Color.FromArgb(int.Parse(MainV2.config["theme_bg"].ToString())); ThemeManager.ControlBGColor = Color.FromArgb(int.Parse(MainV2.config["theme_ctlbg"].ToString())); ThemeManager.TextColor = Color.FromArgb(int.Parse(MainV2.config["theme_text"].ToString())); ThemeManager.ButBG = Color.FromArgb(int.Parse(MainV2.config["theme_butbg"].ToString())); ThemeManager.ButBorder = Color.FromArgb(int.Parse(MainV2.config["theme_butbord"].ToString())); } catch { log.Error("Bad Custom theme - reset to standard"); ThemeManager.SetTheme(ThemeManager.Themes.BurntKermit); } } if (ThemeManager.CurrentTheme == ThemeManager.Themes.HighContrast) { switchlight(new menuicons2()); } } if (MainV2.config["showairports"] != null) { MainV2.ShowAirports = bool.Parse(config["showairports"].ToString()); } // set default ShowTFR = true; // load saved if (MainV2.config["showtfr"] != null) { MainV2.ShowTFR = bool.Parse(config["showtfr"].ToString()); } if (MainV2.config["enableadsb"] != null) { MainV2.instance.EnableADSB = bool.Parse(config["enableadsb"].ToString()); } // load this before the other screens get loaded if (MainV2.config["advancedview"] != null) { MainV2.Advanced = bool.Parse(config["advancedview"].ToString()); } else { // existing user - enable advanced view if (MainV2.config.Count > 3) { config["advancedview"] = true.ToString(); MainV2.Advanced = true; } else { config["advancedview"] = false.ToString(); } } try { log.Info("Create FD"); FlightData = new GCSViews.FlightData(); log.Info("Create FP"); FlightPlanner = new GCSViews.FlightPlanner(); //Configuration = new GCSViews.ConfigurationView.Setup(); log.Info("Create SIM"); Simulation = new GCSViews.Simulation(); //Firmware = new GCSViews.Firmware(); //Terminal = new GCSViews.Terminal(); FlightData.Width = MyView.Width; FlightPlanner.Width = MyView.Width; Simulation.Width = MyView.Width; } catch (ArgumentException e) { //http://www.microsoft.com/en-us/download/details.aspx?id=16083 //System.ArgumentException: Font 'Arial' does not support style 'Regular'. log.Fatal(e); CustomMessageBox.Show(e.ToString() + "\n\n Font Issues? Please install this http://www.microsoft.com/en-us/download/details.aspx?id=16083"); //splash.Close(); //this.Close(); Application.Exit(); } catch (Exception e) { log.Fatal(e); CustomMessageBox.Show("A Major error has occured : " + e.ToString()); Application.Exit(); } if (MainV2.config["CHK_GDIPlus"] != null) GCSViews.FlightData.myhud.UseOpenGL = !bool.Parse(MainV2.config["CHK_GDIPlus"].ToString()); if (MainV2.config["CHK_hudshow"] != null) GCSViews.FlightData.myhud.hudon = bool.Parse(MainV2.config["CHK_hudshow"].ToString()); try { if (config["MainLocX"] != null && config["MainLocY"] != null) { this.StartPosition = FormStartPosition.Manual; Point startpos = new Point(int.Parse(config["MainLocX"].ToString()), int.Parse(config["MainLocY"].ToString())); this.Location = startpos; } if (config["MainMaximised"] != null) { this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), config["MainMaximised"].ToString()); // dont allow minimised start state if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; this.Location = new Point(100, 100); } } if (config["MainHeight"] != null) this.Height = int.Parse(config["MainHeight"].ToString()); if (config["MainWidth"] != null) this.Width = int.Parse(config["MainWidth"].ToString()); if (config["CMB_rateattitude"] != null) MainV2.comPort.MAV.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString()); if (config["CMB_rateposition"] != null) MainV2.comPort.MAV.cs.rateposition = byte.Parse(config["CMB_rateposition"].ToString()); if (config["CMB_ratestatus"] != null) MainV2.comPort.MAV.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString()); if (config["CMB_raterc"] != null) MainV2.comPort.MAV.cs.raterc = byte.Parse(config["CMB_raterc"].ToString()); if (config["CMB_ratesensors"] != null) MainV2.comPort.MAV.cs.ratesensors = byte.Parse(config["CMB_ratesensors"].ToString()); if (config["speechenable"] != null) MainV2.speechEnable = bool.Parse(config["speechenable"].ToString()); if (MainV2.config["analyticsoptout"] != null) MissionPlanner.Utilities.Tracking.OptOut = bool.Parse(config["analyticsoptout"].ToString()); try { if (config["TXT_homelat"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lat = double.Parse(config["TXT_homelat"].ToString()); if (config["TXT_homelng"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lng = double.Parse(config["TXT_homelng"].ToString()); if (config["TXT_homealt"] != null) MainV2.comPort.MAV.cs.HomeLocation.Alt = double.Parse(config["TXT_homealt"].ToString()); // remove invalid entrys if (Math.Abs(MainV2.comPort.MAV.cs.HomeLocation.Lat) > 90 || Math.Abs(MainV2.comPort.MAV.cs.HomeLocation.Lng) > 180) MainV2.comPort.MAV.cs.HomeLocation = new PointLatLngAlt(); } catch { } } catch { } if (MainV2.comPort.MAV.cs.rateattitude == 0) // initilised to 10, configured above from save { CustomMessageBox.Show("NOTE: your attitude rate is 0, the hud will not work\nChange in Configuration > Planner > Telemetry Rates"); } // log dir if (config["logdirectory"] != null) MainV2.LogDir = config["logdirectory"].ToString(); // create log dir if it doesnt exist if (!Directory.Exists(MainV2.LogDir)) Directory.CreateDirectory(MainV2.LogDir); //System.Threading.Thread.Sleep(2000); Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; // make sure new enough .net framework is installed if (!MONO) { Microsoft.Win32.RegistryKey installed_versions = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP"); string[] version_names = installed_versions.GetSubKeyNames(); //version names start with 'v', eg, 'v3.5' which needs to be trimmed off before conversion double Framework = Convert.ToDouble(version_names[version_names.Length - 1].Remove(0, 1), CultureInfo.InvariantCulture); int SP = Convert.ToInt32(installed_versions.OpenSubKey(version_names[version_names.Length - 1]).GetValue("SP", 0)); if (Framework < 4.0) { CustomMessageBox.Show("This program requires .NET Framework 4.0. You currently have " + Framework); } } if (Program.Logo != null) { this.Icon = Icon.FromHandle(((Bitmap)Program.Logo).GetHicon()); } if (Program.Logo != null && Program.vvvvz) { MenuDonate.Click -= this.toolStripMenuItem1_Click; MenuDonate.Text = ""; MenuDonate.Image = Program.Logo; MenuDonate.Click += MenuCustom_Click; MenuFlightData.Visible = false; MenuFlightPlanner.Visible = true; MenuConfigTune.Visible = false; MenuHelp.Visible = false; MenuInitConfig.Visible = false; MenuSimulation.Visible = false; MenuTerminal.Visible = false; } Application.DoEvents(); Comports.Add(comPort); // save config to test we have write access xmlconfig(true); }
public void update(ref double[] servos, Simulation.FGNetFDM fdm) { for (int i = 0; i < servos.Length; i++) { var servo = servos[(int)self.motors[i].servo - 1]; if (servo <= 0.0) { motor_speed[i] = 0; } else { motor_speed[i] = scale_rc(i, (float)servo, 0.0f, 1.0f); //servos[i] = motor_speed[i]; } } double[] m = motor_speed; //# how much time has passed? DateTime t = DateTime.Now; TimeSpan delta_time = t - last_time; // 0.02 last_time = t; if (delta_time.TotalMilliseconds > 100) // somethings wrong / debug { delta_time = new TimeSpan(0, 0, 0, 0, 20); } // rotational acceleration, in degrees/s/s, in body frame Vector3 rot_accel = new Vector3(0, 0, 0); double thrust = 0.0; foreach (var i in range((self.motors.Length))) { rot_accel.x += -radians(5000.0) * sin(radians(self.motors[i].angle)) * m[i]; rot_accel.y += radians(5000.0) * cos(radians(self.motors[i].angle)) * m[i]; if (self.motors[i].clockwise) { rot_accel.z -= m[i] * radians(400.0); } else { rot_accel.z += m[i] * radians(400.0); } thrust += m[i] * self.thrust_scale; // newtons } // rotational air resistance rot_accel.x -= self.gyro.x * radians(5000.0) / self.terminal_rotation_rate; rot_accel.y -= self.gyro.y * radians(5000.0) / self.terminal_rotation_rate; rot_accel.z -= self.gyro.z * radians(400.0) / self.terminal_rotation_rate; // Console.WriteLine("rot_accel " + rot_accel.ToString()); // update rotational rates in body frame self.gyro += rot_accel * delta_time.TotalSeconds; // Console.WriteLine("gyro " + gyro.ToString()); // update attitude self.dcm.rotate(self.gyro * delta_time.TotalSeconds); self.dcm.normalize(); // air resistance Vector3 air_resistance = -self.velocity * (self.gravity / self.terminal_velocity); accel_body = new Vector3(0, 0, -thrust / self.mass); Vector3 accel_earth = self.dcm * accel_body; accel_earth += new Vector3(0, 0, self.gravity); accel_earth += air_resistance; // add in some wind (turn force into accel by dividing by mass). // accel_earth += self.wind.drag(self.velocity) / self.mass; // if we're on the ground, then our vertical acceleration is limited // to zero. This effectively adds the force of the ground on the aircraft if (self.on_ground() && accel_earth.z > 0) accel_earth.z = 0; // work out acceleration as seen by the accelerometers. It sees the kinematic // acceleration (ie. real movement), plus gravity self.accel_body = self.dcm.transposed() * (accel_earth + new Vector3(0, 0, -self.gravity)); // new velocity vector self.velocity += accel_earth * delta_time.TotalSeconds; if (double.IsNaN(velocity.x) || double.IsNaN(velocity.y) || double.IsNaN(velocity.z)) velocity = new Vector3(); // new position vector old_position = self.position.copy(); self.position += self.velocity * delta_time.TotalSeconds; if (home_latitude == 0) { home_latitude = fdm.latitude * rad2deg; home_longitude = fdm.longitude * rad2deg; home_altitude = altitude; } // constrain height to the ground if (self.on_ground()) { if (!self.on_ground(old_position)) Console.WriteLine("Hit ground at {0} m/s", (self.velocity.z)); self.velocity = new Vector3(0, 0, 0); // zero roll/pitch, but keep yaw double r = 0; double p = 0; double y = 0; self.dcm.to_euler(ref r, ref p, ref y); self.dcm.from_euler(0, 0, y); self.position = new Vector3(self.position.x, self.position.y, -(self.ground_level + self.frame_height - self.home_altitude)); } // update lat/lon/altitude self.update_position(delta_time.TotalSeconds); }
public MainV2() { log.Info("Mainv2 ctor"); Form splash = Program.Splash; splash.Refresh(); Application.DoEvents(); instance = this; InitializeComponent(); MyView = new MainSwitcher(this); View = MyView; POIs.CollectionChanged += POIs_CollectionChanged; // full screen //this.TopMost = true; //this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; //this.WindowState = FormWindowState.Maximized; _connectionControl = toolStripConnectionControl.ConnectionControl; _connectionControl.CMB_baudrate.TextChanged += this.CMB_baudrate_TextChanged; _connectionControl.CMB_serialport.SelectedIndexChanged += this.CMB_serialport_SelectedIndexChanged; _connectionControl.CMB_serialport.Enter += this.CMB_serialport_Enter; _connectionControl.CMB_serialport.Click += this.CMB_serialport_Click; _connectionControl.TOOL_APMFirmware.SelectedIndexChanged += this.TOOL_APMFirmware_SelectedIndexChanged; _connectionControl.ShowLinkStats += (sender, e) => ShowConnectionStatsForm(); srtm.datadirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "srtm"; var t = Type.GetType("Mono.Runtime"); MONO = (t != null); speechEngine = new Speech(); // proxy loader - dll load now instead of on config form load new Transition(new TransitionType_EaseInEaseOut(2000)); //MyRenderer.currentpressed = MenuFlightData; //MainMenu.Renderer = new MyRenderer(); foreach (object obj in Enum.GetValues(typeof(Firmwares))) { _connectionControl.TOOL_APMFirmware.Items.Add(obj); } if (_connectionControl.TOOL_APMFirmware.Items.Count > 0) _connectionControl.TOOL_APMFirmware.SelectedIndex = 0; comPort.BaseStream.BaudRate = 115200; // ** Old // CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); // CMB_serialport.Items.Add("TCP"); // CMB_serialport.Items.Add("UDP"); // if (CMB_serialport.Items.Count > 0) // { // CMB_baudrate.SelectedIndex = 7; // CMB_serialport.SelectedIndex = 0; // } // ** new _connectionControl.CMB_serialport.Items.Add("AUTO"); _connectionControl.CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); _connectionControl.CMB_serialport.Items.Add("TCP"); _connectionControl.CMB_serialport.Items.Add("UDP"); if (_connectionControl.CMB_serialport.Items.Count > 0) { _connectionControl.CMB_baudrate.SelectedIndex = 8; _connectionControl.CMB_serialport.SelectedIndex = 0; } // ** Done splash.Refresh(); Application.DoEvents(); // set this before we reset it MainV2.config["NUM_tracklength"] = "200"; // create one here - but override on load MainV2.config["guid"] = Guid.NewGuid().ToString(); // load config xmlconfig(false); MissionPlanner.Utilities.Tracking.cid = new Guid(MainV2.config["guid"].ToString()); if (config.ContainsKey("language") && !string.IsNullOrEmpty((string)config["language"])) { changelanguage(CultureInfoEx.GetCultureInfo((string)config["language"])); } this.Text = splash.Text; if (!MONO) // windows only { if (MainV2.config["showconsole"] != null && MainV2.config["showconsole"].ToString() == "True") { } else { int win = NativeMethods.FindWindow("ConsoleWindowClass", null); NativeMethods.ShowWindow(win, NativeMethods.SW_HIDE); // hide window } } ChangeUnits(); if (config["theme"] != null) { ThemeManager.SetTheme((ThemeManager.Themes)Enum.Parse(typeof(ThemeManager.Themes), MainV2.config["theme"].ToString())); if (ThemeManager.CurrentTheme == ThemeManager.Themes.Custom) { try { ThemeManager.BGColor = Color.FromArgb(int.Parse(MainV2.config["theme_bg"].ToString())); ThemeManager.ControlBGColor = Color.FromArgb(int.Parse(MainV2.config["theme_ctlbg"].ToString())); ThemeManager.TextColor = Color.FromArgb(int.Parse(MainV2.config["theme_text"].ToString())); ThemeManager.ButBG = Color.FromArgb(int.Parse(MainV2.config["theme_butbg"].ToString())); ThemeManager.ButBorder = Color.FromArgb(int.Parse(MainV2.config["theme_butbord"].ToString())); } catch { log.Error("Bad Custom theme - reset to standard"); ThemeManager.SetTheme(ThemeManager.Themes.BurntKermit); } } } try { log.Info("Create FD"); FlightData = new GCSViews.FlightData(); log.Info("Create FP"); FlightPlanner = new GCSViews.FlightPlanner(); //Configuration = new GCSViews.ConfigurationView.Setup(); log.Info("Create SIM"); Simulation = new GCSViews.Simulation(); //Firmware = new GCSViews.Firmware(); //Terminal = new GCSViews.Terminal(); // preload log.Info("Create Python"); Python.CreateEngine(); FlightData.Width = MyView.Width; FlightPlanner.Width = MyView.Width; Simulation.Width = MyView.Width; } catch (ArgumentException e) { //http://www.microsoft.com/en-us/download/details.aspx?id=16083 //System.ArgumentException: Font 'Arial' does not support style 'Regular'. log.Fatal(e); CustomMessageBox.Show(e.ToString() + "\n\n Font Issues? Please install this http://www.microsoft.com/en-us/download/details.aspx?id=16083"); //splash.Close(); //this.Close(); Application.Exit(); } catch (Exception e) { log.Fatal(e); CustomMessageBox.Show("A Major error has occured : " + e.ToString()); Application.Exit(); } if (MainV2.config["CHK_GDIPlus"] != null) GCSViews.FlightData.myhud.UseOpenGL = !bool.Parse(MainV2.config["CHK_GDIPlus"].ToString()); try { if (config["MainLocX"] != null && config["MainLocY"] != null) { this.StartPosition = FormStartPosition.Manual; Point startpos = new Point(int.Parse(config["MainLocX"].ToString()), int.Parse(config["MainLocY"].ToString())); this.Location = startpos; } if (config["MainMaximised"] != null) { this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), config["MainMaximised"].ToString()); // dont allow minimised start state if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; this.Location = new Point(100, 100); } } if (config["MainHeight"] != null) this.Height = int.Parse(config["MainHeight"].ToString()); if (config["MainWidth"] != null) this.Width = int.Parse(config["MainWidth"].ToString()); if (config["CMB_rateattitude"] != null) MainV2.comPort.MAV.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString()); if (config["CMB_rateposition"] != null) MainV2.comPort.MAV.cs.rateposition = byte.Parse(config["CMB_rateposition"].ToString()); if (config["CMB_ratestatus"] != null) MainV2.comPort.MAV.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString()); if (config["CMB_raterc"] != null) MainV2.comPort.MAV.cs.raterc = byte.Parse(config["CMB_raterc"].ToString()); if (config["CMB_ratesensors"] != null) MainV2.comPort.MAV.cs.ratesensors = byte.Parse(config["CMB_ratesensors"].ToString()); if (config["speechenable"] != null) MainV2.speechEnable = bool.Parse(config["speechenable"].ToString()); if (MainV2.config["analyticsoptout"] != null) MissionPlanner.Utilities.Tracking.OptOut = bool.Parse(config["analyticsoptout"].ToString()); if (MainV2.config["advancedview"] != null) { MainV2.Advanced = bool.Parse(config["advancedview"].ToString()); } else { // existing user - enable advanced view if (MainV2.config.Count > 3) { config["advancedview"] = true.ToString(); MainV2.Advanced = true; } else { config["advancedview"] = false.ToString(); } } try { if (config["TXT_homelat"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lat = double.Parse(config["TXT_homelat"].ToString()); if (config["TXT_homelng"] != null) MainV2.comPort.MAV.cs.HomeLocation.Lng = double.Parse(config["TXT_homelng"].ToString()); if (config["TXT_homealt"] != null) MainV2.comPort.MAV.cs.HomeLocation.Alt = double.Parse(config["TXT_homealt"].ToString()); } catch { } } catch { } if (MainV2.comPort.MAV.cs.rateattitude == 0) // initilised to 10, configured above from save { CustomMessageBox.Show("NOTE: your attitude rate is 0, the hud will not work\nChange in Configuration > Planner > Telemetry Rates"); } // log dir if (config["logdirectory"] != null) MainV2.LogDir = config["logdirectory"].ToString(); //System.Threading.Thread.Sleep(2000); // make sure new enough .net framework is installed if (!MONO) { Microsoft.Win32.RegistryKey installed_versions = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP"); string[] version_names = installed_versions.GetSubKeyNames(); //version names start with 'v', eg, 'v3.5' which needs to be trimmed off before conversion double Framework = Convert.ToDouble(version_names[version_names.Length - 1].Remove(0, 1), CultureInfo.InvariantCulture); int SP = Convert.ToInt32(installed_versions.OpenSubKey(version_names[version_names.Length - 1]).GetValue("SP", 0)); if (Framework < 4.0) { CustomMessageBox.Show("This program requires .NET Framework 4.0. You currently have " + Framework); } } if (Program.Logo != null) { this.Icon = Icon.FromHandle(((Bitmap)Program.Logo).GetHicon()); } if (Program.Logo != null && Program.vvvvz) { MenuDonate.Click -= this.toolStripMenuItem1_Click; MenuDonate.Text = ""; MenuDonate.Image = Program.Logo; MenuDonate.Click += MenuCustom_Click; MenuFlightData.Visible = false; MenuFlightPlanner.Visible = true; MenuConfigTune.Visible = false; MenuHelp.Visible = false; MenuInitConfig.Visible = false; MenuSimulation.Visible = false; MenuTerminal.Visible = false; } Application.DoEvents(); Comports.Add(comPort); // setup adsb Utilities.adsb.UpdatePlanePosition += adsb_UpdatePlanePosition; new Utilities.adsb(); //int fixmenextrelease; // if (MainV2.getConfig("fixparams") == "") { // Utilities.ParameterMetaDataParser.GetParameterInformation(); // MainV2.config["fixparams"] = 1; } }