コード例 #1
0
        /// <summary>
        /// Selects standard extended image infos (standard extended image infos always available
        /// if DeviceCapabilityId.IExtImageInfo capability is supported by device).
        /// </summary>
        private void SelectStandardExtendedImageInfos()
        {
            ExtendedImageInfoId[] standardExtendedImageInfoIds = new ExtendedImageInfoId[6] {
                ExtendedImageInfoId.DocumentNumber, ExtendedImageInfoId.PageNumber,
                ExtendedImageInfoId.Camera, ExtendedImageInfoId.FrameNumber,
                ExtendedImageInfoId.Frame, ExtendedImageInfoId.PixelFlavor
            };

            bool isStandardExtendedImageInfoFound;
            Type enumType = typeof(ExtendedImageInfoId);

            for (int i = 0; i < extendedImageInfoCheckedListBox.Items.Count; i++)
            {
                string extendedImageInfoIdAsString      = (string)extendedImageInfoCheckedListBox.Items[i];
                ExtendedImageInfoId extendedImageInfoId = (ExtendedImageInfoId)Enum.Parse(enumType, extendedImageInfoIdAsString);

                isStandardExtendedImageInfoFound = false;
                for (int j = 0; j < standardExtendedImageInfoIds.Length; j++)
                {
                    if (extendedImageInfoId == standardExtendedImageInfoIds[j])
                    {
                        isStandardExtendedImageInfoFound = true;
                        break;
                    }
                }

                extendedImageInfoCheckedListBox.SetItemChecked(i, isStandardExtendedImageInfoFound);
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds type of extended image info to the list of necessary extended image infos.
        /// </summary>
        private void AddExtendedImageInfoToRetrieveList(Device device)
        {
            device.ExtendedImageInfo.Clear();

            Type enumType = typeof(ExtendedImageInfoId);

            for (int i = 0; i < extendedImageInfoCheckedListBox.Items.Count; i++)
            {
                if (extendedImageInfoCheckedListBox.GetItemChecked(i))
                {
                    string extendedImageInfoIdAsString      = (string)extendedImageInfoCheckedListBox.Items[i];
                    ExtendedImageInfoId extendedImageInfoId = (ExtendedImageInfoId)Enum.Parse(enumType, extendedImageInfoIdAsString);

                    device.ExtendedImageInfo.Add(new ExtendedImageInfo(extendedImageInfoId));
                }
            }
        }