private void TryAddActor() { if (!string.IsNullOrWhiteSpace(autoActors.Text)) { Actor actor_from_cast = CastCollection.Where(x => x.tag.ToLower().Trim() == autoActors.Text.ToLower().Trim()).FirstOrDefault(); if (actor_from_cast == null) { Actor actor_from_search = AllActorsCollection.Where(x => x.tag.Trim() == autoActors.Text.Trim()).FirstOrDefault(); if (actor_from_search != null) { CastCollection.Add(actor_from_search); } else { CastCollection.Add(new Actor() { id = -1, tag = autoActors.Text.Trim() }); } } } autoActors.Text = string.Empty; autoActors.SelectedItem = null; }
private void LoadCastCollection(long item_id) { CastCollection.Clear(); ContainerCast.Visibility = Visibility.Visible; MainGrid.RowDefinitions[2].Height = new GridLength(65); autoActors.Text = string.Empty; lvActors.ItemsSource = null; foreach (DataRow row in Database.GetActors(item_id).Rows) { CastCollection.Add(new Actor() { id = long.Parse(row["id"].ToString()), tag = row["tag"].ToString() }); } lvActors.ItemsSource = CastCollection; }