private void InfoClick(object s, RoutedEventArgs e) { Database.Data data = (Database.Data)((ListBoxItem)this.FindControl <ListBox>("list").SelectedItem).DataContext; InfoWindow window = new InfoWindow(); List <string> cont = new List <string>(); foreach (int i in data.contrib) { cont.Add(Database.names[i]); } window.init(data.formula, data.name, data.cas, data.smiles, data.mol, cont); window.Show(); }
private async void EditClick(object s, RoutedEventArgs e) { if (this.FindControl <ListBox>("list").SelectedItem == null) { return; } Database.Data data = (Database.Data)((ListBoxItem)this.FindControl <ListBox>("list").SelectedItem).DataContext; EditPanel panel = new EditPanel(); panel.Change(data.formula, data.name, data.cas, data.smiles); await panel.ShowDialog(this); if (!panel.exitNormally) { return; } this.FindControl <ListBox>("list").SelectedItem = null; // this.FindControl<ListBox>("list").Items = new List<ListBoxItem>().ToImmutableArray(); this.FindControl <ListBox>("list").Items = Restore.db.Add(panel.F, panel.N, panel.C, panel.S); this.FindControl <TextBox>("Searchbox").Text = ""; }