Skip to content

Commit

Permalink
- Adds last used files for ah64 dtc
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoGer committed May 27, 2024
1 parent 0469b3c commit 06e61dd
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 126 deletions.
24 changes: 12 additions & 12 deletions CoordinateConverter/DCS/Tools/FormAH64DTC.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion CoordinateConverter/DCS/Tools/FormAH64DTC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public FormAH64DTC(MainForm parent, bool isPilot)
IsPilot = isPilot;
InitializeComponent();

data = new AH64DTCData(isPilot);
UpdateFileList();

data = new AH64DTCData(isPilot);
{
// Adjust Frequency NumericUpDowns
var preset = data.GetAH64RadioPreset(AH64DTCData.EPreset.Preset1);
Expand Down Expand Up @@ -2192,6 +2193,7 @@ private void LoadFile(FileInfo fi)
{
toolTip.Show(ex.Message, toolStrip1, 0, toolStrip1.Height, 5000);
}
UpdateFileList();
}

private void btnSave_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -2229,8 +2231,33 @@ private void SaveFile(FileInfo fi)
{
toolTip.Show(ex.Message, toolStrip1, 0, toolStrip1.Height, 5000);
}
UpdateFileList();
}

void UpdateFileList()
{
btnLoad.DropDownItems.Clear();
var files = parent.SettingsData.RecentFiles[Settings.ELastFileSource.AH64DTC];

if (files == null)
{
return;
}

foreach (string file in files)
{
var fi = new FileInfo(file);
if (!fi.Exists)
{
continue;
}

var tsmi = new ToolStripMenuItem(fi.FullName);
tsmi.Click += (s, e) => LoadFile(fi);

btnLoad.DropDownItems.Add(tsmi);
}
}
#endregion
}
}
Loading

0 comments on commit 06e61dd

Please sign in to comment.