IDesignerGlyphProvider 介面

定義

警告

此 API 現已淘汰。

定義圖像 (Glyph) 提供者類別用來產生圖像陣列的方法,讓這些圖像顯示在活動設計工具上。Defines the method that glyph provider classes use to generate an array of glyphs to display on an activity designer.

public interface class IDesignerGlyphProvider
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public interface IDesignerGlyphProvider
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.

這個程式碼範例是 DesignerGlyphProvider.cs 檔案中<工作流程監視器 SDK>範例的一部分。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.

適用於

另請參閱