/// <summary> /// Constructeur. /// </summary> public JedisViewModel() { List<Jedi> jedisModel = new JediTournamentManager().getAllJedis(); // Initialise la collection modèle _jedis = new ObservableCollection<JediViewModel>(); foreach (Jedi j in jedisModel) { _jedis.Add(new JediViewModel(j)); } if (_jedis.Count > 0) _selectedItem = _jedis[0]; }
/// <summary> /// Constructeur. /// </summary> public JedisViewModel() { List <Jedi> jedisModel = new JediTournamentManager().getAllJedis(); // Initialise la collection modèle _jedis = new ObservableCollection <JediViewModel>(); foreach (Jedi j in jedisModel) { _jedis.Add(new JediViewModel(j)); } if (_jedis.Count > 0) { _selectedItem = _jedis[0]; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Initialisation du jedi view Model JediViewModel jvm = new JediViewModel(_source); jediController.DataContext = jvm; }
/// <summary> /// Ajoute un nouveau jedi à la liste de jedis. /// </summary> private void New() { Jedi j = new Jedi(_newNextId--, "<New>", false, null, ""); this.SelectedItem = new JediViewModel(j); Jedis.Add(this.SelectedItem); }