Example #1
0
        public MainPresenter(IFormOfConnection connection, IFormOfSelect select, IFormOfDataEditor editor, IFormOfSearch search, IMessageService service, IDataBaseManager manager)
        {
            #region WinForm - инициализация переменных
            formOfDE     = (FormOfDataEditor)editor;
            formOfSelect = (FormOfSelect)select;
            formOfSearch = (FormOfSearch)search;
            #endregion

            _connection     = connection;
            _select         = select;
            _editor         = editor;
            _search         = search;
            _messageService = service;
            _manager        = manager;

            _connection.DBconnect  += _connection_DBconnect;
            _connection.OpenSelect += _connection_OpenSelect;

            _select.OpenSearch    += _select_OpenSearch;
            _select.ErrorOfSelect += _select_ErrorOfSelect;

            _search.OpenFolder      += _search_OpenFolder;
            _search.Select_Extra    += _search_SelectOfExtra;
            _search.OpenDataEditor  += _search_OpenDataEditor;
            _search.BackToSelect    += _connection_OpenSelect;
            _search.MessageOfSearch += _search_MessageOfSearch;
            _search.ErrorOfSearch   += _search_ErrorOfSearch;

            _editor.BackToSearch += _editor_BackToSearch;
            _editor.ErrorOfDE    += _editor_ErrorOfDE;
            _editor.MessageOfDE  += _editor_MessageOfDE;
        }
Example #2
0
        static void Main()
        {
            FormOfConnectionDB formConnection = new FormOfConnectionDB();
            FormOfSelect       formSelect     = new FormOfSelect();
            FormOfDataEditor   formEditor     = new FormOfDataEditor();
            FormOfSearch       formSearch     = new FormOfSearch();
            MessageService     service        = new MessageService();
            DataBaseManager    DBmanager      = new DataBaseManager();

            Application.EnableVisualStyles();

            MainPresenter presenter = new MainPresenter(formConnection, formSelect, formEditor, formSearch, service, DBmanager);

            try
            {
                Application.Run(formConnection);
            }
            catch (Exception ex)
            {
                service.ShowError(ex.Message);
            }
        }