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


C# ContextMenu.AddAction方法代码示例

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


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

示例1: region_Loaded

		private void region_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var region = (Region)border.DataContext;
			var menu = new ContextMenu();
			menu.AddAction("New Region", CreateNewRegion);
			menu.AddAction("Rename", () => RenameRegion(region));
			menu.AddAction("Delete", () => DeleteRegion(region));
			border.ContextMenu = menu;
		}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:10,代码来源:MainWindow.xaml.cs

示例2: trigger_Loaded

		void trigger_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var trigger = (Trigger)border.DataContext;
			var menu = new ContextMenu();
			menu.AddAction("New Trigger", CreateNewTrigger);
			menu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
            menu.AddAction("Copy Trigger", () => Mission.CopyTrigger(trigger));
			menu.Items.Add(GetNewActionMenu(trigger));
			menu.Items.Add(GetNewConditionMenu(trigger));
			menu.Items.Add(new Separator());
			menu.AddAction("Move Up", () => MoveTrigger(MoveDirection.Up, trigger));
            menu.AddAction("Move Up 5 Spaces", () => MoveTrigger(MoveDirection.Up, trigger, 5));
            menu.AddAction("Move to Top", () => MoveTrigger(MoveDirection.Up, trigger, true));
			menu.AddAction("Move Down", () => MoveTrigger(MoveDirection.Down, trigger));
            menu.AddAction("Move Down 5 Spaces", () => MoveTrigger(MoveDirection.Down, trigger, 5));
            menu.AddAction("Move to Bottom", () => MoveTrigger(MoveDirection.Down, trigger, true));
			menu.AddAction("Rename", () => RenameTrigger(trigger));
			menu.AddAction("Delete", () => DeleteTrigger(trigger));
			menu.Items.Add(new Separator());
			menu.AddAction("Expand All Triggers", ExpandAllTriggers);
			menu.AddAction("Collapse All Triggers", CollapseAllTriggers);
			menu.AddAction("Collapse All But This", () => CollapseAllButThisTrigger(trigger));
			border.ContextMenu = menu;
		}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:25,代码来源:MainWindow.xaml.cs

示例3: window_Loaded

		void window_Loaded(object sender, RoutedEventArgs e)
		{
			var project = MainMenu.AddContainer("Project");
			project.AddAction("New", NewMission);
			project.AddAction("Open", LoadMission);
			project.AddAction("Save", QuickSave);
			project.AddAction("Save As", SaveMission);

            var welcomeScreen = new WelcomeDialog { ShowInTaskbar = true, Owner = this };
            welcomeScreen.ShowDialog();
            if (Mission == null)
            {
                MessageBox.Show("A mission needs to be selected");
                Environment.Exit(0);
            }

            var mission = MainMenu.AddContainer("Mission");
            mission.AddAction("Create Mutator", () => BuildMission());
            mission.AddAction("Create Invisible Mutator", () => BuildMission(true));
            mission.AddAction("Test Mission", TestMission);
            mission.AddAction("Export Localization File", ExportLocalizationFile);
            mission.AddAction("Publish", ShowMissionManagement);
            mission.AddAction("Settings", ShowMissionSettings);

            var newMenu = MainMenu.AddContainer("New");
            newMenu.AddAction("New Trigger", CreateNewTrigger);
            newMenu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
            newMenu.AddAction("New Region", CreateNewRegion);
            newMenu.AddAction("Copy Trigger", () => Mission.CopyTrigger(CurrentTrigger));
            newMenu.Items.Add(GetNewConditionMenu(delegate
            {
                if (logicGrid.SelectedItem is Trigger) return CurrentTrigger;
                if (logicGrid.SelectedItem is ActionsFolder) return CurrentActionsFolder.Trigger;
                if (logicGrid.SelectedItem is ConditionsFolder) return CurrentConditionsFolder.Trigger;
                if (logicGrid.SelectedItem is TriggerLogic) return Mission.FindLogicOwner(CurrentLogic);
                return null;
            }));
            newMenu.Items.Add(GetNewActionMenu(() => CurrentTrigger));

            var editMenu = MainMenu.AddContainer("Edit");
            editMenu.AddAction("Rename", RenameCurrentItem);
            editMenu.AddAction("Delete", DeleteCurrentItem);
            editMenu.AddAction("Move Up", () => MoveCurrentItem(MoveDirection.Up));
            editMenu.AddAction("Move Up 5 Spaces", () => MoveCurrentItem(MoveDirection.Up, 5));
            editMenu.AddAction("Move To Top", () => MoveCurrentItem(MoveDirection.Up, true));
            editMenu.AddAction("Move Down", () => MoveCurrentItem(MoveDirection.Down));
            editMenu.AddAction("Move Down 5 Spaces", () => MoveCurrentItem(MoveDirection.Down, 5));
            editMenu.AddAction("Move To Bottom", () => MoveCurrentItem(MoveDirection.Down, true));
            editMenu.AddAction("Expand All Triggers", ExpandAllTriggers);
            editMenu.AddAction("Collapse All Triggers", CollapseAllTriggers);

			var menu = new ContextMenu();
			menu.AddAction("New Trigger", CreateNewTrigger);
			menu.AddAction("New Trigger (Repeating)", CreateNewRepeatingTrigger);
			menu.AddAction("New Region", CreateNewRegion);
			logicGrid.ContextMenu = menu;

            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fileVersionInfo.FileVersion;
            var aboutString = String.Format("Mission Editor {0}\n\nby Quantum and KingRaptor\n\nFor help with the program, visit {1}", version, GlobalConst.BaseSiteUrl + "/Wiki/MissionEditorStartPage");
            var help = MainMenu.AddContainer("Help");
            help.AddAction("About", () => MessageBox.Show(aboutString, "About Mission Editor", MessageBoxButton.OK, MessageBoxImage.Information));

            autosaveTimer.Start();
		}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:66,代码来源:MainWindow.xaml.cs

示例4: logic_Loaded

		void logic_Loaded(object sender, RoutedEventArgs e)
		{
			var border = (Border)e.Source;
			var item = (TriggerLogic)border.DataContext;
			var menu = new ContextMenu();
			border.ContextMenu = menu;
			menu.AddAction("Rename", () => RenameLogicItem(item));
			menu.AddAction("Move Up", () => MoveItem(MoveDirection.Up, item));
            menu.AddAction("Move Up 5 Spaces", () => MoveItem(MoveDirection.Up, item, 5));
            menu.AddAction("Move to Top", () => MoveItem(MoveDirection.Up, item, true));
			menu.AddAction("Move Down", () => MoveItem(MoveDirection.Down, item));
            menu.AddAction("Move Down 5 Spaces", () => MoveItem(MoveDirection.Down, item, 5));
            menu.AddAction("Move to Bottom", () => MoveItem(MoveDirection.Down, item, true));
			menu.AddAction("Delete", () => DeleteTriggerLogic(item));
			border.ContextMenu = menu;
		}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:16,代码来源:MainWindow.xaml.cs


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