Exemplo n.º 1
0
        public MainAdapter(
            Project project, DbServiceFactory serviceFactory, IFieldPathFactory pathFactory,
            PresetView preset, StandardView standard, AdvancedView advanced,
            RetrieveFieldsView fields)
            : base(project)
        {
            ServiceFactory = serviceFactory;
            PathFactory    = pathFactory;

            Preset   = preset;
            Standard = standard;
            Advanced = advanced;
            _views.Add("Preset", preset.Adapter);
            _views.Add("Standard", standard.Adapter);
            _views.Add("Advanced", advanced.Adapter);

            RetrieveFields = fields;

            Preset.Adapter.Search   += Adapter_Search;
            Standard.Adapter.Search += Adapter_Search;
            Advanced.Adapter.Search += Adapter_Search;

            SelectedSubjectChanged += delegate { RefreshPaths(); };

            var refresh = new EventHandler((s, e) =>
            {
                RefreshPaths();
                _dbService = ServiceFactory.CreateAsync(Project.CurrentConnection);
            });

            Project.CurrentConnectionChanged += refresh;
            Result = new BindingSource();
            refresh(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public MainWindowAdapter(
            Project project, DbServiceFactory serviceFactory, IFieldPathFactory pathFactory,
            PresetView preset, StandardView standard, AdvancedView advanced,
            RetrieveFieldsView fields)
            : base(project)
        {
            _appWidth       = Properties.Settings.Default.AppWidth;
            _appHeight      = Properties.Settings.Default.AppHeight;
            _appWindowState = Properties.Settings.Default.AppWindowState;
            _viewColumnSize = new GridLength(Properties.Settings.Default.ViewColumnSize);

            Preset         = preset;
            Standard       = standard;
            Advanced       = advanced;
            RetrieveFields = fields;
            _views.Add("Preset", preset.Adapter);
            _views.Add("Standard", standard.Adapter);
            _views.Add("Advanced", advanced.Adapter);

            Preset.Adapter.Search   += Adapter_Search;
            Standard.Adapter.Search += Adapter_Search;
            Advanced.Adapter.Search += Adapter_Search;

            ProjectAdapter = new ProjectAdapter(project);
            PathFactory    = pathFactory;
            ServiceFactory = serviceFactory;

            CurrentView             = Preset.Adapter;
            SelectedSubjectChanged += delegate { RefreshPaths(); };
            var refresh = new EventHandler((s, e) =>
            {
                RefreshPaths();
                OnPropertyChanged("ApplicationTitle");
                _dbService = ServiceFactory.CreateAsync(Project.CurrentConnection);
            });

            ProjectAdapter.Project.CurrentConnectionChanged += refresh;
            refresh(this, EventArgs.Empty);
        }