Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCSViews: FlightData: persist namedfloat over re-load #2780

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,24 @@ public FlightData()
string[] lines = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
foreach (string option in lines)
{
string desc = MainV2.comPort.MAV.cs.GetNameandUnit(option);
using (var cb = new CheckBox {Name = option, Checked = true, Text = desc})
string name = option;
if (option.StartsWith("customfield"))
{
// add empty custom felids so the are un-tickable
if (option.Length <= 12)
{
// string only contains key
CurrentState.custom_field_names.Add(option, "Unknown");
}
else
{
// both key and name
name = option.Substring(0,12);
CurrentState.custom_field_names.Add(name, option.Substring(12));
}
}
string desc = MainV2.comPort.MAV.cs.GetNameandUnit(name);
using (var cb = new CheckBox {Name = name, Checked = true, Text = desc})
{
chk_box_CheckedChanged(cb, EventArgs.Empty);
}
Expand Down Expand Up @@ -1784,7 +1800,12 @@ void chk_box_CheckedChanged(object sender, EventArgs e)
{
foreach (var curve in zg1.GraphPane.CurveList)
{
selected = selected + curve.Tag + "|";
string curve_name = curve.Tag.ToString();
if (curve_name.Contains("customfield"))
{
curve_name += ((CheckBox)sender).Text;
}
selected = selected + curve_name + "|";
}
}
catch
Expand Down