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);
        }
예제 #2
0
 public XDocument GetBehaviorsXml()
 {
     if (View.Instance != null)
     {
         BehaviorsConfiguration configuration = BehaviorsConfiguration.GetFromExtensionBehaviors(View.Instance.ExtensionBehaviors, View.Instance.ExtensionsDataManager, BehaviorsConfiguration);
         if (configuration != null)
         {
             return(configuration.GetBehaviorsXml());
         }
     }
     return(null);
 }
예제 #3
0
        private void disposeExtensibilityObjects()
        {
            if (ToolPanels != null)
            {
                // Dipose attached event handlers
                ToolPanels.Dispose();
            }

            if (BehaviorsConfiguration != null)
            {
                BehaviorsConfiguration.Dispose();
            }
        }
예제 #4
0
        private ObservableCollection <ExtensionBehavior> getBehaviors(string behaviorsXml)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(behaviorsXml))
                {
                    BehaviorsConfiguration.PopulateBehaviorsFromXml(behaviorsXml);

                    List <ExtensionBehavior> extensionBehaviors = BehaviorsConfiguration.GetAsExtensionBehaviors(View.ExtensionsDataManager);
                    if (extensionBehaviors != null)
                    {
                        return(new ObservableCollection <ExtensionBehavior>(extensionBehaviors));
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.LogError(ex);
            }
            return(null);
        }