Exemple #1
0
        /*-------------------------------------------------------------------*/

        public EditBookDialog(BindingRepoWrapper repo, int book_index)
        {
            this.repo       = repo;
            this.book_index = book_index;

            InitializeComponent();

            this.comboBoxAuthor.DataSource    = repo.Authors;
            this.comboBoxAuthor.DisplayMember = "Name";

            this.comboBoxPublisher.DataSource    = repo.Publishers;
            this.comboBoxPublisher.DisplayMember = "Name";

            if (book_index < 0)
            {
                this.curr_book = new Book();
            }

            else
            {
                this.curr_book = (Book)repo.Books[book_index];
                this.comboBoxAuthor.SelectedItem    = curr_book.Author;
                this.textBoxTitle.Text              = curr_book.Title;
                this.comboBoxPublisher.SelectedItem = curr_book.Publisher;
                this.numericUpDownYear.Value        = curr_book.Year;
            }
        }
        /*-------------------------------------------------------------------*/

        private void FillBooks(BindingRepoWrapper repo)
        {
            repo.Books.Add(new Book(ford, "My Life and Work", createSpace, 2013));
            repo.Books.Add(new Book(munroe, "What If?: Serious Scientific Answers to Absurd Hypothetical Questions", hmh, 2014));
            repo.Books.Add(new Book(donavan_kernigan, "The Go Programming Language", aw, 2015));
            repo.Books.Add(new Book(rockchild, "Advanced UNIX Programming", aw, 2004));
            repo.Books.Add(new Book(evans, "Domain-Driven Design: Tackling Complexity in the Heart of Software", aw, 2003));
        }
        /*-------------------------------------------------------------------*/

        private void FillAuthors(BindingRepoWrapper repo)
        {
            repo.Authors.Add(ford);
            repo.Authors.Add(munroe);
            repo.Authors.Add(donavan_kernigan);
            repo.Authors.Add(rockchild);
            repo.Authors.Add(evans);
        }
Exemple #4
0
        static void Main()
        {
            TestDataFiller tf = new TestDataFiller();

            BindingRepoWrapper wrapper =
                new BindingRepoWrapper(
                    new Repository()
                    );

            tf.FillTestData(wrapper);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Forms.MainForm(wrapper));
        }
Exemple #5
0
        /*-------------------------------------------------------------------*/

        public MainForm(BindingRepoWrapper wrapper)
        {
            InitializeComponent();

            updater = new BooksDataGridUpdater
                      (
                dataGridViewBooks, wrapper.Books
                      );

            updater.UpdateDGV();

            repo     = wrapper;
            provider = new StatsViewProvider(repo);

            saveDialog = new SaveFileDialog();
            SetFilterAndExtension(saveDialog);

            openDialog = new OpenFileDialog();
            SetFilterAndExtension(openDialog);
        }
Exemple #6
0
        /*-------------------------------------------------------------------*/

        public StatsViewProvider(BindingRepoWrapper repo)
        {
            this.repo = repo;
        }
        /*-------------------------------------------------------------------*/

        private void FillPublishers(BindingRepoWrapper repo)
        {
            repo.Publishers.Add(createSpace);
            repo.Publishers.Add(hmh);
            repo.Publishers.Add(aw);
        }
        /*-------------------------------------------------------------------*/

        public void FillTestData(BindingRepoWrapper repo)
        {
            this.FillAuthors(repo);
            this.FillPublishers(repo);
            this.FillBooks(repo);
        }