locked
Problem after using Hands On Lab 10 ( (!) doesnt appear ) RRS feed

  • Question

  • Hi all,

     

    i created my own Workflowdesigner and host it in a form application. Now im able to add activities, compile and run my workflow. I also use an activityvalidator on my Custom Activity.

    But now if i put the Activity to my WorkflowDesigner the red(!) does not appear. I just get an error when i try to compile the workflow!

    What do i have to change, that im able to see the errors in the designer with the (!)?

     

    Best regards!

    Monday, April 7, 2008 3:15 PM

Answers

  • Hi,

     

    You would need to implement your own MenuCommandService and then add the following code to your overridden ShowContextMenu  function:

     

    if (menuID == WorkflowMenuCommands.DesignerActionsMenu)

    {

    ArrayList coll = this.GetCommandList(menuID.Guid) as ArrayList;

    ContextMenuStrip contextMenuStrip = new ContextMenuStrip();

    MenuCommand last = coll[coll.Count - 1] as MenuCommand;

    string error = last.Properties["Text"].ToString();

    ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(error, null, new EventHandler(this.OnMenuClicked));

    contextMenuStrip.Items.Add(toolStripMenuItem);

    toolStripMenuItem.Tag = last;

    last.Invoke();

    WorkflowView view = base.GetService(typeof(WorkflowView )) as WorkflowView;

    if (view != null)

    {

    contextMenuStrip.MouseLeave += delegate(object o, EventArgs e) { contextMenuStrip.Close(); };

    contextMenuStrip.Show(view, view.PointToClient(new Point(x, y)));

    }

    }

     

    And if you want the error glyph to show up as well, then do the following:

    WorkflowTheme.CurrentTheme.AmbientTheme.ShowConfigErrors = true;


     

    Thursday, April 10, 2008 7:08 PM
    Moderator

All replies

  • You need to write your own MenuCommandService.

     

    Here are some posts that explain how to do it using the Rehosting Sample from MSDN:

    Displaying Error Icons when hosting the Designer
    http://forums.microsoft.com/msdn/ShowPost.aspx?postid=1960495&isthread=false&siteid=1

    Getting all validation error in rehosted designer without compiling workflow

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1386837&SiteID=1

     

    -Sharad

    Thursday, April 10, 2008 12:37 AM
    Moderator
  • Hi,

     

    You would need to implement your own MenuCommandService and then add the following code to your overridden ShowContextMenu  function:

     

    if (menuID == WorkflowMenuCommands.DesignerActionsMenu)

    {

    ArrayList coll = this.GetCommandList(menuID.Guid) as ArrayList;

    ContextMenuStrip contextMenuStrip = new ContextMenuStrip();

    MenuCommand last = coll[coll.Count - 1] as MenuCommand;

    string error = last.Properties["Text"].ToString();

    ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(error, null, new EventHandler(this.OnMenuClicked));

    contextMenuStrip.Items.Add(toolStripMenuItem);

    toolStripMenuItem.Tag = last;

    last.Invoke();

    WorkflowView view = base.GetService(typeof(WorkflowView )) as WorkflowView;

    if (view != null)

    {

    contextMenuStrip.MouseLeave += delegate(object o, EventArgs e) { contextMenuStrip.Close(); };

    contextMenuStrip.Show(view, view.PointToClient(new Point(x, y)));

    }

    }

     

    And if you want the error glyph to show up as well, then do the following:

    WorkflowTheme.CurrentTheme.AmbientTheme.ShowConfigErrors = true;


     

    Thursday, April 10, 2008 7:08 PM
    Moderator