public void Initialize()
        {
            this._dds                    = new DomainDataSource();
            this._dds.Loaded            += new RoutedEventHandler(this.DomainDataSourceLoaded);
            this._dds.LoadingData       += new EventHandler <OpenRiaServices.Controls.LoadingDataEventArgs>(this.DomainDataSourceLoadingData);
            this._dds.LoadedData        += new EventHandler <LoadedDataEventArgs>(this.DomainDataSourceLoadedData);
            this._dds.SubmittingChanges += new EventHandler <SubmittingChangesEventArgs>(this.DomainDataSourceSubmittingChanges);
            this._dds.SubmittedChanges  += new EventHandler <SubmittedChangesEventArgs>(this.DomainDataSourceSubmittedChanges);

            this._view              = this._dds.DataView;
            this._view.PageChanged += this.ViewPageChanged;
            this._collectionView    = this._view;
            this._collectionView.CollectionChanged += this.ViewCollectionChanged;
            this._editableCollectionView            = this._view;
            this._pagedCollectionView = this._view;

            this._comboBox = new ComboBox {
                Name = "_comboBox"
            };
            this._comboBox.Loaded += new RoutedEventHandler(this.ComboBoxLoaded);

            this._textBox = new TextBox {
                Name = "_textBox"
            };
            this._textBox.Loaded += new RoutedEventHandler(this.TextBoxLoaded);

            this.ResetLoadState();
            this.ResetPageChanged();
            this.ResetSubmitState();

            this._asyncEventFailureMessage = null;
        }
예제 #2
0
        public void NonEditableEntitySetDoesNotThrowFromEditItem()
        {
            DomainDataSourceView dataView = GetConfigurableView(EntitySetOperations.Add | EntitySetOperations.Remove);
            City newCity = new City {
                Name = "City", StateName = "ST"
            };

            dataView.Add(newCity);

            // Test is to ensure that no exception is thrown from calling EditItem
            ((IEditableCollectionView)dataView).EditItem(newCity);
        }
예제 #3
0
        public void RemoveEventRelayed()
        {
            Product first  = new Product();
            Product second = new Product();
            NotifyingCollection <Product> source = new NotifyingCollection <Product>()
            {
                first, second
            };
            PagedEntityCollectionView <Product> pecView = new PagedEntityCollectionView <Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            this.AssertCollectionChanged(
                () => source.Remove(first),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, first, 0),
                "when removing the first item.");
        }
예제 #4
0
        public void AddEventRelayed()
        {
            Product first  = new Product();
            Product second = new Product();
            NotifyingCollection <Product> source = new NotifyingCollection <Product>()
            {
                first, second
            };
            PagedEntityCollectionView <Product> pecView = new PagedEntityCollectionView <Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            Product third = new Product();

            this.AssertCollectionChanged(
                () => source.Add(third),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, third, 2),
                "when adding the third item.");
        }
예제 #5
0
        public void ResetEventRelayed()
        {
            Product first  = new Product();
            Product second = new Product();
            NotifyingCollection <Product> source = new NotifyingCollection <Product>()
            {
                first, second
            };
            PagedEntityCollectionView <Product> pecView = new PagedEntityCollectionView <Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            this.AssertCollectionChanged(
                () => source.Reset(),
                view,
                new NotifyCollectionChangedEventArgs[]
            {
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),     // Bug 706239
            },
                "when resetting the collection.");
        }
        public void AddEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> pecView = new PagedEntityCollectionView<Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            Product third = new Product();

            this.AssertCollectionChanged(
                () => source.Add(third),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, third, 2),
                "when adding the third item.");
        }
        public void RemoveEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> pecView = new PagedEntityCollectionView<Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            this.AssertCollectionChanged(
                () => source.Remove(first),
                view,
                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, first, 0),
                "when removing the first item.");
        }
        public void ResetEventRelayed()
        {
            Product first = new Product();
            Product second = new Product();
            NotifyingCollection<Product> source = new NotifyingCollection<Product>() { first, second };
            PagedEntityCollectionView<Product> pecView = new PagedEntityCollectionView<Product>(source);
            DomainDataSourceView view = new DomainDataSourceView(pecView);

            this.AssertCollectionChanged(
                () => source.Reset(),
                view,
                new NotifyCollectionChangedEventArgs[]
                {
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),
                    new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset), // Bug 706239
                },
                "when resetting the collection.");
        }