private void addExecutables()// check if already in list { if (canAddExecutable()) { bool fileIsFilled = false; foreach (var item in Settings) { if (item.Name == "file" && !string.IsNullOrEmpty(item.Content)) { AddedExecutablesUI.Add(item.Content); fileIsFilled = true; } } if (fileIsFilled) { //AddedExecutables.Add(Settings); List <SettingsModel> settings = new List <SettingsModel>(); foreach (var item in Settings) { settings.Add(new SettingsModel(item.FieldType, item.Name, this) { Content = item.Content, FieldType = item.FieldType, Name = item.Name }); } AddedExecutables.Add(settings); } } }
private void deleteProgram() { for (int j = 0; j < AddedExecutables.Count; j++) { for (int i = 0; i < AddedExecutables[j].Count; i++) { if (AddedExecutables[j][i].Name == "file" && AddedExecutables[j][i].Content == SelectedAddedExecutablesUI) { AddedExecutablesUI.Remove(AddedExecutables[j][i].Content); AddedExecutables.Remove(AddedExecutables[j]); //SelectedAddedExecutablesUI = string.Empty; //maybe not needed Settings = new ObservableCollection <SettingsModel>(); break; } } } }