Пример #1
0
        public ERPViewModelBase()
        {
            //this.dialogFactory = new ERPDialogFactory();
            //this.Callback = new Action<DataServiceQuery<T>>(query =>
            //{
            //    this.Items = new QueryableDataServiceCollectionView<T>(MainRepository.Context, query);
            //    //this.Items = new QueryableDataServiceCollectionView<T>(MainRepository.Context,query);
            //    this.Items.PageSize = 20;
            //    this.Items.LoadedData += this.OnItemsLoaded;
            //    this.Items.AutoLoad = true;
            //});

            this.AddNewRecordCommand = new DelegateCommand(
                (o) =>
            {
                dialogFactory.ShowNewDialog(this.GetNewItem());
                this.Refresh();
            });

            this.EditRecordCommand = new DelegateCommand(
                (o) =>
            {
                dialogFactory.TargetItemName = this.ItemName;
                dialogFactory.ShowEditDialog(this.ItemToEdit);
                this.Refresh();
            },
                (o) => this.ItemToEdit != null);

            //this.DeleteRecordCommand = new DelegateCommand(
            //    (o) =>
            //    {
            //        dialogFactory.TargetItemName = this.ItemName;
            //        if (dialogFactory.ShowDeleteDialog())
            //        {
            //            (this.ItemToEdit as ISavableObject).Delete();
            //            this.Refresh();
            //        }
            //    },
            //    (o) => this.ItemToEdit != null);
        }