private void btnActivateSmokeLimiters_ItemClick(object sender, ItemClickEventArgs e)
{
if (Tools.Instance.m_currentfile != string.Empty)
{
if (File.Exists(Tools.Instance.m_currentfile))
{
btnActivateSmokeLimiters.Enabled = false;
// find the smoke limiter control map (selector)
foreach (SymbolHelper sh in Tools.Instance.m_symbols)
{
if (sh.Varname.StartsWith("Smoke limiter"))
{
byte[] mapdata = new byte[sh.Length];
mapdata.Initialize();
mapdata = Tools.Instance.readdatafromfile(Tools.Instance.m_currentfile, (int)sh.Flash_start_address, sh.Length, Tools.Instance.m_currentFileType);
int selectorAddress = sh.MapSelector.StartAddress;
if (selectorAddress > 0)
{
byte[] mapIndexes = new byte[sh.MapSelector.MapIndexes.Length * 2];
int bIdx = 0;
for (int i = 0; i < sh.MapSelector.MapIndexes.Length; i++)
{
mapIndexes[bIdx++] = Convert.ToByte(i);
mapIndexes[bIdx++] = 0;
}
Tools.Instance.savedatatobinary(selectorAddress + mapIndexes.Length, mapIndexes.Length, mapIndexes, Tools.Instance.m_currentfile, false, Tools.Instance.m_currentFileType);
}
for (int i = 1; i < sh.MapSelector.MapIndexes.Length; i++)
{
// save the map data (copy)
int saveAddress = (int)sh.Flash_start_address + i * sh.Length;
Tools.Instance.savedatatobinary(saveAddress, sh.Length, mapdata, Tools.Instance.m_currentfile, false, Tools.Instance.m_currentFileType);
}
}
}
VerifyChecksum(Tools.Instance.m_currentfile, false, false);
}
}
Application.DoEvents();
if (!btnActivateSmokeLimiters.Enabled)
{
Tools.Instance.m_symbols = DetectMaps(Tools.Instance.m_currentfile, out Tools.Instance.codeBlockList, out Tools.Instance.AxisList, false, true);
gridControl1.DataSource = null;
Application.DoEvents();
gridControl1.DataSource = Tools.Instance.m_symbols;
Application.DoEvents();
try
{
gridViewSymbols.ExpandAllGroups();
}
catch (Exception)
{
}
Application.DoEvents();
}
}