示例#1
0
        public ProjectListener(IAppContext context, LocatorPlugin plugin, LocatorPresenter presenter)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (plugin == null)
            {
                throw new ArgumentNullException("plugin");
            }
            if (presenter == null)
            {
                throw new ArgumentNullException("presenter");
            }

            _context              = context;
            _presenter            = presenter;
            plugin.ProjectClosed += OnProjectClosed;
            plugin.ProjectOpened += Plugin_ProjectOpened;
        }
示例#2
0
        public DockPanelService(IAppContext context, LocatorPresenter presenter, LocatorPlugin plugin)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (presenter == null)
            {
                throw new ArgumentNullException("presenter");
            }
            if (plugin == null)
            {
                throw new ArgumentNullException("plugin");
            }
            _context   = context;
            _presenter = presenter;
            _plugin    = plugin;
            var panels = context.DockPanels;

            //panels.Lock();
            //var panel = panels.Add(presenter.GetInternalObject() as IDockPanelView, plugin.Identity);

            //panels.Unlock();
        }
示例#3
0
        /// <summary>
        /// Sets all the necessary references from the main view.
        /// </summary>
        /// <remarks>We don't use contructor injection here since most of other services use this one as a parameter.
        /// Perhaps property injection can be used.</remarks>
        internal void Init(
            IMainView mainView,
            IProjectService project,
            IConfigService configService,
            LegendPresenter legendPresenter,
            ToolboxPresenter toolboxPresenter,
            IRepository repository)
        {
            Logger.Current.Trace("Start AppContext.Init()");
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView");
            }
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (legendPresenter == null)
            {
                throw new ArgumentNullException("legendPresenter");
            }
            if (toolboxPresenter == null)
            {
                throw new ArgumentNullException("toolboxPresenter");
            }

            _toolboxPresenter = toolboxPresenter;
            _legendPresenter  = legendPresenter;
            var legend = _legendPresenter.Legend;

            mainView.Map.Legend = legend;
            legend.Map          = mainView.Map;

            // it's expected here that we are on the UI thread
            SynchronizationContext = SynchronizationContext.Current;

            PluginManager = _container.GetSingleton <IPluginManager>();
            Broadcaster   = _container.GetSingleton <IBroadcasterService>();
            _container.RegisterInstance <IMuteMap>(mainView.Map);

            _mainView      = mainView;
            View           = new AppView(mainView, _styleService);
            _project       = project;
            _map           = mainView.Map;
            _configService = configService;
            Repository     = repository;

            Legend.Lock();

            DockPanels = new DockPanelCollection(mainView.DockingManager, mainView as Form, Broadcaster, _styleService);
            Menu       = MenuFactory.CreateMainMenu(mainView.MenuManager);
            Toolbars   = MenuFactory.CreateMainToolbars(mainView.MenuManager);
            StatusBar  = MenuFactory.CreateStatusBar(mainView.StatusBar, PluginIdentity.Default);

            _projectionDatabase.ReadFromExecutablePath(Application.ExecutablePath);

            Repository.Initialize(this);

            // comment this line to prevent locator loading
            // may be useful for ocx debugging to not create additional
            // instance of map
            _locator = new LocatorPresenter(_map);

            this.InitDocking();

            Initialized = true;
            Logger.Current.Trace("End AppContext.Init()");
        }