public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Setup view
            distributionView                     = new DistributionView();
            distributionView.part                = this.part;
            distributionView.isParticipating     = this.isParticipating;
            distributionView.distributionMap     = this.distributionMap;
            distributionView.rebuildCache        = RebuildDistributionCache;
            distributionView.setParticipation    = setParticipation;
            distributionView.setSharesWithVessel = setSharesWithVessel;

            //Tap into the resource switcher's redecoration event
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
                templateName = switcher.CurrentTemplateName;
            }

            //if we have an empty list then create a new one.
            if (distributionMap.Keys.Count == 0)
            {
                RebuildDistributionList();
            }
            else
            {
                RebuildDistributionCache();
            }

            if (isConsumer)
            {
                Events["SetupDistribution"].guiActive = false;
                Fields["isParticipating"].guiName     = "Acquire Resources";
            }

            //Make sure we initiate resource distribution
            if (HighLogic.LoadedSceneIsFlight)
            {
                WBIDistributionManager.Instance.isDirty = true;
            }
        }