編輯

共用方式為


UIPermission Constructors

Definition

Initializes a new instance of the UIPermission class.

Overloads

UIPermission(PermissionState)

Initializes a new instance of the UIPermission class with either fully restricted or unrestricted access, as specified.

UIPermission(UIPermissionClipboard)

Initializes a new instance of the UIPermission class with the permissions for the Clipboard, and no access to windows.

UIPermission(UIPermissionWindow)

Initializes a new instance of the UIPermission class with the permissions for windows, and no access to the Clipboard.

UIPermission(UIPermissionWindow, UIPermissionClipboard)

Initializes a new instance of the UIPermission class with the specified permissions for windows and the Clipboard.

UIPermission(PermissionState)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with either fully restricted or unrestricted access, as specified.

public:
 UIPermission(System::Security::Permissions::PermissionState state);
public UIPermission (System.Security.Permissions.PermissionState state);
new System.Security.Permissions.UIPermission : System.Security.Permissions.PermissionState -> System.Security.Permissions.UIPermission
Public Sub New (state As PermissionState)

Parameters

state
PermissionState

One of the enumeration values.

Exceptions

The state parameter is not a valid PermissionState.

Examples

The following code example shows the use of the UIPermission constructor. This example is part of a larger example provided for the UIPermission class.

UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None);
UIPermission uiPerm2 = new UIPermission(PermissionState.None);
Dim uiPerm2 As New UIPermission(PermissionState.None)

Remarks

This constructor creates either the fully restricted (None) or the Unrestricted form of the permission.

Applies to

UIPermission(UIPermissionClipboard)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the permissions for the Clipboard, and no access to windows.

public:
 UIPermission(System::Security::Permissions::UIPermissionClipboard clipboardFlag);
public UIPermission (System.Security.Permissions.UIPermissionClipboard clipboardFlag);
new System.Security.Permissions.UIPermission : System.Security.Permissions.UIPermissionClipboard -> System.Security.Permissions.UIPermission
Public Sub New (clipboardFlag As UIPermissionClipboard)

Parameters

clipboardFlag
UIPermissionClipboard

One of the enumeration values.

Exceptions

The clipboardFlag parameter is not a valid UIPermissionClipboard value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionClipboard) constructor. This example is part of a larger example provided for the UIPermission class.

uiPerm1 = gcnew UIPermission(UIPermissionClipboard::AllClipboard);
uiPerm1 = new UIPermission(UIPermissionClipboard.AllClipboard);
uiPerm1 = New UIPermission(UIPermissionClipboard.AllClipboard)

Remarks

To set both the Clipboard and window permissions, use the constructor that takes parameters for both.

Applies to

UIPermission(UIPermissionWindow)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the permissions for windows, and no access to the Clipboard.

public:
 UIPermission(System::Security::Permissions::UIPermissionWindow windowFlag);
public UIPermission (System.Security.Permissions.UIPermissionWindow windowFlag);
new System.Security.Permissions.UIPermission : System.Security.Permissions.UIPermissionWindow -> System.Security.Permissions.UIPermission
Public Sub New (windowFlag As UIPermissionWindow)

Parameters

windowFlag
UIPermissionWindow

One of the enumeration values.

Exceptions

The windowFlag parameter is not a valid UIPermissionWindow value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionWindow) constructor. This example is part of a larger example provided for the UIPermission class.

UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows);
UIPermission uiPerm1 = new UIPermission(UIPermissionWindow.SafeTopLevelWindows);
Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows)

Remarks

To set both the Clipboard and window permissions, use the constructor that takes parameters for both.

Applies to

UIPermission(UIPermissionWindow, UIPermissionClipboard)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the specified permissions for windows and the Clipboard.

public:
 UIPermission(System::Security::Permissions::UIPermissionWindow windowFlag, System::Security::Permissions::UIPermissionClipboard clipboardFlag);
public UIPermission (System.Security.Permissions.UIPermissionWindow windowFlag, System.Security.Permissions.UIPermissionClipboard clipboardFlag);
new System.Security.Permissions.UIPermission : System.Security.Permissions.UIPermissionWindow * System.Security.Permissions.UIPermissionClipboard -> System.Security.Permissions.UIPermission
Public Sub New (windowFlag As UIPermissionWindow, clipboardFlag As UIPermissionClipboard)

Parameters

windowFlag
UIPermissionWindow

One of the enumeration values.

clipboardFlag
UIPermissionClipboard

One of the enumeration values.

Exceptions

The windowFlag parameter is not a valid UIPermissionWindow value.

-or-

The clipboardFlag parameter is not a valid UIPermissionClipboard value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionWindow, UIPermissionClipboard) constructor. This example is part of a larger example provided for the UIPermission class.

UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows,UIPermissionClipboard::OwnClipboard);
UIPermission uiPerm1 = new UIPermission(UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard);
Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard)

Applies to