Пример #1
0
        public PrototypesViewModel(Overlord overlord)
        {
            Overlord = overlord;
            Overlord.PropertyChanged += (o, e) => {
                if (e.PropertyName == "Prototypes")
                {
                    Source = Overlord.Prototypes;
                }
            };

            Prototypes         = new ObservableCollection <PrototypeViewModel>();
            PrototypeFilters   = new ObservableCollection <PrototypeFilter>();
            FilteredPrototypes = new ObservableCollection <PrototypeViewModel>();

            PrototypeFilters.Add(new PrototypeFilter("All", (prototype) => { return(true); }));
            PrototypeFilters.Add(new PrototypeFilter("Buildings", (prototype) => { return(prototype.Movement.MaxVelocity == 0); }));
            PrototypeFilters.Add(new PrototypeFilter("Units", (prototype) => { return(prototype.Movement.MaxVelocity > 0); }));

            PropertyChanged += (sender, e) => { if (e.PropertyName == "SelectedFilter")
                                                {
                                                    UpdateFilteredPrototypes();
                                                }
            };
            Prototypes.CollectionChanged += delegate { UpdateFilteredPrototypes(); };
            SelectedFilter = PrototypeFilters.FirstOrDefault();

            Source = Overlord.Prototypes;
        }
Пример #2
0
 public PrototypeViewModel(Overlord Overlord)
 {
     this.Overlord = Overlord;
 }
Пример #3
0
 public BARsViewModel(Overlord overlord)
 {
     Overlord = overlord;
     Files    = new ObservableCollection <BARViewModel>();
     Overlord.AddLoadedCallback(OnLoaded, true);
 }