Ejemplo n.º 1
0
 public BlankConfig Get(BlankType blankType, SheetType sheetType)
 {
     return
         (BlankConfig) BaseGet(GetKey(blankType, sheetType))
         ??
         (BlankConfig) BaseGet(GetKey(blankType, SheetType.Undefined));
 }
Ejemplo n.º 2
0
 public BlankConfig Get(BlankType blankType, SheetType sheetType)
 {
     return
         ((BlankConfig)BaseGet(GetKey(blankType, sheetType))
          ??
          (BlankConfig)BaseGet(GetKey(blankType, SheetType.Undefined)));
 }
Ejemplo n.º 3
0
        protected virtual void OnConverting(BlankType targetType)
        {
            var h = Converting;

            if (h != null)
            {
                h(this, new BlankTypeEventArgs(targetType));
            }
        }
Ejemplo n.º 4
0
 public VoteKey(BlankType? type, 
     VotingMode? mode, 
     int? scannerSerial, 
     string candidate, 
     string election, 
     string blankId)
 {
     BlankType = type;
     VotingMode = mode;
     ScannerSerialNumber = scannerSerial;
     CandidateId = candidate;
     ElectionNum = election;
     BlankId = blankId;
 }
Ejemplo n.º 5
0
 public VotingResult( 
     BlankType blankType, 
     int bulletinNumber, 
     string stampNumber, 
     string badBulletinReason, 
     string badStampReason, 
     int[][] sectionsMarks, 
     bool[] sectionsValidity)
 {
     BlankType = blankType;
     BulletinNumber = bulletinNumber;
     StampNumber = stampNumber;
     BadBulletinReason = badBulletinReason;
     BadStampReason = badStampReason;
     SectionsMarks = sectionsMarks;
     SectionsValidity = sectionsValidity;
 }
Ejemplo n.º 6
0
 public VotingResult(
     BlankType blankType,
     int bulletinNumber,
     string stampNumber,
     string badBulletinReason,
     string badStampReason,
     int[][] sectionsMarks,
     bool[] sectionsValidity)
 {
     BlankType         = blankType;
     BulletinNumber    = bulletinNumber;
     StampNumber       = stampNumber;
     BadBulletinReason = badBulletinReason;
     BadStampReason    = badStampReason;
     SectionsMarks     = sectionsMarks;
     SectionsValidity  = sectionsValidity;
 }
Ejemplo n.º 7
0
        public void AddFromEditor(BlankType type)
        {
            switch (type)
            {
            case BlankType.Measure:
                OpenMeasureEditor(null, null, (m) =>
                {
                    AddTag(m);
                });
                break;

            case BlankType.Icd:
                OpenIcdSelector(null, null, (i) =>
                {
                    AddTag(i);
                });
                break;

            default:
                AddLastTag();
                break;
            }
            StartEdit();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This function blanks a portion of the CD or DVD that is in the drive.
        /// </summary>
        /// <param name="immd"></param>If true, this function returns immediately and the blanking
        /// happens in the backgroun.  If false, this funtion does not return until the blanking operation
        /// is complete
        /// <param name="t"></param>The type of blanking operation
        /// <param name="addr"></param>The address for the blanking operation if an address is required
        /// <returns>
        /// Success - the command complete sucessfully
        /// IoctlFailed - the windows DeviceIoControl failed, LastError give the Win32 error code
        /// DeviceFailed - the device failed the command, the sense information has more data
        /// </returns>
        public CommandStatus Blank(bool immd, BlankType t, int addr)
        {
            if (m_logger != null)
            {
                string args = immd.ToString() + ", " + t.ToString() + ", " + addr.ToString();
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.Blank(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.Blank, 12, 0, Command.CmdDirection.None, 60*30))
            {
                byte b = (byte)t;
                if (immd)
                    b |= (1 << 4);
                cmd.SetCDB8(1, b);

                cmd.SetCDB32(2, addr);
                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }

            return CommandStatus.Success;
        }
Ejemplo n.º 9
0
 public Blank(BlankType b, byte n)
     : base(n)
 {
     _blank = b;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Изменяет сущность тега с одной на другую.
        /// Может быть создан пустой коммент/слово, которые не должны сохраняться.
        /// </summary>
        public void ConvertBlank(TagViewModel tag, BlankType toType, Action onConverted)
        {
            if (tag.BlankType == toType)
            {
                throw new ArgumentException();
            }
            if (toType == BlankType.None)
            {
                throw new ArgumentException();
            }
            if (onConverted == null)
            {
                throw new ArgumentException();
            }
            Contract.Ensures(tag.BlankType == toType || tag.BlankType == Contract.OldValue(tag.BlankType)); // можно отменить to icd/measure
            Contract.EndContractBlock();

            string queryOrMeasureWordTitle;

            if (tag.BlankType == BlankType.Measure)
            {
                var w = (tag.Blank as Measure).Word;
                Contract.Assume(w != null); // измерение без слова в теге не бывает
                queryOrMeasureWordTitle = w.Title;
            }
            else
            {
                queryOrMeasureWordTitle = tag.Query; // == "" if initial or after clear query
            }
            Contract.Assume(queryOrMeasureWordTitle != null);

            switch (toType)
            {
            case BlankType.Comment:
                Contract.Assume(tag.Query != null);
                tag.Blank = new Comment(tag.Query);
                onConverted();
                break;

            case BlankType.Word:
                tag.Blank = FirstMatchingOrNewWord(queryOrMeasureWordTitle);
                onConverted();
                break;

            case BlankType.Measure:     // слово
                Word w = null;
                if (!queryOrMeasureWordTitle.IsNullOrEmpty())
                {
                    w = FirstMatchingOrNewWord(queryOrMeasureWordTitle);
                }
                OpenMeasureEditor(null, w, (m) =>
                {
                    tag.Blank = m;
                    onConverted();
                });
                break;

            case BlankType.Icd:     // слово/коммент в поисковый запрос
                OpenIcdSelector(null, queryOrMeasureWordTitle, (i) =>
                {
                    tag.Blank = i;
                    onConverted();
                });
                break;
            }
        }
Ejemplo n.º 11
0
 private static object GetKey(BlankType blankType, SheetType sheetType)
 {
     return ((int)blankType) * 1000 + (int)sheetType;
 }
Ejemplo n.º 12
0
 public void SetBlankMarking(BlankType blankType, BlankMarking marking)
 {
     var blankConfig = _config.Blanks.Get(blankType, SheetType.Normal);
     if (blankConfig == null)
         return;
     var oldValue = blankConfig.Marking;
     blankConfig.Marking = marking;
     RaiseConfigUpdatedEvent(
         new ConfigUpdatedEventArgs(Name, blankType + "BlankMarking", oldValue, marking));
 }
Ejemplo n.º 13
0
 public BlankConfig Get(BlankType blankType)
 {
     return(Get(blankType, SheetType.Undefined));
 }
Ejemplo n.º 14
0
 public virtual Signalizations Validate(BlankType tagBt)
 {
     return(Signalizations.None);
 }
Ejemplo n.º 15
0
 public override Signalizations Validate(BlankType tagBt)
 {
     return(!convertTo.Contains(tagBt)
         ? Signalizations.Forbidden
         : Signalizations.None);
 }
Ejemplo n.º 16
0
 public bool WithConvertTo(BlankType type)
 {
     return(convertTo.Contains(type));
 }
Ejemplo n.º 17
0
 private static object GetKey(BlankType blankType, SheetType sheetType)
 {
     return(((int)blankType) * 1000 + (int)sheetType);
 }
Ejemplo n.º 18
0
 public BlankTypeEventArgs(BlankType type)
 {
     this.type = type;
 }
Ejemplo n.º 19
0
 public BlankConfig Get(BlankType blankType)
 {
     return Get(blankType, SheetType.Undefined);
 }
Ejemplo n.º 20
0
 public BlankMarking GetBlankMarking(BlankType blankType)
 {
     var blankConfig = _config.Blanks.Get(blankType, SheetType.Normal);
     return blankConfig != null
                ? blankConfig.Marking
                : BlankMarking.DropWithoutMark;
 }