RawUIStateInputReport.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 / RawUIStateInputReport.cs / 1 / RawUIStateInputReport.cs

                            using System; 
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Win32; 
using System.Windows;
 
namespace System.Windows.Input 
{
    ///  
    ///     The RawUIStateInputReport class encapsulates the raw input
    ///     provided from WM_*UISTATE* messages.
    /// 
    internal class RawUIStateInputReport : InputReport 
    {
         ///  
        ///     Constructs an instance of the RawUIStateInputReport class. 
        /// 
        ///  
        ///     The input source that provided this input.
        /// 
        /// 
        ///     The mode in which the input is being provided. 
        /// 
        ///  
        ///     The time when the input occured. 
        /// 
        ///  
        ///     The action being reported.
        /// 
        /// 
        ///     The targets being reported. 
        /// 
        ///  
        ///     Critical:This handles critical data in the form of PresentationSource 
        ///     TreatAsSafe:The data has demands on the property when someone tries to access it.
        ///  
        [SecurityCritical,SecurityTreatAsSafe]
        public RawUIStateInputReport(
            PresentationSource inputSource,
            InputMode mode, 
            int timestamp,
            RawUIStateActions action, 
            RawUIStateTargets targets) : base(inputSource, InputType.Keyboard, mode, timestamp) 
        {
            if (!IsValidRawUIStateAction(action)) 
                throw new System.ComponentModel.InvalidEnumArgumentException("action", (int)action, typeof(RawUIStateActions));
            if (!IsValidRawUIStateTargets(targets))
                throw new System.ComponentModel.InvalidEnumArgumentException("targets", (int)targets, typeof(RawUIStateTargets));
 
            _action = action;
            _targets = targets; 
        } 

        ///  
        ///     Read-only access to the action that was reported.
        /// 
        public RawUIStateActions Action {get {return _action;}}
 
        /// 
        ///     Read-only access to the targets that were reported. 
        ///  
        public RawUIStateTargets Targets {get {return _targets;}}
 
        // IsValid Method for RawUIStateActions.
        internal static bool IsValidRawUIStateAction(RawUIStateActions action)
        {
            return (action == RawUIStateActions.Set || 
                    action == RawUIStateActions.Clear ||
                    action == RawUIStateActions.Initialize); 
        } 

        // IsValid Method for RawUIStateTargets. Relies on the enum being [Flags]. 
        internal static bool IsValidRawUIStateTargets(RawUIStateTargets targets)
        {
            return ((targets & (RawUIStateTargets.HideFocus |
                                RawUIStateTargets.HideAccelerators | 
                                RawUIStateTargets.Active))
                    == targets); 
        } 

        private RawUIStateActions _action; 
        private RawUIStateTargets _targets;
    }
}

// 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