project removing fix

This commit is contained in:
Alex Z 2020-03-07 02:11:22 +03:00
parent 3a33fde10a
commit 174f7baa16
2 changed files with 3 additions and 2 deletions

View File

@ -34,7 +34,7 @@ namespace UniversalValveToolbox.Model.ViewModel {
ForceUpdateField(value, ref selectProjectIndex);
OnPropertyChanged(nameof(SelectProject));
var index = Math.Max(engines.ToList().FindIndex(engine => engine.Appid == SelectProject.Engine), 0);
var index = Math.Max(engines.ToList().FindIndex(engine => engine.Appid == SelectProject?.Engine), -1);
SelectEngineIndex = index;
}

View File

@ -85,6 +85,7 @@ namespace UniversalValveToolbox {
}
private void comboBoxEngine_SelectedIndexChanged(object sender, EventArgs e) {
if (model.SelectProject != null)
model.SelectProject.Engine = ((EngineDtoModel)comboBoxEngine.SelectedItem).Appid;
}