예제 #1
0
        private DMSInfo GetPreviousDMSInfo(int previousSelectionStart)
        {
            DMSInfo info = this.GetDMSInfo(previousSelectionStart);

            if (info == null)
            {
                info = _dmsInfoList.LastOrDefault(o => o.Type != DMSPart.Separator);
            }
            return(info);
        }
예제 #2
0
 internal void Select(DMSInfo info)
 {
     if (info != null)
     {
         _fireSelectionChangedEvent = false;
         this.Select(info.StartPosition, info.Length);
         _fireSelectionChangedEvent = true;
         _selectedDMSInfo           = info;
     }
 }
예제 #3
0
        private DMSInfo GetNextDMSInfo(int nextSelectionStart)
        {
            DMSInfo info = this.GetDMSInfo(nextSelectionStart);

            if (info == null)
            {
                info = _dmsInfoList.FirstOrDefault(o => o.Type != DMSPart.Separator);
            }
            return(info);
        }
예제 #4
0
        internal DMSInfo GetDMSInfo(int selectionStart)
        {
            DMSInfo result = null;

            while (result == null)
            {
                result          = _dmsInfoList.FirstOrDefault(info => info.Type != DMSPart.Separator && (info.StartPosition <= selectionStart) && (selectionStart < (info.StartPosition + info.Length)));
                selectionStart += 1;
                if (selectionStart >= this.Text.Length)
                {
                    result = _dmsInfoList.LastOrDefault(o => o.Type != DMSPart.Separator);
                    break;
                }
                if (selectionStart <= 0)
                {
                    result = _dmsInfoList.FirstOrDefault(o => o.Type != DMSPart.Separator);
                    break;
                }
            }
            return(result);
        }
예제 #5
0
        protected void InitializeDMSInfoList()
        {
            _dmsInfoList.Clear();
            _selectedDMSInfo = null;
            string strValue     = this.StrValue;
            string interValue   = "0";
            string decimalValue = "0000000";

            string[] splitStr = strValue.Split('.');
            if (splitStr.Length == 2)
            {
                interValue   = splitStr[0];
                decimalValue = splitStr[1];
            }
            int index = 0;

            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = interValue.Length,
                Content       = interValue,
                Type          = DMSPart.Degree
            });
            index += interValue.Length;
            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = 1,
                Content       = "°",
                Type          = DMSPart.Separator
            });
            index += 1;
            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = 2,
                Content       = decimalValue.Substring(0, 2),
                Type          = DMSPart.Minute
            });
            index += 2;
            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = 1,
                Content       = "'",
                Type          = DMSPart.Separator
            });
            index += 1;
            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = 6,
                Content       = decimalValue.Substring(2, 5).Insert(2, "."),
                Type          = DMSPart.Second
            });
            index += 6;
            _dmsInfoList.Add(new DMSInfo()
            {
                StartPosition = index,
                Length        = 1,
                Content       = "\"",
                Type          = DMSPart.Separator
            });
            index += 1;

            SetDMSText();
        }