SecureUICommand.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Command / SecureUICommand.cs / 3 / SecureUICommand.cs

                            //---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// 
// Description: The Command class is used by the developer to define the intent of the User Action 
//              This also serves the purpose of identifying commands or to compare identities of
//              InputBindings and CommandBindings 
//
//              See New spec at : (need link)
//
// History: 
//      01/26/2005 : [....] - Created
//--------------------------------------------------------------------------- 
 
using System;
using System.Security; 
using System.Security.Permissions;
using System.Windows;
using System.ComponentModel;
using System.Collections; 
using System.Windows.Input;
 
namespace System.Windows.Input 
{
    ///  
    /// Command
    /// 
    [TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=" + Microsoft.Internal.BuildInfo.WCP_VERSION + ", Culture=neutral, PublicKeyToken=" + Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_TOKEN + ", Custom=null")]
    internal class SecureUICommand : RoutedUICommand, ISecureCommand 
    {
        ///  
        /// Critical - should only be write-once in the constructor 
        /// 
        [SecurityCritical] 
        readonly PermissionSet _userInitiated;

        /// 
        /// Creates a new secure command, requiring the specified permissions. Used to delay initialization of Text and InputGestureCollection to time of first use. 
        /// 
        /// PermissionSet to associate with this command 
        /// Name of the Command Property/Field for Serialization 
        /// Type that is registering the property
        /// Idenfier assigned by the owning type. 
        /// 
        ///     Critical -    assigns to the permission set, a protected resource
        ///     TreatAsSafe - KeyBinding (through InputBinding) will demand this permission before
        ///                   binding this command to any key. 
        /// 
        [SecurityCritical, SecurityTreatAsSafe] 
        internal SecureUICommand(PermissionSet userInitiated, string name, Type ownerType, byte commandId) 
            : base(name, ownerType, commandId)
        { 
            _userInitiated = userInitiated;
        }

 
        /// 
        /// Permission required to modify bindings for this 
        /// command, and the permission to assert when 
        /// the command is invoked in a user interactive
        /// (trusted) fashion. 
        /// 
        /// 
        /// Critical - access the permission set, a protected resource
        /// TreatAsSafe - get only access is safe 
        /// 
        public PermissionSet UserInitiatedPermission 
        { 
            [SecurityCritical, SecurityTreatAsSafe]
            get 
            {
                return _userInitiated;
            }
        } 
    }
 } 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK