|
|
|
@ -34,18 +34,22 @@ namespace WorkflowDesigner
@@ -34,18 +34,22 @@ namespace WorkflowDesigner
|
|
|
|
|
|
|
|
|
|
LoggingService.Debug("ShowContextMenu"); |
|
|
|
|
|
|
|
|
|
if (menuID == WorkflowMenuCommands.DesignerActionsMenu) |
|
|
|
|
{ |
|
|
|
|
if (menuID == WorkflowMenuCommands.DesignerActionsMenu) { |
|
|
|
|
ContextMenuStrip contextMenu = new ContextMenuStrip(); |
|
|
|
|
|
|
|
|
|
Guid DesignerActionGuid = new Guid("3bd4a275-fccd-49f0-b617-765ce63b4340"); |
|
|
|
|
|
|
|
|
|
ICollection collection = this.GetCommandList(menuID.Guid); |
|
|
|
|
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) |
|
|
|
|
{ |
|
|
|
|
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) { |
|
|
|
|
// Only interested in the errors.
|
|
|
|
|
if (menuCommand.CommandID.ID == 8342) |
|
|
|
|
{ |
|
|
|
|
if (menuCommand.CommandID.ID == 8342) { |
|
|
|
|
foreach (object o in menuCommand.Properties.Keys) |
|
|
|
|
LoggingService.DebugFormatted("{0} {1}", o.GetType(), o.ToString()); |
|
|
|
|
foreach (object o in menuCommand.Properties.Values) |
|
|
|
|
LoggingService.DebugFormatted("{0} {1}", o.GetType(), o.ToString()); |
|
|
|
|
ToolStripMenuItem menuItem = new ToolStripMenuItem(menuCommand.Properties["Text"].ToString()); |
|
|
|
|
menuItem.Click += ClickHandler; |
|
|
|
|
menuItem.Click += new EventHandler(ClickHandler); |
|
|
|
|
menuItem.Tag = menuCommand.Properties[DesignerActionGuid]; |
|
|
|
|
contextMenu.Items.Add(menuItem); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -58,8 +62,42 @@ namespace WorkflowDesigner
@@ -58,8 +62,42 @@ namespace WorkflowDesigner
|
|
|
|
|
|
|
|
|
|
void ClickHandler(object sender, EventArgs e) |
|
|
|
|
{ |
|
|
|
|
// TODO: Move focus to the property in the property pad.
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
DesignerAction designerAction = ((ToolStripMenuItem)sender).Tag as DesignerAction; |
|
|
|
|
if (designerAction == null) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
designerAction.Invoke(); // Will change the selectedObject in the designer
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty( designerAction.PropertyName)) |
|
|
|
|
{ |
|
|
|
|
// No easy way to search for a grid item so
|
|
|
|
|
// find the root item in the grid, and search for items for the property.
|
|
|
|
|
GridItem item = PropertyPad.Grid.SelectedGridItem; |
|
|
|
|
while (item.Parent != null) { |
|
|
|
|
item = item.Parent; |
|
|
|
|
} |
|
|
|
|
GridItem item2 = FindGridItem(item, designerAction.PropertyName); |
|
|
|
|
|
|
|
|
|
if (item2 != null) { |
|
|
|
|
PropertyPad.Grid.SelectedGridItem = item2; |
|
|
|
|
PropertyPad.Grid.Focus(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static GridItem FindGridItem(GridItem gridItem, string name) |
|
|
|
|
{ |
|
|
|
|
foreach (GridItem item in gridItem.GridItems){ |
|
|
|
|
if (item.Label == name) |
|
|
|
|
return item; |
|
|
|
|
|
|
|
|
|
GridItem item2 = FindGridItem(item, name); |
|
|
|
|
if (item2 != null) |
|
|
|
|
return item2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|