Example #1
0
        private void BindSources(GameRepository gameRepository)
        {
            if (_gameRepository != null)
                _gameRepository.PropertyChanged -= GameRepositoryPropertyChanged;

            _bindingSource.DataSource = gameRepository;
            _bindingSource.DataMember = "Games";

            _gameListBox.DataSource = _bindingSource;
            _gameListBox.DisplayMember = "Name";

            _nameTextBox.DataBindings.Clear();
            _nameTextBox.DataBindings.Add("Text", _bindingSource, "Name", true, DataSourceUpdateMode.OnPropertyChanged);

            _noteTextBox.DataBindings.Clear();
            _noteTextBox.DataBindings.Add("Text", _bindingSource, "Note", true, DataSourceUpdateMode.OnPropertyChanged);

            _costTextBox.DataBindings.Clear();
            _costTextBox.DataBindings.Add("Text", _bindingSource, "Cost", true, DataSourceUpdateMode.OnPropertyChanged);

            _purchasedDateTimePicker.DataBindings.Clear();
            _purchasedDateTimePicker.DataBindings.Add("Value", _bindingSource, "Purchased", true, DataSourceUpdateMode.OnPropertyChanged);

            _lastPlayedDateTimePicker.DataBindings.Clear();
            _lastPlayedDateTimePicker.DataBindings.Add("Value", _bindingSource, "LastPlayed", true, DataSourceUpdateMode.OnPropertyChanged);

            _playsTextBox.DataBindings.Clear();
            _playsTextBox.DataBindings.Add("Text", _bindingSource, "Plays", true, DataSourceUpdateMode.OnPropertyChanged);

            gameRepository.PropertyChanged += GameRepositoryPropertyChanged;

            _gameRepository = gameRepository;

            UpdateButtons();
        }
Example #2
0
        static void Main()
        {
            GameRepository BoardGameLibrary = new GameRepository();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new GameManagerDialog(BoardGameLibrary));
        }
Example #3
0
 public GameManagerDialog(GameRepository gameRepository)
     : this()
 {
     BindSources(gameRepository);
 }