コード例 #1
0
ファイル: frmLanguages.xaml.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Muestra la ventana detalle en modo ReadOnly|edicion
        /// </summary>
        /// <history>
        /// [emoguel] 30/03/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            Language          language      = (Language)dgrLanguages.SelectedItem;
            frmLanguageDetail frmlangDetail = new frmLanguageDetail();

            frmlangDetail.Owner       = this;
            frmlangDetail.oldLanguage = language;
            frmlangDetail.enumMode    = ((_blnEdit == true)?EnumMode.Edit:EnumMode.ReadOnly);
            if (frmlangDetail.ShowDialog() == true)
            {
                int             nIndex       = 0;
                List <Language> lstLanguages = (List <Language>)dgrLanguages.ItemsSource;
                if (!ValidateFilter(frmlangDetail.language)) //Verificamos si cumple con los filtros actuales
                {
                    lstLanguages.Remove(language);           //Lo quitamos de la lista
                }
                else
                {
                    ObjectHelper.CopyProperties(language, frmlangDetail.language); //Actualizamos sus propiedades
                    lstLanguages.Sort((x, y) => string.Compare(x.laN, y.laN));     //Ordenamos la lista
                    nIndex = lstLanguages.IndexOf(language);                       //obtenemos el index
                }
                dgrLanguages.Items.Refresh();                                      //Actualizamos la vista del grid
                GridHelper.SelectRow(dgrLanguages, nIndex);
            }
        }
コード例 #2
0
ファイル: frmLanguages.xaml.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Abre la ventana de detalle en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 31/03/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmLanguageDetail frmlangDetail = new frmLanguageDetail();

            frmlangDetail.Owner    = this;
            frmlangDetail.enumMode = EnumMode.Add;
            if (frmlangDetail.ShowDialog() == true)
            {
                if (ValidateFilter(frmlangDetail.language))//verificamos si cumple con los filtros
                {
                    int             nIndex       = 0;
                    List <Language> lstLanguages = (List <Language>)dgrLanguages.ItemsSource;
                    lstLanguages.Add(frmlangDetail.language);                    //Agregamos el registro a la lista
                    lstLanguages.Sort((x, y) => string.Compare(x.laID, y.laID)); //ordenamos la lista
                    nIndex = lstLanguages.IndexOf(frmlangDetail.language);       //Buscamos el index del nuevo registro
                    dgrLanguages.Items.Refresh();                                //Actualizamos la vista del grid
                    GridHelper.SelectRow(dgrLanguages, nIndex);                  //Seleccionamos el registro nuevo
                }
            }
        }