/// <summary> /// Abre la ventalla de detalle /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [vku] 26/Jul/2016 Created /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { Season season = (Season)dgrSeasons.SelectedItem; frmSeasonDetail frmSeasonDetail = new frmSeasonDetail(); frmSeasonDetail.Owner = this; frmSeasonDetail.enumMode = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly; frmSeasonDetail.oldSeason = season; if (frmSeasonDetail.ShowDialog() == true) { List <Season> lstSeason = (List <Season>)dgrSeasons.ItemsSource; int nIndex = 0; if (!ValidateFilter(frmSeasonDetail.season)) { lstSeason.Remove(season);//Quitamos el registro de la lista } else { ObjectHelper.CopyProperties(season, frmSeasonDetail.season); lstSeason.Sort((x, Y) => string.Compare(x.ssN, Y.ssN));//Ordenamos la lista nIndex = lstSeason.IndexOf(season); } dgrSeasons.Items.Refresh(); //Actualizamos la vista del grid GridHelper.SelectRow(dgrSeasons, nIndex); StatusBarReg.Content = lstSeason.Count + " Seasons."; //Actualizamos el contador } }
/// <summary> /// Abre la ventana detalle en modo add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [vku] 26/Jul/2016 Created /// </history> private void btnAdd_Click(object sender, RoutedEventArgs e) { frmSeasonDetail frmSeasonDetail = new frmSeasonDetail(); frmSeasonDetail.Owner = this; frmSeasonDetail.enumMode = EnumMode.Add; if (frmSeasonDetail.ShowDialog() == true) { if (ValidateFilter(frmSeasonDetail.season))//Valida que cumpla con los filtros actuales { List <Season> lstSeason = (List <Season>)dgrSeasons.ItemsSource; lstSeason.Add(frmSeasonDetail.season); //Agrega el registro lstSeason.Sort((x, y) => string.Compare(x.ssN, y.ssN)); //ordena la lista int nIndex = lstSeason.IndexOf(frmSeasonDetail.season); //BUsca la posición del registro dgrSeasons.Items.Refresh(); //Refresca la vista GridHelper.SelectRow(dgrSeasons, nIndex); //Selecciona el registro StatusBarReg.Content = lstSeason.Count + " Seasons."; //Actualiza el contador } } }