You can now save presets to JSON and load them

This commit is contained in:
2023-05-05 17:27:49 +02:00
parent 16be9bf7ef
commit 55d45adc1d
12 changed files with 134 additions and 129 deletions

View File

@@ -47,6 +47,7 @@ namespace Test_Merge
}
private void RefreshUI()
{
lsbDrivers.DataSource = null;
lsbDrivers.DataSource = DriverList;
@@ -385,5 +386,30 @@ namespace Test_Merge
}
RefreshUI();
}
private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e)
{
//Nothing
}
private void btnLoadPreset_Click(object sender, EventArgs e)
{
if (lsbPresets.SelectedIndex >= 0 && pbxMain.Image != null)
{
try
{
Reader reader = new Reader(lsbPresets.Items[lsbPresets.SelectedIndex].ToString(), (Bitmap)pbxMain.Image,false);
//MainZones #0 is the big main zone containing driver zones
Config = new ConfigurationTool((Bitmap)pbxMain.Image, reader.MainZones[0].Bounds);
Config.MainZone = reader.MainZones[0];
DriverList = reader.Drivers;
}
catch (Exception ex)
{
MessageBox.Show("Could not load the settings error :" + ex);
}
RefreshUI();
}
}
}
}