public int AddSoftware(MzTabSoftware software) { if (Software == null) { Software = new List <MzTabSoftware>(); } Software.Add(software); return(Software.Count - 1 + MzTab.IndexBased); }
private void os_SelectionChanged(object sender, SelectionChangedEventArgs e) { Software.Clear(); if (SelectedOS == "Windows/Linux") { foreach (var soft in MainWindow.softwares) { Software.Add(soft.label); } } else if (SelectedOS == "Windows") { foreach (var soft in MainWindow.softwares) { if (soft.os != "Linux") { Software.Add(soft.label); } } } else { foreach (var soft in MainWindow.softwares) { if (soft.os != "Windows") { Software.Add(soft.label); } } } for (int i = Software.Count - 1; i > -1; i--) { foreach (var soft in SelectedSoftwares) { if (soft.label == Software[i]) { Software.RemoveAt(i); break; } } } SelectedSoftware = null; return; }
public SoftwareAlias this[int id] { get { lock (this) { if (!Software.TryGetValue(id, out var software)) { using var db = GetConnection(); var row = db.QueryFirst($@"{SelectQuery} WHERE ""Id"" = {id}"); software = Parse(row); Software.Add(id, software); } return(software); } } }