Source/Editors/DateTimeAdv/MonthNameInput.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

#if FRAMEWORK20
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.ComponentModel;

namespace DevComponents.Editors.DateTimeAdv
{
    public class MonthNameInput : VisualStringListInput, IDateTimePartInput
    {
        #region Private Variables
        private List<string> _Months = null;
        private int _MinValue = 1;
        private int _MaxValue = 12;
        #endregion

        #region Events
        #endregion

        #region Constructor
        #endregion

        #region Internal Implementation
        protected override List<string> GetItems()
        {
            if (this.Items.Count != 12)
            {
                if (_Months == null)
                {
                    _Months = new List<string>(12);
                    if (_UseAbbreviatedNames)
                        _Months.AddRange(DateTimeInput.GetActiveCulture().DateTimeFormat.AbbreviatedMonthNames);
                    else
                        _Months.AddRange(DateTimeInput.GetActiveCulture().DateTimeFormat.MonthNames);
                    if (_Months.Count == 13 && _Months[12] == "") _Months.RemoveAt(12);
                }
                return _Months;
            }
            return base.GetItems();
        }

        protected override bool ValidateNewInputStack(string s)
        {
            if (s.Length > 0)
            {
                // Parse also numeric input and map it to the month name
                int month = 0;
                int.TryParse(s, out month);
                if (month > 0 && month >= _MinValue && month <= _MaxValue)
                {
                    List<string> items = GetItems();
                    this.LastMatch = items[month - 1];
                    this.LastValidatedInputStack = s;
                    if (month > 1)
                        this.LastMatchComplete = true;
                    return true;
                }
            }

后面还有 90 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。