当前位置: 首页>>代码示例>>C#>>正文


C# TextMenu.Add方法代码示例

本文整理汇总了C#中TextMenu.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TextMenu.Add方法的具体用法?C# TextMenu.Add怎么用?C# TextMenu.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextMenu的用法示例。


在下文中一共展示了TextMenu.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

	void Page_Load(object sender, System.EventArgs e)
	{
		// declare the menu and set its properties
		TextMenu tm = new TextMenu();
		tm.ID = "TextMenu1";
		
		// add the menu to page
		Page.Controls.Add(tm);

		string sConnectionString;
		OleDbDataReader oReader;
		
		// set the connection string
		sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../App_Data/DBDEMO.mdb");
		OleDbConnection Cn = new OleDbConnection(sConnectionString);
		
		// The database has one table called items containing both parent items and menu items
		// LEVEL shows what level the item is at (0 - parent item, 1 - belongs to menu attached to parent item, etc)
		// ORDER sets what is the item's order in the current menu (1 - first item, 2 - second item, etc.)
		// it is very important to add parent elements first, then level 1 items, then level 2 items, etc.
		string SQL = "SELECT * FROM Items ORDER BY [LEVEL], [ORDER]";
		OleDbCommand Com = new OleDbCommand(SQL,Cn);
		Cn.Open();
		oReader = Com.ExecuteReader();

		// Populate TM.
		while (oReader.Read()) 
		{
			// if PARENTID is null, we're adding a parent element, otherwise it's a menu item
			tm.Add(oReader.IsDBNull(oReader.GetOrdinal("PARENTID")) ? null : oReader.GetString(oReader.GetOrdinal("PARENTID")), 
					oReader.GetString(oReader.GetOrdinal("ID")),
					oReader.IsDBNull(oReader.GetOrdinal("HTML")) ? "" : oReader.GetString(oReader.GetOrdinal("HTML")),
					oReader.IsDBNull(oReader.GetOrdinal("URL")) ? null : oReader.GetString(oReader.GetOrdinal("URL")),
					oReader.IsDBNull(oReader.GetOrdinal("URLTARGET")) ? null : oReader.GetString(oReader.GetOrdinal("URLTARGET")));
		}

		oReader.Close();
		Cn.Close();
	}
开发者ID:veraveramanolo,项目名称:power-show,代码行数:39,代码来源:cs_database.aspx.cs

示例2: Page_Load

	private void Page_Load(object sender, System.EventArgs e)
	{
		System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
		xmlDoc.Load(Server.MapPath("TextMenuXML.xml"));

		System.Xml.XmlNodeList menuNodes = xmlDoc.SelectNodes("/TextMenu");

		foreach (System.Xml.XmlNode menuNode in menuNodes)
		{
			string menuID = menuNode.Attributes["ID"].Value;

			// create new TextMenu object ...
			TextMenu tmpMenu = new TextMenu();
			tmpMenu.ID = menuID;
			
			// take the childs and create the menu items ...
			System.Xml.XmlNodeList menuItemsNodes = menuNode.SelectNodes("//Item");

			foreach (System.Xml.XmlNode menuItemNode in menuItemsNodes)
			{
				string menuItemID = menuItemNode.Attributes["ID"].Value;
				string InnerHTML = menuItemNode.Attributes["InnerHTML"].Value;
				string parentMenuItemID = null;
				if (menuItemNode.Attributes["ParentID"] != null)
					parentMenuItemID = menuItemNode.Attributes["ParentID"].Value;
				string menuUrl = null;
				if (menuItemNode.Attributes["Url"] != null)
					menuUrl = menuItemNode.Attributes["Url"].Value;

				// create new Menu item object and add it to the created menu ...
				tmpMenu.Add(parentMenuItemID, menuItemID, InnerHTML, menuUrl, null);
			}
			
			placeHolder1.Controls.Add(tmpMenu);
		}
	}
开发者ID:veraveramanolo,项目名称:power-show,代码行数:36,代码来源:cs_fromxml.aspx.cs

示例3: ShowFiltersMenu

        private void ShowFiltersMenu(int index, TextMenu.Item ti)
        {
            currentMenu = MenuList.Filters;

            activeMenu = new TextMenu();

            activeMenu.labelColor = nameColorTag;
            activeMenu.selectedColor = selectedColorTag;
            activeMenu.disabledColor = unavailableColorTag;
            activeMenu.rightTextColor = distanceColorTag;
            for (int i = 0; i < vesselFilter.Count; i++)
            {
                var filter = vesselFilter.ElementAt(i);
                var tmi = new TextMenu.Item();
                tmi.labelText = filter.Key.ToString().PadRight(9) + (filter.Value ? "- On" : "- Off");
                tmi.isSelected = filter.Value;
                tmi.action = ToggleFilter;
                activeMenu.Add(tmi);
            }
        }
开发者ID:S-C-A-N,项目名称:RasterPropMonitor,代码行数:20,代码来源:JSITargetMenu.cs

示例4: Page_Load

	private void Page_Load(object sender, System.EventArgs e)
	{
		TextMenu tm1 = new TextMenu();
		tm1.ID = "tm1";
		tm1.StyleFolder = "styles/submenuicon";
		tm1.SubMenuText = "";

		tm1.Add(null, "brands", "Brands", null, null);
			tm1.Add("brands", "ibm", "IBM");
			tm1.Add("brands", "microsoft", "MICROSOFT");
			tm1.Add("brands", "obout", "OBOUT", "http://www.obout.com/", "_top");
				tm1.Add("obout", "treeview", "TreeView", "http://www.obout.com/t2/edraganddrop.aspx", "_top");
				tm1.Add("obout", "slidemenu", "Slide Menu", "http://www.obout.com/sm3/whatisnew.aspx", "_top");
				tm1.Add("obout", "calendar", "Calendar", "http://www.obout.com/calendar/", "_top");
				tm1.Add("obout", "postback", "AJAXPage", "http://www.obout.com/AJAXPage/", "_top");
				tm1.Add("obout", "splitter", "Splitter", "http://www.obout.com/splitter/", "_top");
				tm1.Add("obout", "easymenu", "EasyMenu", "http://www.obout.com/em/", "_top");
				tm1.Add("obout", "combobox", "Combobox", "http://www.obout.com/combobox/", "_top");
				tm1.Add("obout", "editor", "HTML Editor", "http://www.obout.com/editor_new/", "_top");
				tm1.Add("obout", "treedb", "Tree_DB", "http://www.obout.com/t_db/index.aspx", "_top");
				tm1.Add("obout", "textmenu", "TextMenu", "http://www.obout.com/tm/tm.aspx", "_top");
		tm1.Add(null, "systems", "Systems");
			tm1.Add("systems", "desktops", "Desktops");
			tm1.Add("systems", "handhelds", "Handhelds");
			tm1.Add("systems", "notebooks", "Notebooks");
			tm1.Add("systems", "servers", "Servers");
		tm1.Add(null, "hardware", "Hardware");
			tm1.Add("hardware", "accessories", "Accessories");
			tm1.Add("hardware", "keyboards", "Keyboards");
			tm1.Add("hardware", "memory", "Memory");
			tm1.Add("hardware", "printers", "Printers");
			tm1.Add("hardware", "videocards", "Video Cards");
		tm1.Add(null, "software", "Software");
			tm1.Add("software", "applications", "Applications");
			tm1.Add("software", "licensing", "Licensing");

		this.Controls.Add(tm1);
	}
开发者ID:veraveramanolo,项目名称:power-show,代码行数:38,代码来源:cs_SubmenuIcon.aspx.cs

示例5: ShowCrewEVA

        private void ShowCrewEVA(int index, TextMenu.Item ti)
        {
            currentMenu = MenuList.CrewEVA;

            activeMenu = new TextMenu();
            activeMenu.labelColor = nameColorTag;
            activeMenu.selectedColor = selectedColorTag;
            activeMenu.disabledColor = unavailableColorTag;
            activeMenu.rightTextColor = distanceColorTag;

            var vesselCrew = vessel.GetVesselCrew();
            for (int crewIdx = 0; crewIdx < vesselCrew.Count; ++crewIdx)
            {
                if (vesselCrew[crewIdx] != null)
                {
                    var tmi = new TextMenu.Item();
                    tmi.action = CrewEVA;
                    tmi.labelText = vesselCrew[crewIdx].name;
                    tmi.rightText = vesselCrew[crewIdx].experienceTrait.Title;
                    tmi.isSelected = false;
                    tmi.id = crewIdx;
                    activeMenu.Add(tmi);
                }
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:25,代码来源:JSITargetMenu.cs

示例6: TargetMenu

        private void TargetMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.TargetMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);

            foreach (JSIMechJeb.Target target in targetTargets)
            {
                activeMenu.Add(new TextMenu.Item(JSIMechJeb.TargetTexts[(int)target].Replace('\n', ' '), SelectTarget));
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:14,代码来源:MechJebRPM.cs

示例7: CircularizeMenu

        // MOARdV: Spaceplane Guidance can not be implemented cleanly, because
        // MJ's MechJebModuleSpaceplaneGuidance is missing the 'public'
        // keyword.  We could use another controller (like ourself), but that
        // means one is forced to use our menu to turn it off (the MJ GUI is
        // not able to change the setting), and vice versa.  Since every other
        // place where we interface with MJ, we use MJ's objects as the
        // controller, this breaks our design model.  If/when MJ makes the
        // module public, all of the commented code here related to it can be
        // uncommented, and this missive can be deleted.
        //private void SpaceplaneGuidance(int index, TextMenu.Item tmi)
        //{
        //    UpdateJebReferences();
        //    if (activeJeb != null) {
        //        var autopilot = activeJeb.GetComputerModule<MechJebModuleSpaceplaneAutopilot>();
        //        if (autopilot != null) {
        //            MechJebModuleSpaceplaneGuidance is not currently public.  Can't use it.
        //            var autopilotController = activeJeb.GetComputerModule<MechJebModuleSpaceplaneGuidance>();
        //            if (autopilotController != null) {
        //                if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.HOLD) {
        //                    autopilot.AutopilotOff();
        //                } else if (!autopilot.enabled) {
        //                    autopilot.HoldHeadingAndAltitude(autopilotController);
        //                }
        //            }
        //        }
        //    }
        //}
        private void CircularizeMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.CircularizeMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);
            activeMenu.menuTitle = "== Circularize Menu:";

            activeMenu.Add(new TextMenu.Item("At Next Ap", DoCircularize, (int)JSIMechJeb.TimeReference.APOAPSIS));
            activeMenu.Add(new TextMenu.Item("At Next Pe", DoCircularize, (int)JSIMechJeb.TimeReference.PERIAPSIS));
            activeMenu.Add(new TextMenu.Item("In 15s", DoCircularize, (int)JSIMechJeb.TimeReference.X_FROM_NOW));
        }
开发者ID:Kerbas-ad-astra,项目名称:RasterPropMonitor,代码行数:41,代码来源:MechJebRPM.cs


注:本文中的TextMenu.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。