public async void RefreshClues() { IsRefreshing = true; Clues.Clear(); var clues = await _dataService.GetCluesAsync(_settingsService.RaceId); foreach (var clue in clues) { Clues.Add(clue); } IsRefreshing = false; }
//Generate2Clues() //Parameters: none //Returns: void //Description: Method generates 2 hair and fiber clues by creating a clue object, // and adding it to the base member class List Clues. public override void Generate2Clues() { for (int i = 0; i < _NumOf; i++) { RandomGenerator = new Random(Guid.NewGuid().GetHashCode()); Clues.Add(new ClueInfo() { RowCoordinates = RandomGenerator.Next(0, TotalRows - 1), ColumnCoordinates = RandomGenerator.Next(0, TotalColumns - 1), Img = Properties.Resources.hair }); } }
//Generate2Clues() //Parameters: None //Returns: None //Description: The method creates 2 clue objects and pushes them to the list Clues, belonging // to the base class. public override void Generate2Clues() { for (int i = 0; i < _NumOf; i++) { //Generates random seed better than using time RandomGenerator = new Random(Guid.NewGuid().GetHashCode()); Clues.Add(new ClueInfo() { RowCoordinates = RandomGenerator.Next(0, TotalRows - 1), ColumnCoordinates = RandomGenerator.Next(0, TotalColumns - 1), Img = Properties.Resources.bloody_hand }); } }
protected override async void OnActivate() { base.OnActivate(); IsBusy = true; IEnumerable <TeamClue> localClues = await _dataService.GetCluesForTeamAsync(SelectedRace.Id); foreach (TeamClue cl in localClues) { Clues.Add(cl); } var a = 1; IsBusy = false; }
public void AddClue(Clue clue) { Clues.Add(clue); // Add to home as well; Notice a documetn can add whatever many clues it want but not add to home Home home = (App.Current as MULTITUDE.App).CurrentHome; ClueManager.Manager.AddClue(clue, this); // Also remove current document from forgotten universe if we are adding the first ever clue if (Clues.Count == 1) { home.Relocate(this); } // Now for the purpose of encapsulation it might seems legit for Home to actively manage its document rather than get informed when its documents get changed; but require documetns to notify their homes isn't a bad design since it can be considered as some sort of event model, with Home being the central repository and all documents actively register/deregister themselves. }