Пример #1
0
        static ApplicationContext()
        {
            _projectDir = GetProjectDirectory();

            var booksPath        = _projectDir + "\\Data\\book\\books.xml";
            var booksMetaInfPath = _projectDir + "\\Data\\book\\meta-inf.xml";
            var booksCountPath   = _projectDir + "\\Data\\book\\count.xml";

            var authorsPath        = _projectDir + "\\Data\\author\\authors.xml";
            var authorsMetaInfPath = _projectDir + "\\Data\\author\\meta-inf.xml";

            var authorDocHolder = new DocumentHolder(authorsPath, authorsMetaInfPath);
            var bookDocHolder   = new DocumentHolder(booksPath, booksMetaInfPath);

            _bookDao   = DaoFactory.BookDao(bookDocHolder, authorDocHolder);
            _authorDao = DaoFactory.AuthorDao(authorDocHolder, bookDocHolder);

            _bookService = new BookService()
            {
                BookDao = _bookDao
            };

            _authorService = new AuthorService()
            {
                AuthorDao = _authorDao
            };

            _bookCounter  = new BookCounter(booksCountPath);
            _bookArranger = new BookArranger(_projectDir + "\\Data\\book\\shelves.xml");
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            BookService   = ApplicationContext.BookService;
            AuthorService = ApplicationContext.AuthorService;
            BookCounter   = ApplicationContext.BookCounter;
            BookArranger  = ApplicationContext.BookArranger;
        }