Example #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.FilteredWindow = ((Assignment4.Filtered)(target));

            #line 11 "..\..\Filtered.xaml"
                this.FilteredWindow.Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        private void SelectionEvent(object obj)
        {
            if (SelectedItemPet == "Pets with Feet")
            {
                PetDisplayVM petDisplay = new PetDisplayVM();

                foreach (Pets ListItem in new ObservableCollection <Pets>(petDisplay._PetsCollection))
                {
                    if (ListItem is LandPet)
                    {
                        FilteredList.Add(ListItem);
                    }
                }

                if (_SelectedItemSupply != null)
                {
                    if (SelectedItemSupply == "Bedding")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Beds)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                    else if (SelectedItemSupply == "Clothes")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Clothes)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                    else if (SelectedItemSupply == "Food")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Food)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                }
            }
            else
            {
                PetDisplayVM petDisplay = new PetDisplayVM();

                foreach (Pets ListItem in new ObservableCollection <Pets>(petDisplay._PetsCollection))
                {
                    if (ListItem is WaterPet)
                    {
                        FilteredList.Add(ListItem);
                    }
                }

                if (_SelectedItemSupply != null)
                {
                    if (SelectedItemSupply == "Bedding")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Beds)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                    else if (SelectedItemSupply == "Clothes")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Clothes)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                    else if (SelectedItemSupply == "Food")
                    {
                        SupplyDisplayVM supplyDisplay = new SupplyDisplayVM();

                        foreach (Supplies ListItem in new ObservableCollection <Supplies>(supplyDisplay._SupplyCollection))
                        {
                            if (ListItem is Food)
                            {
                                FilteredList.Add(ListItem);
                            }
                        }
                    }
                }
            }


            FilteredVM filteredVM = new FilteredVM(this);
            Filtered   filter     = new Filtered
            {
                DataContext = filteredVM
            };

            filter.Show();
        }