Clipboard Property
Collapse the table of content
Expand the table of content

UIPermission.Clipboard Property

Gets or sets the clipboard access represented by the permission.

Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)

public UIPermissionClipboard Clipboard { get; set; }
/** @property */
public UIPermissionClipboard get_Clipboard ()

/** @property */
public void set_Clipboard (UIPermissionClipboard value)

public function get Clipboard () : UIPermissionClipboard

public function set Clipboard (value : UIPermissionClipboard)

Property Value

One of the UIPermissionClipboard values.

For the complete example, see the UIPermission class topic.

// The IsSubsetOf method determines whether the current permission is a
// subset of the specified permission. This demo uses the IsSubsetOf
// method to determine the relationship of two UIPermissionWindow
// permissions and two UIPermissionClipboard permissions.
private bool IsSubsetOfWindowAndClipboardDemo()
{
    bool returnValue = true;
    UIPermissionWindow ui1, ui2;
    UIPermissionClipboard cb1, cb2;
    UIPermission uiIdPerm1, uiIdPerm2;
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();
    uiGen1.ResetIndex();
    while (uiGen1.CreateUI( out ui1, out cb1))
    {
        uiIdPerm1 = new UIPermission(ui1, cb1);
        uiGen2.ResetIndex();
        Console.WriteLine("********************************************************\n");

        while (uiGen2.CreateUI(out ui2, out cb2))
        {
            uiIdPerm2 = new UIPermission(ui2, cb2);
            try
            {
                if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                {
                    Console.WriteLine(uiIdPerm1.Window + " and " + uiIdPerm1.Clipboard + " is a subset of " +
                        uiIdPerm2.Window + " and " + uiIdPerm2.Clipboard);
                }
                else
                {
                    Console.WriteLine(uiIdPerm1.Window + " and " + uiIdPerm1.Clipboard + " is not a subset of " +
                        uiIdPerm2.Window + " and " + uiIdPerm2.Clipboard);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown for subset :" + uiIdPerm1 + "\n" +
                    uiIdPerm2 + "\n" + e);
                returnValue = false;
            }
        }
    }
    return returnValue;
}
// Compare two UIPemissionWindow permissions.
private bool IsSubsetOfWindowDemo()
{
    bool returnValue = true;
    UIPermissionWindow ui1, ui2;
    UIPermission uiIdPerm1, uiIdPerm2;
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();
    uiGen1.ResetIndex();
    while (uiGen1.CreateUI(out ui1))
    {
        uiIdPerm1 = new UIPermission(ui1);
        uiGen2.ResetIndex();
        Console.WriteLine("********************************************************\n");

        while (uiGen2.CreateUI(out ui2))
        {
            uiIdPerm2 = new UIPermission(ui2);
            try
            {
                if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                {
                    Console.WriteLine(uiIdPerm1.Window + " is a subset of " + uiIdPerm2.Window);
                }
                else
                {
                    Console.WriteLine(uiIdPerm1.Window + " is not a subset of " + uiIdPerm2.Window);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown for subset :" + uiIdPerm1 + "\n" +
                    uiIdPerm2 + "\n" + e);
                returnValue = false;
            }
        }
    }
    return returnValue;
}
// Compare two UIPermissionClipboard permissions.
private bool IsSubsetOfClipboardDemo()
{
    bool returnValue = true;
    UIPermissionClipboard cb1, cb2;
    UIPermission uiIdPerm1, uiIdPerm2;
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();
    uiGen1.ResetIndex();
    while (uiGen1.CreateUI(out cb1))
    {
        uiIdPerm1 = new UIPermission(cb1);
        uiGen2.ResetIndex();
        Console.WriteLine("********************************************************\n");

        while (uiGen2.CreateUI(out cb2))
        {
            uiIdPerm2 = new UIPermission(cb2);
            try
            {
                if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                {
                    Console.WriteLine(uiIdPerm1.Clipboard + " is a subset of " + uiIdPerm2.Clipboard);
                }
                else
                {
                    Console.WriteLine(uiIdPerm1.Clipboard + " is not a subset of " + uiIdPerm2.Clipboard);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown for subset :" + uiIdPerm1 + "\n" +
                    uiIdPerm2 + "\n" + e);
                returnValue = false;
            }
        }
    }
    return returnValue;
}

// The IsSubsetOf method determines whether the current permission is 
// a subset of the specified permission.
// This demo uses the IsSubsetOf method to determine the relationship 
// of two UIPermissionWindow permissions and two UIPermissionClipboard 
// permissions.
private boolean IsSubsetOfWindowAndClipboardDemo()
{
    boolean returnValue = true;
    UIPermissionWindow ui1[] = new UIPermissionWindow[1];
    UIPermissionWindow ui2[] = new UIPermissionWindow[1];
    UIPermissionClipboard cb1[] = new UIPermissionClipboard[1];
    UIPermissionClipboard cb2[] = new UIPermissionClipboard[1];
    UIPermission uiIdPerm1[] = new UIPermission[1];
    UIPermission uiIdPerm2[] = new UIPermission[1];
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();

    uiGen1.ResetIndex();
    while (uiGen1.CreateUI(uiIdPerm1, ui1, cb1)) {
        if (uiIdPerm1[0] == null) {
            continue;
        }
        uiGen2.ResetIndex();
        Console.WriteLine("**************************************" 
            + "******************\n");
        while (uiGen2.CreateUI(uiIdPerm2, ui2, cb2)) {
            if (uiIdPerm2[0] == null) {
                continue;
            }
            try    {
                if (uiIdPerm1[0].IsSubsetOf(uiIdPerm2[0])) {
                    Console.WriteLine((uiIdPerm1[0].get_Window() 
                        + " and " + uiIdPerm1[0].get_Clipboard() 
                        + " is a subset of " + uiIdPerm2[0].get_Window() 
                        + " and " + uiIdPerm2[0].get_Clipboard()));
                }
                else {
                    Console.WriteLine((uiIdPerm1[0].get_Window() 
                    + " and " + uiIdPerm1[0].get_Clipboard() 
                    + " is not a subset of " + uiIdPerm2[0].get_Window() 
                    + " and " + uiIdPerm2[0].get_Clipboard()));
                }
            }
            catch (System.Exception e) {
                Console.WriteLine(("An exception was " 
                    + "thrown for subset :" 
                    + uiIdPerm1[0] + "\n" + uiIdPerm2[0] + "\n" + e));
                returnValue = false;
            }
        }
    }
    return returnValue;
} //IsSubsetOfWindowAndClipboardDemo

// Compare two UIPemissionWindow permissions.
private boolean IsSubsetOfWindowDemo()
{
    boolean returnValue = true;
    UIPermissionWindow ui1[] = new UIPermissionWindow[1];
    UIPermissionWindow ui2[] = new UIPermissionWindow[1];
    UIPermission uiIdPerm1[] = new UIPermission[1];
    UIPermission uiIdPerm2[] = new UIPermission[1];
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();

    uiGen1.ResetIndex();
    while (uiGen1.CreateUI(uiIdPerm1, ui1)) {
        if (uiIdPerm1[0] == null) {
            continue;
        }
        uiGen2.ResetIndex();
        Console.WriteLine("********************************" 
            + "************************\n");
        while (uiGen2.CreateUI(uiIdPerm2, ui2)) {
            if (uiIdPerm2[0] == null) {
                continue;
            }
            try {
                if (uiIdPerm1[0].IsSubsetOf(uiIdPerm2[0])) {
                    Console.WriteLine((uiIdPerm1[0].get_Window() 
                        + " is a subset of " + uiIdPerm2[0].get_Window()));
                }
                else {
                    Console.WriteLine((uiIdPerm1[0].get_Window() 
                        + " is not a subset of " 
                        + uiIdPerm2[0].get_Window()));
                }
            }
            catch (System.Exception e) {
                Console.WriteLine(("An exception was " 
                    + "thrown for subset :" + uiIdPerm1[0] 
                    + "\n" + uiIdPerm2[0] + "\n" + e));
                returnValue = false;
            }
        }
    }
    return returnValue;
} //IsSubsetOfWindowDemo

// Compare two UIPermissionClipboard permissions.
private boolean IsSubsetOfClipboardDemo()
{
    boolean returnValue = true;
    UIPermissionClipboard cb1[] = new UIPermissionClipboard[1];
    UIPermissionClipboard cb2[] = new UIPermissionClipboard[1];
    UIPermission uiIdPerm1[] = new UIPermission[1];
    UIPermission uiIdPerm2[] = new UIPermission[1];
    UIGenerator uiGen1 = new UIGenerator();
    UIGenerator uiGen2 = new UIGenerator();

    uiGen1.ResetIndex();
    while (uiGen1.CreateUI(uiIdPerm1, cb1)) {
        if (uiIdPerm1[0] == null) {
            continue;
        }
        uiGen2.ResetIndex();
        Console.WriteLine("********************************" 
            + "************************\n");
        while (uiGen2.CreateUI(uiIdPerm2, cb2)) {
            if (uiIdPerm2[0] == null) {
                continue;
            }
            try {
                if (uiIdPerm1[0].IsSubsetOf(uiIdPerm2[0])) {
                    Console.WriteLine((uiIdPerm1[0].get_Clipboard() 
                        + " is a subset of " 
                        + uiIdPerm2[0].get_Clipboard()));
                }
                else {
                    Console.WriteLine((uiIdPerm1[0].get_Clipboard() 
                        + " is not a subset of " 
                        + uiIdPerm2[0].get_Clipboard()));
                }
            }
            catch (System.Exception e) {
                Console.WriteLine(("An exception was thrown " 
                    + "for subset :" + uiIdPerm1[0] + "\n" 
                    + uiIdPerm2[0] + "\n" + e));
                returnValue = false;
            }
        }
    }
    return returnValue;
} //IsSubsetOfClipboardDemo

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2016 Microsoft