GetContextMenuByName() public method

public GetContextMenuByName ( string name ) : ContextMenu
name string
return ContextMenu
Esempio n. 1
0
        public string GetContextMenuXaml(string name)
        {
            ContextMenu contextMenu = _loadedConfig.GetContextMenuByName(name);

            if (contextMenu != null)
            {
                return(contextMenu.ContextMenuXaml);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        private ThemeService()
        {
            lock (_lockObject)
            {
                if (!_loaded)
                {
                    XmlReader xmlReader = null;
                    try
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(MappingToolConfig));
                        string        path       = SPUtility.GetGenericSetupPath(@"ISAPI\SevenSigma\Configs\DefaultConfig.xml");
                        xmlReader = XmlTextReader.Create(path);
                        MappingToolConfig config = serializer.Deserialize(xmlReader) as MappingToolConfig;

                        //re-read to manually find the context menu sections since
                        //they aren't picked up by thedeserialization process.
                        xmlReader = XmlReader.Create(path);
                        bool foundContextMenus = xmlReader.ReadToFollowing("ContextMenus");
                        if (foundContextMenus)
                        {
                            while (xmlReader.ReadToFollowing("ContextMenu"))
                            {
                                string      contextMenuName = xmlReader.GetAttribute("Name");
                                ContextMenu cm = config.GetContextMenuByName(contextMenuName);
                                if (cm != null)
                                {
                                    cm.ContextMenuXaml = xmlReader.ReadInnerXml();
                                }
                            }
                        }
                        _loadedConfig = config;
                        _loaded       = true;
                    }
                    catch (Exception)
                    {
                        _loaded = false;
                    }
                    finally
                    {
                        if (xmlReader != null)
                        {
                            xmlReader.Close();
                        }
                    }
                }
            }
        }