예제 #1
0
        public InspectionUserControlViewModel(PowertracksRepository repository)
        {
            _repository = repository;

            RegattaCollection = new ObservableCollection <Regatta>();

            RaceCollection = new PropChangeObservableCollection <Race>();
            RaceCollection.ItemPropertyChanged += (sender, args) =>
            {
                if (sender is Race race)
                {
                    _repository.UpdateRace(race);
                }
            };

            EntryCollection = new PropChangeObservableCollection <RaceEntry>();
            EntryCollection.ItemPropertyChanged += (sender, args) =>
            {
                if (sender is RaceEntry entry)
                {
                    _repository.UpdateEntry(entry);
                }
            };

            var regattas = _repository.GetRegattas();

            foreach (var regatta in regattas)
            {
                RegattaCollection.Add(regatta);
            }
        }
예제 #2
0
        public Crafting()
        {
            InitializeComponent();
            var itemSource = new PropChangeObservableCollection <DisplayRecipeTree>();

            itemSource.Add(new DisplayRecipeTree(ItemAPI.SearchItem("Arachnophobia")[0]));
            Crafting_Treeview.ItemsSource = itemSource;
        }
        public OldDisplayTreeItemRecipe(List <Recipe> recipes, int singleAmount, int totalAmount)
        {
            this.Items              = new PropChangeObservableCollection <OldDisplayTreeItemRecipe>();
            this.Recipes            = recipes;
            this.CurrentRecipeIndex = 0;
            this.SingleAmountNeeded = singleAmount;
            this.TotalAmountNeeded  = totalAmount;
            this.AmountCrafted      = "0";

            CreateChildren();
        }
예제 #4
0
        private void PopulateItems()
        {
            if (Children == null || Children.Count <= 0)
            {
                return;
            }

            var items = new PropChangeObservableCollection <DisplayRecipeTree>();

            Children.ForEach(c => { items.Add(new DisplayRecipeTree(c)); });
            Items = items;
        }