private void Find_Click(object sender, RoutedEventArgs e) { var find = new FindEt(); find.ShowDialog(); // get data var resultEt = entertainmentUtil.FindEntertainmentBy(GetStringValue); if (resultEt != null) { txtEtName.Text = resultEt.EnterName; txtLink.Text = resultEt.Links; txtAuthorEnter.Text = resultEt.AuthorEnter; lstListEtCategory.Text = resultEt.Category; } var resultLink = entertainmentUtil.FindEntertainmentByLink(GetStringValue); if (resultLink != null) { txtEtName.Text = resultLink.EnterName; txtLink.Text = resultLink.Links; txtAuthorEnter.Text = resultLink.AuthorEnter; lstListEtCategory.Text = resultLink.Category; } }
private void btnFind_Click(object sender, RoutedEventArgs e) { if (txtFind.Text != "") { var selectedValue = comboxBoxEnterLink.SelectedValue as string; if (selectedValue == TypeEntertainmentsConstant.EnterName) { var result = entertainmentUtil.FindEntertainmentBy(txtFind.Text); if (result != null) { lblFindResult.Foreground = Brushes.Green; lblFindResult.Content = $"Found '{txtFind.Text}'"; // Send value to EntertainemntMain foreach (Window item in Application.Current.Windows) { if (item is EntertainemntMain) { ((EntertainemntMain)item).GetName(txtFind.Text); } } if (cbxAutoClose.IsChecked.Value) // if true { Close(); } } else { lblFindResult.Foreground = Brushes.Red; lblFindResult.Content = $"Nothing found"; } } else if (selectedValue == TypeEntertainmentsConstant.Link) { var result = entertainmentUtil.FindEntertainmentByLink(txtFind.Text); if (result != null) { lblFindResult.Foreground = Brushes.Green; lblFindResult.Content = $"Found '{txtFind.Text}'"; // Send value to EntertainemntMain foreach (Window item in Application.Current.Windows) { if (item is EntertainemntMain) { ((EntertainemntMain)item).GetName(txtFind.Text); } } if (cbxAutoClose.IsChecked.Value) // if true { Close(); } } else { lblFindResult.Foreground = Brushes.Red; lblFindResult.Content = $"Nothing found"; } } else { lblFindResult.Foreground = Brushes.Red; lblFindResult.Content = $"Nothing found"; } } else { lblFindResult.Foreground = Brushes.Red; lblFindResult.Content = $"You must type a Et name"; } }