コード例 #1
0
        public List <ExtensionBehavior> GetAsExtensionBehaviors(ExtensionsDataManager dataManager)
        {
            List <ExtensionBehavior> list = new List <ExtensionBehavior>();

            try
            {
                foreach (BehaviorConfiguration beh in this)
                {
                    Behavior <Map> behavior = beh.ClassImplementation as System.Windows.Interactivity.Behavior <Map>;
                    if (behavior != null)
                    {
                        ExtensionBehavior extensionBehavior = new ExtensionBehavior();
                        extensionBehavior.Title       = ExtensionDisplayNameConverter.Convert(behavior);
                        extensionBehavior.MapBehavior = behavior;
                        extensionBehavior.IsEnabled   = beh.IsEnabled;
                        extensionBehavior.BehaviorId  = beh.Id;
                        extensionBehavior.Title       = beh.Title;
                        if (dataManager != null)
                        {
                            dataManager.SetExtensionDataForExtension(beh.Id, beh.ConfigData);
                        }

                        list.Add(extensionBehavior);
                    }
                }
            }
            catch { }
            return(list);
        }
コード例 #2
0
 public ExtensionsHelper(View view, ExtensionsConfigData extensionConfigData)
 {
     View = view;
     extensionsDataManager = new ExtensionsDataManager()
     {
         ExtensionsConfigData = extensionConfigData
     };
 }
コード例 #3
0
        public BehaviorsConfiguration GetFromExtensionBehaviors(IEnumerable <ExtensionBehavior> extensions, ExtensionsDataManager dataManager, BehaviorsConfiguration originalConfiguration)
        {
            BehaviorsConfiguration conf = new BehaviorsConfiguration();

            if (originalConfiguration != null)
            {
                conf.OriginalBehaviorsNamespaces = originalConfiguration.OriginalBehaviorsNamespaces;
            }
            try
            {
                foreach (ExtensionBehavior extensionBehavior in extensions)
                {
                    Behavior <Map> behavior = extensionBehavior.MapBehavior;
                    if (behavior != null)
                    {
                        BehaviorConfiguration behaviorConf = new BehaviorConfiguration();
                        behaviorConf.Title               = extensionBehavior.Title;
                        behaviorConf.IsEnabled           = extensionBehavior.IsEnabled;
                        behaviorConf.ClassImplementation = extensionBehavior.MapBehavior;
                        if (dataManager != null)
                        {
                            behaviorConf.ConfigData = dataManager.GetExtensionDataForExtension(extensionBehavior.BehaviorId);
                        }
                        conf.Add(behaviorConf);
                    }
                }
            }
            catch { }
            return(conf);
        }