本文整理汇总了C#中MenuCommand类的典型用法代码示例。如果您正苦于以下问题:C# MenuCommand类的具体用法?C# MenuCommand怎么用?C# MenuCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuCommand类属于命名空间,在下文中一共展示了MenuCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddRenameCommand
void AddRenameCommand(IClass c, List<ToolStripItem> resultItems)
{
var cmd = new MenuCommand("${res:SharpDevelop.Refactoring.RenameCommand}", Rename);
cmd.ShortcutKeys = MenuCommand.ParseShortcut("Control|R");
cmd.Tag = c;
resultItems.Add(cmd);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:ClassRefactoringSubmenuBuilder.cs
示例2: SaveMeshInPlace
public static void SaveMeshInPlace(MenuCommand menuCommand)
{
VoxelMesh vm = menuCommand.context as VoxelMesh;
SaveVoxelStruct(vm);
}
开发者ID:cedric-demongivert,项目名称:unity-voxel,代码行数:7,代码来源:VoxelSaverEditor.cs
示例3: AddAccordionElement
public static void AddAccordionElement(MenuCommand menuCommand)
{
GameObject go = CreateUIElementRoot("Accordion Element", menuCommand, s_ThickGUIElementSize);
go.AddComponent<LayoutElement>();
go.AddComponent<AccordionElement>();
Selection.activeGameObject = go;
}
开发者ID:renketsu0,项目名称:oculus_data_vis,代码行数:7,代码来源:UIExtensionsMenuOptions.cs
示例4: PopupMenu
/// <summary>
/// Display the popup menu for this row
/// </summary>
/// <param name="parent">The parent control</param>
/// <param name="x">X coordinate of menu</param>
/// <param name="y">Y coordinate of menu</param>
public void PopupMenu( System.Windows.Forms.Control parent , int x , int y )
{
// Use reflection to get the list of popup menu commands
MemberInfo[] members = this.GetType().FindMembers ( MemberTypes.Method ,
BindingFlags.Public | BindingFlags.Instance ,
new System.Reflection.MemberFilter ( Filter ) ,
null ) ;
if ( members.Length > 0 )
{
// Create a context menu
ContextMenu menu = new ContextMenu ( ) ;
// Now loop through those members and generate the popup menu
// Note the cast to MethodInfo in the foreach
foreach ( MethodInfo meth in members )
{
// Get the caption for the operation from the ContextMenuAttribute
ContextMenuAttribute[] ctx = (ContextMenuAttribute[]) meth.GetCustomAttributes ( typeof ( ContextMenuAttribute ) , true ) ;
MenuCommand callback = new MenuCommand ( this , meth ) ;
MenuItem item = new MenuItem ( ctx[0].Caption , new EventHandler ( callback.Execute ) ) ;
item.DefaultItem = ctx[0].Default ;
menu.MenuItems.Add ( item ) ;
}
System.Drawing.Point pt = new System.Drawing.Point ( x , y ) ;
menu.Show ( parent , pt ) ;
}
}
开发者ID:alannet,项目名称:example,代码行数:38,代码来源:Data.cs
示例5: ValidateSliceUsingXML
public static bool ValidateSliceUsingXML(MenuCommand command) {
var textureImporter = command.context as TextureImporter;
//valid only if the texture type is 'sprite' or 'advanced'.
return textureImporter && textureImporter.textureType == TextureImporterType.Sprite ||
textureImporter.textureType == TextureImporterType.Advanced;
}
开发者ID:andresfelipemendez,项目名称:drone,代码行数:7,代码来源:TextureAtlasSlicer.cs
示例6: ExtractCubemap
public static void ExtractCubemap(MenuCommand mc)
{
var path = AssetDatabase.GetAssetPath(mc.context);
if (string.IsNullOrEmpty(path) == false)
{
var assets = AssetDatabase.LoadAllAssetsAtPath(path);
if (RemoveExtension(ref path) == true)
{
foreach (var asset in assets)
{
var cubemap = asset as Cubemap;
if (cubemap != null)
{
SaveCubemapFace(cubemap, CubemapFace.NegativeX, path);
SaveCubemapFace(cubemap, CubemapFace.NegativeY, path);
SaveCubemapFace(cubemap, CubemapFace.NegativeZ, path);
SaveCubemapFace(cubemap, CubemapFace.PositiveX, path);
SaveCubemapFace(cubemap, CubemapFace.PositiveY, path);
SaveCubemapFace(cubemap, CubemapFace.PositiveZ, path);
}
}
}
}
}
开发者ID:JasonSlingsCode,项目名称:Mindjammer,代码行数:27,代码来源:SgtExtractCubemap.cs
示例7: ValidateSliceUsingXML
public static bool ValidateSliceUsingXML(MenuCommand cmd)
{
TextureImporter importer = cmd.context as TextureImporter;
return importer != null &&
(importer.textureType == TextureImporterType.Sprite || importer.textureType == TextureImporterType.Advanced);
}
开发者ID:CastleWSC,项目名称:SpriteSheetSlicer,代码行数:7,代码来源:XMLSpriteSlicer.cs
示例8: AddGNStringText
private static void AddGNStringText(MenuCommand menuCommand)
{
GameObject go = new GameObject("Text");
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
if(go.GetComponentInParent<Canvas>()== null)
{
var canvas = Object.FindObjectOfType<Canvas>();
if(canvas == null)
{
var goCanvas = new GameObject("Canvas");
canvas = goCanvas.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
goCanvas.AddComponent<UnityEngine.UI.CanvasScaler>();
goCanvas.AddComponent<UnityEngine.UI.GraphicRaycaster>();
}
go.transform.SetParent(canvas.transform);
go.transform.localPosition = Vector3.zero;
}
go.AddComponent<GNText>();
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
Selection.activeObject = go;
if(GNStringManager.instance == null)
{
var sm = new GameObject("StringManager");
sm.AddComponent<GNStringManager>();
}
}
开发者ID:geniikw,项目名称:GNStringPackage,代码行数:32,代码来源:GNStringStaticClass.cs
示例9: AddButton
public static void AddButton(MenuCommand menuCommand)
{
GameObject buttonRoot = CreateUIElementRoot("Button", menuCommand, s_ThickGUIElementSize);
GameObject childText = new GameObject("Text");
GameObjectUtility.SetParentAndAlign(childText, buttonRoot);
Image image = buttonRoot.AddComponent<Image>();
image.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
image.type = Image.Type.Sliced;
image.color = s_DefaultSelectableColor;
Button bt = buttonRoot.AddComponent<Button>();
SetDefaultColorTransitionValues(bt);
Text text = childText.AddComponent<Text>();
text.text = "Button";
text.alignment = TextAnchor.MiddleCenter;
SetDefaultTextValues(text);
RectTransform textRectTransform = childText.GetComponent<RectTransform>();
textRectTransform.anchorMin = Vector2.zero;
textRectTransform.anchorMax = Vector2.one;
textRectTransform.sizeDelta = Vector2.zero;
}
开发者ID:Reshille,项目名称:Gentlemanners,代码行数:25,代码来源:MenuOptions.cs
示例10: DoSomethingAll
static void DoSomethingAll(MenuCommand theCommand)
{
List<Object> aList = new List<Object>();
aList.Add(((Component)theCommand.context).gameObject);
aList.AddRange(((Component)theCommand.context).GetComponents<Component>());
Search(aList.ToArray());
}
开发者ID:numaiomul,项目名称:MDV,代码行数:7,代码来源:KGFWindowSceneReferences.cs
示例11: SliceUsingXML
public static void SliceUsingXML(MenuCommand cmd)
{
TextureImporter importer = cmd.context as TextureImporter;
XMLSpriteSlicer window = ScriptableObject.CreateInstance<XMLSpriteSlicer>();
window._textureImporter = importer;
window.ShowUtility();
}
开发者ID:CastleWSC,项目名称:SpriteSheetSlicer,代码行数:8,代码来源:XMLSpriteSlicer.cs
示例12: Create_DialogueCanvas
private static void Create_DialogueCanvas(MenuCommand menuCommand)
{
GameObject go = Instantiate(Resources.Load("VN Engine/DialogueCanvas", typeof(GameObject))) as GameObject; // Create new object
go.name = "DialogueCanvas";
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); // Register the creation in the undo system
Selection.activeObject = go;
}
开发者ID:sutatsu,项目名称:Spirit-Mecha,代码行数:8,代码来源:VN+Engine+Editor.cs
示例13: CreatePipLight
static void CreatePipLight(MenuCommand menuCommand)
{
GameObject go = new GameObject ("Pip Light");
go.AddComponent<PipLight> ();
GameObjectUtility.SetParentAndAlign (go, menuCommand.context as GameObject);
Undo.RegisterCreatedObjectUndo (go, "Create " + go.name);
Selection.activeObject = go;
}
开发者ID:dvdkouril,项目名称:cellVIEW_volumetric,代码行数:8,代码来源:CustomLightEditor.cs
示例14: BuildMenuByFile
ToolStripItem[] BuildMenuByFile(ICollection<INavigationPoint> points, int additionalItems)
{
Dictionary<string, List<INavigationPoint>> files =
new Dictionary<string, List<INavigationPoint>>();
List<string> fileNames = new List<string>();
foreach (INavigationPoint p in points) {
if (p.FileName==null) {
throw new ApplicationException("should not get here!");
}
if (!fileNames.Contains(p.FileName)) {
fileNames.Add(p.FileName);
files.Add(p.FileName, new List<INavigationPoint>());
}
if (!files[p.FileName].Contains(p)) {
files[p.FileName].Add(p);
}
}
fileNames.Sort();
ToolStripItem[] items =
new ToolStripItem[fileNames.Count + additionalItems];
ToolStripMenuItem containerItem = null;
MenuCommand cmd = null;
int i = 0;
foreach (string fname in fileNames) {
// create a menu bucket
containerItem = new ToolStripMenuItem();
containerItem.Text = System.IO.Path.GetFileName(fname);
containerItem.ToolTipText = fname;
// sort and populate the bucket's contents
// files[fname].Sort();
foreach(INavigationPoint p in files[fname]) {
cmd = new MenuCommand(p.Description, new EventHandler(NavigateTo));
cmd.Tag = p;
containerItem.DropDownItems.Add(cmd);
}
// if there's only one nested item, add it
// to the result directly, ignoring the bucket
// if (containerItem.DropDownItems.Count==1) {
// items[i] = containerItem.DropDownItems[0];
// items[i].Text = ((INavigationPoint)items[i].Tag).FullDescription;
// i++;
// } else {
// // add the bucket to the result
// items[i++] = containerItem;
// }
// add the bucket to the result
items[i++] = containerItem;
}
return items;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:58,代码来源:MenuItemBuilders.cs
示例15: SliceUsingXML
public static void SliceUsingXML(MenuCommand command) {
var textureImporter = command.context as TextureImporter;
var window = CreateInstance<TextureAtlasSlicer>();
window.importer = textureImporter;
window.ShowUtility();
}
开发者ID:andresfelipemendez,项目名称:drone,代码行数:9,代码来源:TextureAtlasSlicer.cs
示例16: Change_Conversation
private static void Change_Conversation(MenuCommand menuCommand)
{
GameObject go = new GameObject("Change Conversation"); // Create new object
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); // Register the creation in the undo system
Selection.activeObject = go;
go.AddComponent<ChangeConversationNode>();
}
开发者ID:sutatsu,项目名称:Spirit-Mecha,代码行数:9,代码来源:VN+Engine+Editor.cs
示例17: Exit_All_Actors
private static void Exit_All_Actors(MenuCommand menuCommand)
{
GameObject go = new GameObject("Exit All Actors"); // Create new object
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); // Register the creation in the undo system
Selection.activeObject = go;
go.AddComponent<ExitAllActorsNode>();
}
开发者ID:sutatsu,项目名称:Spirit-Mecha,代码行数:9,代码来源:VN+Engine+Editor.cs
示例18: AddAccordionGroup
public static void AddAccordionGroup(MenuCommand menuCommand)
{
GameObject go = CreateUIElementRoot("Accordion Group", menuCommand, s_ThickGUIElementSize);
go.AddComponent<VerticalLayoutGroup>();
go.AddComponent<ContentSizeFitter>();
go.AddComponent<ToggleGroup>();
go.AddComponent<Accordion>();
Selection.activeGameObject = go;
}
开发者ID:renketsu0,项目名称:oculus_data_vis,代码行数:9,代码来源:UIExtensionsMenuOptions.cs
示例19: splitButton1_ButtonClick
private void splitButton1_ButtonClick(object sender, EventArgs e)
{
var cmd = new MenuCommand()
{
Name = this.presenter.Validators[0],
presenter = this.presenter
};
cmd.SplitHandler(this, e);
}
开发者ID:yaronn,项目名称:WsiHero,代码行数:9,代码来源:WsiUi.cs
示例20: CheckAddCommandToTwoContexts
public void CheckAddCommandToTwoContexts()
{
var ctx1 = new MenuContext (string.Empty, string.Empty);
var ctx2 = new MenuContext (string.Empty, string.Empty);
var cmd = new MenuCommand (string.Empty, string.Empty);
ctx1.AddCommand (cmd);
ctx2.AddCommand (cmd);
}
开发者ID:victorsamun,项目名称:NSimulator,代码行数:10,代码来源:MenuContext_Test.cs
注:本文中的MenuCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论