protected virtual void InitializePlantInternal(IPlantEx plantEx)
        {
            List <IRareCommand> relatedCommands = InitPlantRareCommands.RunPipelineGetCommands(plantEx);

            if (relatedCommands != null)
            {
                var luggage = new RareCommandsServicePlantBox(relatedCommands);
                plantEx.PutLuggage(this.LuggageName, luggage);
            }
        }
        protected virtual void InitializePlantInternal(IPlantEx plant)
        {
            var workhorse = plant.GetFirstWorkhorseOfType <IGetPowerOfUserNotifications>();

            if (workhorse == null)
            {
                return;
            }
            var plantBox = new UserNotificationsServicePlantBox()
            {
                RelatedPlantEx = plant,
                SettingsBox    = plant.MySettingsBox.GetSubBox(this.LuggageName)
            };
            var lord = new LordOfNotifications(plantBox);

            plant.PutLuggage(this.LuggageName, plantBox);
            workhorse.StoreLordOfNotifications(lord);
        }
        protected virtual void SetCustomSettingsBox(IPlantEx plantEx)
        {
            var asExpected = plantEx.GetFirstWorkhorseOfType <IGetCustomSettingsStorage>();

            if (asExpected == null)
            {
                return;
            }
            ISettingsBox settingsBox = plantEx.MySettingsBox.GetSubBox(this.LuggageName);

            asExpected.StoreCustomSettingsStorage(settingsBox);

            //Store luggage
            var luggage = new CustomSettingsServicePlantBox {
                RelatedPlantEx = plantEx, SettingsBox = settingsBox, IsEnabled = true,
            };

            plantEx.PutLuggage(this.LuggageName, luggage);
        }
        protected virtual void ProvidePlantWithConfig(IPlantEx plantEx)
        {
            var asExpected = plantEx.GetFirstWorkhorseOfType <IGiveMeMyAppConfig>();

            if (asExpected == null)
            {
                return;
            }
            string assemblyLocation = plantEx.Plant.GetType().Assembly.Location;

            System.Configuration.Configuration assemblyConfiguration = null;
            try
            {
                assemblyConfiguration = ConfigurationManager.OpenExeConfiguration(assemblyLocation);
            }
            catch (Exception ex)
            {
                Log.Warn("Unable to open admin config for {0}".FormatWith(assemblyLocation), this, ex);
            }

            asExpected.StoreModuleConfiguration(assemblyConfiguration);
            plantEx.PutLuggage(this.LuggageName, new MyAdminConfigServicePlantBox());
        }
Exemple #5
0
        protected virtual void InitializePlantWithLuggage(IPlantEx plant)
        {
            var asClipboardWorksPerformer = plant.GetFirstWorkhorseOfType <IClipboardWorks>();

            if (asClipboardWorksPerformer != null)
            {
                asClipboardWorksPerformer.StoreClipboardValueProvider(this.SelfProvider);
            }
            var clipboardListener = plant.GetFirstWorkhorseOfType <IClipboardListener>();

            if (clipboardListener == null)
            {
                return;
            }
            var clipboardObserverPlantBox = new ClipboardObserverPlantBox
            {
                WorksHungry    = clipboardListener,
                RelatedPlantEx = plant,
                SettingsBox    = plant.MySettingsBox.GetSubBox(this.LuggageName)
            };

            plant.PutLuggage(this.LuggageName, clipboardObserverPlantBox);
        }