JobInputBins.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 / Print / Reach / PrintConfig / JobInputBins.cs / 1 / JobInputBins.cs

                            /*++ 

Copyright (C) 2005 Microsoft Corporation
All rights reserved.
 
Module Name:
 
    JobInputBins.cs 

Abstract: 

    Definition and implementation of this public feature/parameter related types.

Author: 

    [....] ([....]) 6/10/2005 
 
--*/
 
using System;
using System.IO;
using System.Xml;
using System.Collections; 
using System.Collections.ObjectModel;
using System.Collections.Generic; 
using System.Diagnostics; 
using System.Globalization;
 
using System.Printing;
using MS.Internal.Printing.Configuration;

namespace MS.Internal.Printing.Configuration 
{
    ///  
    /// Represents an input bin option. 
    /// 
    internal class InputBinOption: PrintCapabilityOption 
    {
        #region Constructors

        internal InputBinOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature) 
        {
            _value = 0; 
        } 

        #endregion Constructors 

        #region Public Properties

        ///  
        /// Gets the input bin's value.
        ///  
        public InputBin Value 
        {
            get 
            {
                return _value;
            }
        } 

        #endregion Public Properties 
 
        #region Public Methods
 
        /// 
        /// Converts the input bin to human-readable string.
        /// 
        /// A string that represents this input bin. 
        public override string ToString()
        { 
            return Value.ToString(); 
        }
 
        #endregion Public Methods

        #region Internal Fields
 
        internal InputBin _value;
 
        #endregion Internal Fields 
    }
 
    /// 
    /// Represents input bin capability.
    /// 
    abstract internal class InputBinCapability : PrintCapabilityFeature 
    {
        #region Constructors 
 
        internal InputBinCapability(InternalPrintCapabilities ownerPrintCap)
            : base(ownerPrintCap) 
        {
        }

        #endregion Constructors 

        #region Public Properties 
 
        /// 
        /// Gets the collection object that represents input bins supported by the device. 
        /// 
        public Collection InputBins
        {
            get 
            {
                return _inputBins; 
            } 
        }
 
        #endregion Public Properties

        #region Internal Methods
 
        internal override sealed bool AddOptionCallback(PrintCapabilityOption baseOption)
        { 
            bool added = false; 

            InputBinOption option = baseOption as InputBinOption; 

            // Validate the option is complete before adding it to the collection
            if (option._optionName != null)
            { 
                int enumValue = PrintSchemaMapper.SchemaNameToEnumValueWithArray(
                                    PrintSchemaTags.Keywords.InputBinKeys.InputBinNames, 
                                    PrintSchemaTags.Keywords.InputBinKeys.InputBinEnums, 
                                    option._optionName);
 
                if (enumValue > 0)
                {
                    // We require the InputBin option to have an option name
                    option._value = (InputBin)enumValue; 
                    this.InputBins.Add(option);
                    added = true; 
                } 
            }
 
            return added;
        }

        internal override sealed void AddSubFeatureCallback(PrintCapabilityFeature subFeature) 
        {
            // no sub-feature 
        } 

        internal override sealed bool FeaturePropCallback(PrintCapabilityFeature feature, XmlPrintCapReader reader) 
        {
            // no feature property to handle
            return false;
        } 

        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature) 
        { 
            InputBinOption option = new InputBinOption(baseFeature);
 
            return option;
        }

        internal override sealed void OptionAttrCallback(PrintCapabilityOption baseOption, XmlPrintCapReader reader) 
        {
            // no option attribute to handle 
            return; 
        }
 
        /// XML is not well-formed.
        internal override sealed bool OptionPropCallback(PrintCapabilityOption baseOption, XmlPrintCapReader reader)
        {
            // no option property to handle 
            return false;
        } 
 
        #endregion Internal Methods
 
        #region Internal Properties

        internal override sealed bool IsValid
        { 
            get
            { 
                return (this.InputBins.Count > 0); 
            }
        } 

        internal abstract override string FeatureName
        {
            get; 
        }
 
        internal override sealed bool HasSubFeature 
        {
            get 
            {
                return false;
            }
        } 

        #endregion Internal Properties 
 
        #region Internal Fields
 
        internal Collection _inputBins;

        #endregion Internal Fields
    } 

    ///  
    /// Represents job input bin capability. 
    /// 
    internal class JobInputBinCapability : InputBinCapability 
    {
        #region Constructors

        internal JobInputBinCapability(InternalPrintCapabilities ownerPrintCap) 
            : base(ownerPrintCap)
        { 
        } 

        #endregion Constructors 

        #region Internal Methods

        internal static PrintCapabilityFeature NewFeatureCallback(InternalPrintCapabilities printCap) 
        {
            JobInputBinCapability cap = new JobInputBinCapability(printCap); 
            cap._inputBins = new Collection(); 

            return cap; 
        }

        #endregion Internal Methods
 
        #region Internal Properties
 
        internal override sealed string FeatureName 
        {
            get 
            {
                return PrintSchemaTags.Keywords.InputBinKeys.JobInputBin;
            }
        } 

        #endregion Internal Properties 
    } 

    ///  
    /// Represents document input bin capability.
    /// 
    internal class DocumentInputBinCapability : InputBinCapability
    { 
        #region Constructors
 
        internal DocumentInputBinCapability(InternalPrintCapabilities ownerPrintCap) 
            : base(ownerPrintCap)
        { 
        }

        #endregion Constructors
 
        #region Internal Methods
 
        internal static PrintCapabilityFeature NewFeatureCallback(InternalPrintCapabilities printCap) 
        {
            DocumentInputBinCapability cap = new DocumentInputBinCapability(printCap); 
            cap._inputBins = new Collection();

            return cap;
        } 

        #endregion Internal Methods 
 
        #region Internal Properties
 
        internal override sealed string FeatureName
        {
            get
            { 
                return PrintSchemaTags.Keywords.InputBinKeys.DocumentInputBin;
            } 
        } 

        #endregion Internal Properties 
    }

    /// 
    /// Represents page input bin capability. 
    /// 
    internal class PageInputBinCapability : InputBinCapability 
    { 
        #region Constructors
 
        internal PageInputBinCapability(InternalPrintCapabilities ownerPrintCap)
            : base(ownerPrintCap)
        {
        } 

        #endregion Constructors 
 
        #region Internal Methods
 
        internal static PrintCapabilityFeature NewFeatureCallback(InternalPrintCapabilities printCap)
        {
            PageInputBinCapability cap = new PageInputBinCapability(printCap);
            cap._inputBins = new Collection(); 

            return cap; 
        } 

        #endregion Internal Methods 

        #region Internal Properties

        internal override sealed string FeatureName 
        {
            get 
            { 
                return PrintSchemaTags.Keywords.InputBinKeys.PageInputBin;
            } 
        }

        #endregion Internal Properties
    } 

 
    ///  
    /// Represents input bin setting.
    ///  
    abstract internal class InputBinSetting : PrintTicketFeature
    {
        #region Constructors
 
        /// 
        /// Constructs a new input bin setting object. 
        ///  
        internal InputBinSetting(InternalPrintTicket ownerPrintTicket, string featureName)
            : base(ownerPrintTicket) 
        {
            this._featureName = featureName;

            this._propertyMaps = new PTPropertyMapEntry[] { 
                new PTPropertyMapEntry(this,
                                       PrintSchemaTags.Framework.OptionNameProperty, 
                                       PTPropValueTypes.EnumStringValue, 
                                       PrintSchemaTags.Keywords.InputBinKeys.InputBinNames,
                                       PrintSchemaTags.Keywords.InputBinKeys.InputBinEnums), 
                };
        }

        #endregion Constructors 

        #region Public Properties 
 
        /// 
        /// Gets or sets the input bin setting's value. 
        /// 
        /// 
        /// If the setting is not specified yet, getter will return 0.
        ///  
        /// 
        /// The value to set is not one of the standard . 
        ///  
        public InputBin Value
        { 
            get
            {
                return (InputBin)this[PrintSchemaTags.Framework.OptionNameProperty];
            } 
            set
            { 
                if (value < PrintSchema.InputBinEnumMin || 
                    value > PrintSchema.InputBinEnumMax)
                { 
                    throw new ArgumentOutOfRangeException("value");
                }

                this[PrintSchemaTags.Framework.OptionNameProperty] = (int)value; 
            }
        } 
 
        #endregion Public Properties
 
        #region Public Methods

        /// 
        /// Converts the input bin setting to human-readable string. 
        /// 
        /// A string that represents this input bin setting. 
        public override string ToString() 
        {
            return Value.ToString(); 
        }

        #endregion Public Methods
    } 

    ///  
    /// Represents job input bin setting. 
    /// 
    internal class JobInputBinSetting : InputBinSetting 
    {
        #region Constructors

        internal JobInputBinSetting(InternalPrintTicket ownerPrintTicket) 
            : base(ownerPrintTicket, PrintSchemaTags.Keywords.InputBinKeys.JobInputBin)
        { 
        } 

        #endregion Constructors 
    }

    /// 
    /// Represents document input bin setting. 
    /// 
    internal class DocumentInputBinSetting : InputBinSetting 
    { 
        #region Constructors
 
        internal DocumentInputBinSetting(InternalPrintTicket ownerPrintTicket)
            : base(ownerPrintTicket, PrintSchemaTags.Keywords.InputBinKeys.DocumentInputBin)
        {
        } 

        #endregion Constructors 
    } 
    /// 
    /// Represents page input bin setting. 
    /// 
    internal class PageInputBinSetting : InputBinSetting
    {
        #region Constructors 

        internal PageInputBinSetting(InternalPrintTicket ownerPrintTicket) 
            : base(ownerPrintTicket, PrintSchemaTags.Keywords.InputBinKeys.PageInputBin) 
        {
        } 

        #endregion Constructors
    }
} 

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