Example #1
0
        private void CargarListas()
        {
            var ObtenerParametrosUsuario = new cParametro().Obtener(ObjEmpleadoCentro.ID_CENTRO);

            if (ObtenerParametrosUsuario != null)
            {
                LstParametros = new ObservableCollection <PARAMETRO>(ObtenerParametrosUsuario);
            }
            else
            {
                LstParametros = new ObservableCollection <PARAMETRO>();
            }
            var predicate = PredicateBuilder.True <CENTRO>();

            predicate  = predicate.And(where => where.ESTATUS.Equals("S"));
            LstCentros = new System.Collections.ObjectModel.ObservableCollection <CENTRO>(new cCentro().GetData(predicate.Expand()));
            System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
            {
                LstCentros.Insert(0, new CENTRO()
                {
                    ID_CENTRO = -1, DESCR = "SELECCIONE"
                });
            }));
            AsignarMaxLenght();
        }
Example #2
0
        internal ReadOnlyObservableCollection(ICompositeList <T> list, System.Collections.ObjectModel.ObservableCollection <T> collection, IEqualityComparer <T> eq) : base(collection)
        {
            _List       = list;
            _Collection = collection;

            _Disposable = list.ChangesObservable(eq)
                          .Subscribe(change =>
            {
                int i = 0;
                foreach (var diff in change)
                {
                    switch (diff.Operation)
                    {
                    case DiffOperation.Match:
                        break;

                    case DiffOperation.Insert:
                        _Collection.Insert(i, diff.ElementFromCollection2.Value);
                        break;

                    case DiffOperation.Delete:
                        _Collection.RemoveAt(i);
                        i--;
                        break;

                    case DiffOperation.Replace:
                        _Collection[i] = diff.ElementFromCollection2.Value;
                        break;

                    case DiffOperation.Modify:
                        _Collection[i] = diff.ElementFromCollection2.Value;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    i++;
                }
            });
        }