IDesignerGlyphProvider 接口
定义
注意
The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*
定义标志符号提供程序类用于生成在活动设计器上显示的标志符号数组的方法。Defines the method that glyph provider classes use to generate an array of glyphs to display on an activity designer.
public interface class IDesignerGlyphProvider
public interface IDesignerGlyphProvider
[System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public interface IDesignerGlyphProvider
type IDesignerGlyphProvider = interface
[<System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")>]
type IDesignerGlyphProvider = interface
Public Interface IDesignerGlyphProvider
- 属性
示例
下面的代码示例演示如何实现 IDesignerGlyphProvider 接口。The following code example demonstrates how you can implement the IDesignerGlyphProvider interface. 本示例演示如何实现 GetGlyphs 方法,以便在活动设计器图面上绘制自定义标志符号对象。It shows how you can implement the GetGlyphs method to draw custom glyph objects on an activity designer surface.
此代码示例摘自工作流监视器 SDK 示例中的 DesignerGlyphProvider.cs 文件。This code example is part of the Workflow Monitor SDK Sample from the DesignerGlyphProvider.cs file. 有关详细信息,请参阅 工作流监视器。For more information, see Workflow Monitor.
//Custom glyphprovider used to draw the monitor glyphs on the designer surface
internal class WorkflowMonitorDesignerGlyphProvider : IDesignerGlyphProvider
{
private Dictionary<string, ActivityStatusInfo> activityStatusList;
internal WorkflowMonitorDesignerGlyphProvider(Dictionary<string, ActivityStatusInfo> activityStatusList)
{
this.activityStatusList = activityStatusList;
}
ActivityDesignerGlyphCollection IDesignerGlyphProvider.GetGlyphs(ActivityDesigner activityDesigner)
{
ActivityDesignerGlyphCollection glyphList = new ActivityDesignerGlyphCollection();
//Walk all of the activities and use the 'CompletedGlyph' for all activities that are not 'closed'
foreach (ActivityStatusInfo activityStatus in activityStatusList.Values)
{
if (activityStatus.Name == activityDesigner.Activity.QualifiedName)
{
if (activityStatus.Status == "Closed")
glyphList.Add(new CompletedGlyph());
else
glyphList.Add(new ExecutingGlyph());
}
}
return glyphList;
}
}
'Custom glyphprovider used to draw the monitor glyphs on the designer surface
Friend Class WorkflowMonitorDesignerGlyphProvider
Implements IDesignerGlyphProvider
Dim activityStatusList As Dictionary(Of String, ActivityStatusInfo)
Friend Sub New(ByVal activityStatusList As Dictionary(Of String, ActivityStatusInfo))
Me.activityStatusList = activityStatusList
End Sub
Public Function GetGlyphs(ByVal activityDesigner As System.Workflow.ComponentModel.Design.ActivityDesigner) As System.Workflow.ComponentModel.Design.ActivityDesignerGlyphCollection Implements System.Workflow.ComponentModel.Design.IDesignerGlyphProvider.GetGlyphs
Dim glyphList As ActivityDesignerGlyphCollection = New ActivityDesignerGlyphCollection()
'Walk all of the activities and use the 'CompletedGlyph' for all activities that are not 'closed'
For Each activityStatus As ActivityStatusInfo In activityStatusList.Values
If activityStatus.Name = activityDesigner.Activity.Name Then
If activityStatus.Status = "Closed" Then
glyphList.Add(New CompletedGlyph())
Else
glyphList.Add(New ExecutingGlyph())
End If
End If
Next
Return glyphList
End Function
End Class
注解
备注
本材料讨论的类型和命名空间已废弃不用。This material discusses types and namespaces that are obsolete. 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型。For more information, see Deprecated Types in Windows Workflow Foundation 4.5.
此接口定义了一个方法,实现类必须使用该方法,来为活动设计器提供一组适当的 DesignerGlyph 对象。This interface defines the method that implementing classes must use to provide an appropriate set of DesignerGlyph objects to activity designers. 此外,实现类还应在 DesignerGlyph 对象上呈现 ActivityDesigner 对象。The implementing class should also render the DesignerGlyph objects onto the ActivityDesigner object.
方法
| GetGlyphs(ActivityDesigner) |
返回与指定活动设计器关联的标志符号的数组。Returns an array of glyphs that are associated with the specified activity designer. |