Bagikan melalui


ActivityDesigner.CanBeParentedTo(CompositeActivityDesigner) Metode

Definisi

Mengembalikan nilai yang menunjukkan apakah CompositeActivity dapat ditetapkan sebagai induk aktivitas yang terkait dengan perancang.

public:
 virtual bool CanBeParentedTo(System::Workflow::ComponentModel::Design::CompositeActivityDesigner ^ parentActivityDesigner);
public virtual bool CanBeParentedTo (System.Workflow.ComponentModel.Design.CompositeActivityDesigner parentActivityDesigner);
abstract member CanBeParentedTo : System.Workflow.ComponentModel.Design.CompositeActivityDesigner -> bool
override this.CanBeParentedTo : System.Workflow.ComponentModel.Design.CompositeActivityDesigner -> bool
Public Overridable Function CanBeParentedTo (parentActivityDesigner As CompositeActivityDesigner) As Boolean

Parameter

parentActivityDesigner
CompositeActivityDesigner

CompositeActivityDesigner yang berpotensi ditetapkan sebagai induk.

Mengembalikan

trueCompositeActivity jika dapat ditetapkan sebagai induk aktivitas yang terkait dengan perancang; jika tidak, false.

Contoh

Contoh berikut menunjukkan cara memastikan bahwa aktivitas kustom diindukkan ke jenis aktivitas tertentu. Dalam hal ini, aktivitas kustom hanya dapat diindukkan ke ParallelIfActivity.

public override bool CanBeParentedTo(CompositeActivityDesigner parentActivityDesigner)
{
    if (null == parentActivityDesigner)
        throw new ArgumentNullException("parentActivityDesigner");

    if (!(parentActivityDesigner.Activity is ParallelIfActivity))
        return false;
    else
        return base.CanBeParentedTo(parentActivityDesigner);
}
Public Overrides Function CanBeParentedTo(ByVal parentActivityDesigner As CompositeActivityDesigner) As Boolean
    If parentActivityDesigner Is Nothing Then
        Throw New ArgumentNullException("parentActivityDesigner")
    End If

    If Not TypeOf parentActivityDesigner.Activity Is ParallelIfActivity Then
        Return False
    Else
        Return MyBase.CanBeParentedTo(parentActivityDesigner)
    End If
End Function

Keterangan

Metode ini berguna untuk menguji apakah perancang dapat diinduki oleh tertentu CompositeActivityDesigner.

Metode ini dipanggil ketika pengguna memulai operasi penyisipan, seperti seret dan letakkan atau tempel.

Berlaku untuk