Example #1
0
        public MainController(MainWindow window, 
            IWindowManager windowManager,
            IStoredClassDataPresenter storedClassDataPresenter,
            IConnectionPresenter connectionPresenter,
            IStoredClassPresenter storedClassPresenter,
            IFieldPresenter fieldPresenter,
            IFieldListPresenter fieldListPresenter,
            IConnectionStatisticsPresenter connectionStatisticsPresenter
            )
        {
            this.window = window;
            this.windowManager = windowManager;
            this.storedClassDataPresenter = storedClassDataPresenter;
            this.connectionPresenter = connectionPresenter;
            this.storedClassPresenter = storedClassPresenter;

            this.window.explorer.ShowDataFired += storedClassDataPresenter.ShowData;
            this.window.explorer.ShowFieldsFired += fieldListPresenter.ShowFields;
            this.window.AddNewConnectionFired += this.connectionPresenter.AddNew;

            this.window.explorer.EditConnectionFired += this.connectionPresenter.Edit;
            this.window.explorer.DeleteConnectionFired += this.connectionPresenter.Delete;
            this.window.explorer.RenameClassFired += storedClassPresenter.RenameClass;
            this.window.explorer.RenameFieldFired += fieldPresenter.RenameField;
            this.window.explorer.ShowStatisticsFired += connectionStatisticsPresenter.Show;
            this.window.explorer.CreateNewStoredClassFired += storedClassPresenter.CreateNew;
        }
Example #2
0
        public App()
        {
            NameValueCollection collection = new NameValueCollection();
            collection.Add("configType", "FILE");
            collection.Add("configFile", "~/log.config");
            collection.Add("optionalConfigFile", "~/log.config.local");
            ExtendedLog4NetLoggerFactoryAdapter adapter = new ExtendedLog4NetLoggerFactoryAdapter(collection);
            LogManager.Adapter = adapter;

            //							<arg key="configType" value="FILE" />
            //				<arg key="configFile" value="~/log.config" />
            //				<arg key="optionalConfigFile" value="~/log.config.local" />

            ConnectionProfileRepository repository = new ConnectionProfileRepository();

            MainWindow mainWindow = new MainWindow();

            var layoutDataStorePathFactory = new LayoutDataStorePathFactory(LayoutDataTypePath.ApplicationData);

            WindowManager windowManager = new WindowManager(mainWindow, layoutDataStorePathFactory);

            var browseFileService = new BrowseFileService();

            StoredClassDataPresenter storedClassDataPresenter = new StoredClassDataPresenter(windowManager,browseFileService, new Db4oObjectFactory());

            Db4oConnectionFactory factory = new Db4oConnectionFactory();

            var errorHandler = new ErrorHandler(windowManager);

            ConnectionPresenter connectionPresenter = new ConnectionPresenter(new LocalConnectionProfileView(), windowManager, mainWindow, repository, factory, new RemoteConnectionProfileView(),browseFileService,errorHandler);
            connectionPresenter.LoadAll();

            var queryToolPresenterFactory = new QueryToolPresenterFactory(mainWindow, windowManager, browseFileService, new Db4oSampleQueryGenerator());

            var fileManager = new FileManager(browseFileService);

            mainWindow.ExportDataToSqlFired += new SqlExportPresenter(mainWindow, windowManager, fileManager).Export;

            mainWindow.ExportDataToCsvFired += new CsvExportPresenter(mainWindow, windowManager, fileManager).Export;

            StoredClassPresenter storedClassPresenter = new StoredClassPresenter(windowManager);

            var fieldPresenter = new FieldPresenter(windowManager);

            var fieldListPresenter = new FieldListPresenter(windowManager,fieldPresenter);

            var connectionStatisticsPresenter = new ConnectionStatisticsPresenter(windowManager);

            MainController mainController = new MainController(mainWindow, windowManager, storedClassDataPresenter, connectionPresenter, storedClassPresenter, fieldPresenter, fieldListPresenter,connectionStatisticsPresenter);

            mainWindow.explorer.ShowQueryToolFired += queryToolPresenterFactory.Show;

            var aboutForm = new AboutView();
            var aboutPresenter = new AboutPresenter(mainWindow, aboutForm, windowManager);

            this.ErrorHandler = errorHandler;

            windowManager.ShowWindow(mainWindow);
        }
 public AbstractTextExportPresenter(MainWindow mainWindow, IWindowManager windowManager, IFileManager fileManager, ITextExporter exporter, string defaultExt)
 {
     this.windowManager = windowManager;
     this.fileManager = fileManager;
     this.exporter = exporter;
     connectionViewModels = mainWindow.DataSource.Connections;
     this.defaultExt = defaultExt;
 }
 public QueryToolPresenterFactory(MainWindow mainWindow, IWindowManager windowManager, IBrowseFileService browseFileService, ISampleQueryGenerator sampleQueryGenerator)
 {
     this.windowManager = windowManager;
     this.sampleQueryGenerator = sampleQueryGenerator;
     this.browseFileService = browseFileService;
     connectionViewModels = mainWindow.DataSource.Connections;
     mainWindow.QueryToolFired += new Action(mainWindow_QueryToolFired);
 }
Example #5
0
        public AboutPresenter(MainWindow mainWindow, AboutView aboutView, IWindowManager windowManager)
        {
            this.mainWindow = mainWindow;
            this.aboutView = aboutView;
            this.windowManager = windowManager;

            this.mainWindow.ShowAboutFired += window_ShowAboutFired;
        }
 public CsvExportPresenter(MainWindow mainWindow, IWindowManager windowManager, IFileManager fileManager)
     : base(mainWindow, windowManager, fileManager, new CsvExporter(), "csv")
 {
 }
 public SqlExportPresenter(MainWindow mainWindow, IWindowManager windowManager, IFileManager fileManager)
     : base(mainWindow, windowManager, fileManager, new SqlExporter(), "sql")
 {
 }