本文整理汇总了C#中System.Windows.Forms.Menu.AddActions方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.AddActions方法的具体用法?C# Menu.AddActions怎么用?C# Menu.AddActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Menu
的用法示例。
在下文中一共展示了Menu.AddActions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBuildSpecificActions
private void AddBuildSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedItems = builds.Grid.SelectedRows;
if (selectedItems.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedItems[0].DataRow;
var buildId = row["ID"];
var buildName = row["Name"];
var builtInActions = new[]
{
new MenuAction("defaultOpen", "&Open", true,
() => SetCurrentBuild(buildId, buildName) ),
};
items.AddActions(builtInActions);
var specificActions = _buildRepository.GetBuildActions(buildId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例2: AddTaskSpecificActions
private void AddTaskSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var taskId = taskGrid.FindSelectedId();
if (taskId != null)
{
var specificActions = _taskRepository.GetTaskActions(taskId);
if (specificActions.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
items.AddActions(specificActions);
}
if (_sourceRepository != null)
{
if (specificActions.Count > 0)
{
items.AddSeparator();
}
items.AddActions(
new MenuAction("createBranch", "Create branch for task {0}".FormatInvariant(taskId), true,
() => CreateBranch(taskId)),
new MenuAction("goToBranch", "Go to branch for task {0}".FormatInvariant(taskId), true,
() => GoToBranchFor(taskId))
);
}
}
}
示例3: AddShelvesetSpecificActions
private void AddShelvesetSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedItems = shelvesetGrid.Grid.SelectedRows;
if (selectedItems.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedItems[0].DataRow;
var shelvesetId = row["ID"];
var shelvesetName = (string) row["Name"];
var builtInActions = new[]
{
new MenuAction("defaultInspect", "&Inspect", true,
() => SetCurrentShelveset(shelvesetId, shelvesetName) ),
};
items.AddActions(builtInActions);
var specificActions = _shelvesetRepository.GetShelvesetActions(shelvesetId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例4: AddBranchSpecificActions
private void AddBranchSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedRows = branchGrid.Grid.SelectedRows;
if (selectedRows.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedRows[0].DataRow;
var branchId = row["ID"];
var taskId = row["TaskID"];
var builtInActions = new[]
{
new MenuAction("defaultInspect", "&Inspect", true,
() => SetCurrentBranch(branchId, taskId) ),
new MenuAction("defaultOpen", "&Work on this", row["BasePath"] != DBNull.Value,
() => StartWorkOnBranch(branchId, taskId) ),
};
items.AddActions(builtInActions);
var specificActions = _sourceRepository.GetBranchActions(branchId);
if (specificActions.Count > 0)
{
items.AddSeparator();
items.AddActions(specificActions);
}
}
}
示例5: AddRevisionSpecificActions
private void AddRevisionSpecificActions(Menu.MenuItemCollection items, bool needsLeadingSeparator)
{
var selectedItems = activityRevisions.Grid.SelectedRows;
if (selectedItems.Count > 0)
{
if (needsLeadingSeparator)
{
items.AddSeparator();
}
var row = selectedItems[0].DataRow;
var revisionId = row["ID"];
var builtInActions = new[]
{
new MenuAction("defaultOpen", "&Open", true,
() => SetCurrentRevision(revisionId) ),
};
items.AddActions(builtInActions);
// TODO: Should there be specific actions per revision? Maybe an external view, like TFS has...
}
}