Example #1
0
        public override void Initialize(IAppContext context)
        {
            _context       = context;
            _menuGenerator = context.Container.GetInstance <MenuGenerator>();
            ISecureContext secureContext = context as ISecureContext;

            _drawFence = true;
            _isDeign   = false;
            _isLayout  = false;
            if (secureContext.YutaiProject != null)
            {
                XmlPlugin xmlPlugin = secureContext.YutaiProject.FindPlugin("5e933989-b5a4-4a45-a5b7-2d9ded61df0f");
                if (xmlPlugin != null)
                {
                    string fileName = xmlPlugin.ConfigXML;
                    if (string.IsNullOrEmpty(fileName))
                    {
                        _printConfig.TemplateConnectionString = BuildDefaultConnectionString();
                    }
                    else
                    {
                        fileName = FileHelper.GetFullPath(fileName);
                        _printConfig.LoadFromXml(fileName);
                    }
                }
            }
            if (string.IsNullOrEmpty(_printConfig.TemplateConnectionString))
            {
                _printConfig.TemplateConnectionString = BuildDefaultConnectionString();
            }
            _templateGallery = new MapTemplateGallery();
            _templateGallery.SetWorkspace(_printConfig.TemplateConnectionString);

            ((IAppContextEvents)_context).OnActiveHookChanged += OnOnActiveHookChanged;
            _activeViewEvents            = ((IActiveViewEvents_Event)_context.FocusMap);
            _activeViewEvents.AfterDraw += ActiveViewEventsOnAfterDraw;

            if (_fillSymbol == null)
            {
                _fillSymbol = SymbolHelper.CreateTransparentFillSymbol(Color.Blue) as ISymbol;
                _lineSymbol = SymbolHelper.CreateSimpleLineSymbol(Color.Blue, 1.5) as ISymbol;
            }
        }