private async void Add_OrgaList(object sender, RoutedEventArgs e) { Organisateur orga = new Organisateur(); MyCustomContentDialogOrga dial = new MyCustomContentDialogOrga(); Grid myGrid = ((Grid)dial.FindName("Grid_Orga")); myGrid.DataContext = orga; await dial.ShowAsync(); if (dial.Result == MyResult.Ok) { using (var db = new PartyContext()) { db.organisateurs.Add(orga); db.SaveChanges(); } HashSet <String> currentOrga = new HashSet <String>(this.party.OrgaIDs); currentOrga.Add(orga.OrganisateurId.ToString()); this.party.OrgaIDs = currentOrga.ToList(); listOrga.ItemsSource = null; listOrga.ItemsSource = DatabaseHelper.GetOrgasByID(currentOrga.ToList()); } }
private async void Item_Orga_Click(object sender, ItemClickEventArgs e) { Organisateur item = (Organisateur)e.ClickedItem; MyCustomContentDialogOrga dial = new MyCustomContentDialogOrga(); Grid myGrid = ((Grid)dial.FindName("Grid_Orga")); myGrid.DataContext = item; await dial.ShowAsync(); listOrga.ItemsSource = null; listOrga.ItemsSource = DatabaseHelper.GetOrgasByID(this.party.OrgaIDs); }
private void Delete_Orga(object sender, RoutedEventArgs e) { Organisateur item = (sender as Button).Tag as Organisateur; List <Organisateur> OrgaTmp = DatabaseHelper.GetOrgasByID(this.party.OrgaIDs); OrgaTmp.Remove(OrgaTmp.Find(u => u.OrganisateurId == item.OrganisateurId)); this.party.OrgaIDs = OrgaTmp.Select(u => u.OrganisateurId.ToString()).ToList(); int indexRemove = listOrga.Items.IndexOf(item); listOrga.ItemsSource = null; listOrga.ItemsSource = DatabaseHelper.GetOrgasByID(this.party.OrgaIDs); }
private async void Email_Orga(object sender, RoutedEventArgs e) { Organisateur item = (sender as Button).Tag as Organisateur; var success = await Windows.System.Launcher.LaunchUriAsync(new Uri(@"mailto:" + item.Email)); }