本文整理汇总了C#中TextMenu类的典型用法代码示例。如果您正苦于以下问题:C# TextMenu类的具体用法?C# TextMenu怎么用?C# TextMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextMenu类属于命名空间,在下文中一共展示了TextMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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);
}
示例3: 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);
}
}
示例4: SetReferencePoint
// Reference Menu
private void SetReferencePoint(int index, TextMenu.Item ti)
{
// This is going to get complicated...
if (referencePoints[index].part != vessel.GetReferenceTransformPart())
{
referencePoints[index].part.MakeReferencePart();
}
activeMenu.SetSelected(index, true);
}
示例5: DecouplePort
// Decouple port menu...
private void DecouplePort(int index, TextMenu.Item ti)
{
var thatPort = undockablesList[index] as ModuleDockingNode;
var thatClaw = undockablesList[index] as ModuleGrappleNode;
if (thatPort != null)
{
switch (thatPort.state)
{
case "Docked (docker)":
thatPort.Undock();
break;
case "PreAttached":
thatPort.Decouple();
break;
}
}
// Mihara: Claws require multiple different calls depending on state --
// Release releases the claw that grabbed something else, while Decouple releases the claw that grabbed your own vessel.
// FIXME: This needs further research.
if (thatClaw != null)
{
thatClaw.Release();
}
UpdateUndockablesList();
activeMenu = topMenu;
currentMenu = MenuList.Root;
UpdateLists();
}
示例6: TargetVessel
// Vessel Menu
private void TargetVessel(int index, TextMenu.Item ti)
{
if (selectedVessel == vesselsList[index].vessel)
{
// Already selected. Are there ports?
UpdatePortsList();
if (portsList.Count > 0)
{
currentMenu = MenuList.Ports;
activeMenu = new TextMenu();
activeMenu.rightColumnWidth = 8;
activeMenu.labelColor = nameColorTag;
activeMenu.selectedColor = selectedColorTag;
activeMenu.disabledColor = unavailableColorTag;
activeMenu.rightTextColor = distanceColorTag;
UpdateLists();
if (selectedPort != null)
{
int idx = portsList.FindIndex(x => x == selectedPort);
activeMenu.currentSelection = idx;
}
}
}
else
{
vesselsList[index].SetTarget();
selectedCelestial = null;
selectedPort = null;
activeMenu.SetSelected(index, true);
}
}
示例7: SAS_Mode
private void SAS_Mode(int arg1, TextMenu.Item arg2)
{
vessel.Autopilot.SetMode(modes[arg1]);
// find the UI object on screen
RUIToggleButton[] SASbtns = UnityEngine.Object.FindObjectOfType<VesselAutopilotUI>().modeButtons;
// set our mode, note it takes the mode as an int, generally top to bottom, left to right, as seen on the screen. Maneuver node being the exception, it is 9
SASbtns.ElementAt<RUIToggleButton>((int)modes[arg1]).SetTrue(true, true);
}
示例8: ShowReferenceMenu
private void ShowReferenceMenu(int index, TextMenu.Item ti)
{
currentMenu = MenuList.Reference;
activeMenu = new TextMenu();
activeMenu.labelColor = nameColorTag;
activeMenu.selectedColor = selectedColorTag;
activeMenu.disabledColor = unavailableColorTag;
activeMenu.rightTextColor = distanceColorTag;
UpdateLists();
activeMenu.currentSelection = referencePoints.FindIndex(x => x.part == vessel.GetReferenceTransformPart());
}
示例9: SmartASS_KillRot
private void SmartASS_KillRot(int index, TextMenu.Item tmi)
{
SetSmartassMode(JSIMechJeb.Target.KILLROT);
}
示例10: CrewEVA
// EVA Menu
private void CrewEVA(int index, TextMenu.Item ti)
{
var vesselCrew = vessel.GetVesselCrew();
float acLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.AstronautComplex);
bool evaUnlocked = GameVariables.Instance.UnlockedEVA(acLevel);
bool evaPossible = GameVariables.Instance.EVAIsPossible(evaUnlocked, vessel);
if (evaPossible && ti.id < vesselCrew.Count && vesselCrew[ti.id] != null && HighLogic.CurrentGame.Parameters.Flight.CanEVA)
{
FlightEVA.SpawnEVA(vesselCrew[ti.id].KerbalRef);
CameraManager.Instance.SetCameraFlight();
}
}
示例11: 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);
}
}
}
示例12: ToggleForceRoll
private void ToggleForceRoll(int index, TextMenu.Item tmi)
{
bool newForceRollState = !ForceRollState();
forceRollMenuItem.isSelected = newForceRollState;
ForceRoll(newForceRollState);
}
示例13: Start
public void Start()
{
if (!HighLogic.LoadedSceneIsFlight)
return;
rpmComp = RasterPropMonitorComputer.Instantiate(internalProp, true);
// Grrrrrr.
if (!string.IsNullOrEmpty(nameColor))
nameColorValue = ConfigNode.ParseColor32(nameColor);
if (!string.IsNullOrEmpty(distanceColor))
distanceColorValue = ConfigNode.ParseColor32(distanceColor);
if (!string.IsNullOrEmpty(selectedColor))
selectedColorValue = ConfigNode.ParseColor32(selectedColor);
if (!string.IsNullOrEmpty(unavailableColor))
unavailableColorValue = ConfigNode.ParseColor32(unavailableColor);
persistentVarName = "targetfilter" + internalProp.propID;
// 7 is the bitmask for ship-station-probe;
VesselFilterFromBitmask(rpmComp.GetPersistentVariable(persistentVarName, defaultFilter, false).MassageToInt());
nameColorTag = JUtil.ColorToColorTag(nameColorValue);
distanceColorTag = JUtil.ColorToColorTag(distanceColorValue);
selectedColorTag = JUtil.ColorToColorTag(selectedColorValue);
unavailableColorTag = JUtil.ColorToColorTag(unavailableColorValue);
distanceFormatString = distanceFormatString.UnMangleConfigText();
menuTitleFormatString = menuTitleFormatString.UnMangleConfigText();
topMenu.labelColor = nameColorTag;
topMenu.selectedColor = selectedColorTag;
topMenu.disabledColor = unavailableColorTag;
if (!string.IsNullOrEmpty(pageTitle))
pageTitle = pageTitle.UnMangleConfigText();
foreach (CelestialBody body in FlightGlobals.Bodies)
{
celestialsList.Add(new Celestial(body, vessel.transform.position));
}
FindReferencePoints();
UpdateUndockablesList();
var menuActions = new List<Action<int, TextMenu.Item>>();
menuActions.Add(ShowCelestialMenu);
menuActions.Add(ShowVesselMenu);
menuActions.Add(ShowSpaceObjectMenu);
menuActions.Add(ShowReferenceMenu);
menuActions.Add(ShowUndockMenu);
menuActions.Add(ArmGrapple);
menuActions.Add(ShowFiltersMenu);
menuActions.Add(ClearTarget);
menuActions.Add(ShowCrewEVA);
for (int i = 0; i < rootMenu.Count; ++i)
{
var menuitem = new TextMenu.Item();
menuitem.labelText = rootMenu[i];
menuitem.action = menuActions[i];
topMenu.Add(menuitem);
switch (menuitem.labelText)
{
case clearTargetItemText:
clearTarget = topMenu[i];
break;
case undockItemText:
undockMenuItem = topMenu[i];
break;
case armGrappleText:
grappleMenuItem = topMenu[i];
break;
case crewEvaText:
float acLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.AstronautComplex);
bool evaUnlocked = GameVariables.Instance.UnlockedEVA(acLevel);
menuitem.isDisabled = !GameVariables.Instance.EVAIsPossible(evaUnlocked, vessel);
break;
}
}
activeMenu = topMenu;
}
示例14: 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));
}
}
示例15: SmartASS_Off
private void SmartASS_Off(int index, TextMenu.Item tmi)
{
SetSmartassMode(JSIMechJeb.Target.OFF);
}