Пример #1
0
        protected virtual void Initialize(IPluginServiceProvider serviceProvider)
        {
            this.coreForm = serviceProvider.GetService(typeof(Form)) as Form;

            if (serviceProvider.Contains(typeof(IContainerControl)))
            {
                this.mdiUIContainer = serviceProvider.GetService(typeof(IContainerControl)) as Control;
            }

            this.currentModulePluginController = serviceProvider.GetService(typeof(IPluginController <>)) as IPluginController <TPluginItem>;

            this.modulePluginManager = serviceProvider.GetService(typeof(IPluginManager <>)) as IPluginManager <TPluginItem>;

            this.currentAppModulePluginItem = this.currentModulePluginController.PluginItem;

            if (this.mdiUIContainer == null)
            {
                throw new InfrastructureException("The container which is used to load this UI screen cannot be null. Please specify a container which inherits control. E.g. panel or form.");
            }

            if (this.mdiUIContainer != null &&
                !this.mdiUIContainer.Controls.Contains(this))
            {
                this.mdiUIContainer.SuspendLayout();

                this.Dock = DockStyle.Fill;

                this.mdiUIContainer.Controls.Add(this);
                this.mdiUIContainer.ResumeLayout();
            }

            this.Focus();

            this.Hide();
        }
Пример #2
0
        protected override void Initialize(IPluginServiceProvider serviceProvider)
        {
            if (serviceProvider.Contains(typeof(Ribbon)))
            {
                this.RibbonMenu = serviceProvider.GetService(typeof(Ribbon)) as Ribbon;

                if (this.RibbonMenu == null)
                {
                    throw new InfrastructureException("The service provide doesn't contain Ribbon control. Please specify a Ribbon control.");
                }
            }

            base.Initialize(serviceProvider);
        }
Пример #3
0
        protected override object RunCore(IPluginServiceProvider serviceProvider)
        {
            CostLineType currentCostType = (CostLineType)serviceProvider.GetService(typeof(CostLineType));

            CostManagerFactory costManagerFactory = CostManagerFactory.GetInstance(currentCostType);

            object currentCostManagerObject = EAppRuntime.Instance.CurrentApp.ObjectContainer.Resolve(costManagerFactory.CurrentCostManagerType);

            ProxyGenerator proxyGenerator = new ProxyGenerator();

            var options = new ProxyGenerationOptions();

            options.AddMixinInstance(currentCostManagerObject);

            ICostManager costManager =
                (ICostManager)proxyGenerator.CreateClassProxy <CostManagerFactory>(options);

            costManager.AddCostLine();

            return(costManager.CurrentDisplayedCostLines);
        }
Пример #4
0
        protected override object RunCore(IPluginServiceProvider serviceProvider)
        {
            CostLineType currentCostType = (CostLineType)serviceProvider.GetService(typeof(CostLineType));

            CostManagerFactory costManagerFactory = CostManagerFactory.GetInstance(currentCostType);

            object currentCostManagerObject = EAppRuntime.Instance.CurrentApp.ObjectContainer.Resolve(costManagerFactory.CurrentCostManagerType);

            ProxyGenerator proxyGenerator = new ProxyGenerator();

            var options = new ProxyGenerationOptions();

            options.AddMixinInstance(currentCostManagerObject);

            ICostManager costManager =
                (ICostManager)proxyGenerator.CreateClassProxy<CostManagerFactory>(options);

            costManager.AddCostLine();

            return costManager.CurrentDisplayedCostLines;
        }