예제 #1
0
        public override string ToString()
        {
            //Split the text at each new line.
            if (ListText != null)
            {
                var lines = ListText.Split('\n');

                // Remove lines with whitespace.
                var linesWithInput = lines.Where(lineContent => !String.IsNullOrWhiteSpace(lineContent)).ToList();

                // Generate the list.
                StringBuilder stringBuilder = new StringBuilder();

                if (Numbered)
                {
                    for (int i = 0; i < linesWithInput.Count(); i++)
                    {
                        stringBuilder.AppendLine($"{i + 1}. {linesWithInput[i]}");
                    }
                }
                else
                {
                    foreach (var line in linesWithInput)
                    {
                        stringBuilder.AppendLine($"• {line}");
                    }
                }

                return(stringBuilder.ToString());
            }

            return(String.Empty);
        }
예제 #2
0
        protected void ProcessArrowKey(Keys key, bool rotate)
        {
            PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue);

            object[] displayStrings = unitValue.GetDisplayedValues();
            int      index          = -1;

            if (unitValue.HasMultipleValues)
            {
                if (key == Keys.Up)
                {
                    index = displayStrings.Length - 1;
                }
                else if (key == Keys.Down)
                {
                    index = 0;
                }
            }
            else
            {
                for (int i = 0; i < displayStrings.Length; i++)
                {
                    if (ListText.Equals(displayStrings[i]))
                    {
                        if ((key == Keys.Up) && (i > 0))
                        {
                            index = i - 1;
                        }
                        else if ((key == Keys.Up) && rotate)
                        {
                            index = displayStrings.Length - 1;
                        }
                        else if ((key == Keys.Down) && (i < displayStrings.Length - 1))
                        {
                            index = i + 1;
                        }
                        else if ((key == Keys.Down) && rotate)
                        {
                            index = 0;
                        }

                        break;
                    }
                }
            }

            if (index != -1)
            {
                ListText = displayStrings[index].ToString();

                if (RealtimeChange)
                {
                    CommitListChanges();
                }
            }
        }
예제 #3
0
        private void GuessListName(object listdata)
        {
            ListData ld = (ListData)listdata;

            try
            {
                if (Same(GetPageResource(ld.SourceUrl + "and exists (select * from [" + ld.ListName + "])").Length, ld.HtmlText.Length))
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { ListText.AppendText(ld.ListName + "\r\n"); Field.IsEnabled = true; }));
                }
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { progressBar.Value += 1; }));
            }
            catch { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { progressBar.Value += 1; })); }
            return;
        }
예제 #4
0
        public void CommitListChanges()
        {
            PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue);
            string        oldValue  = unitValue.DisplayString;

            if (ListText.Equals(oldValue) == false)
            {
                unitValue.PreviousValue = unitValue.GetValue();
                unitValue.SetValueFromInPlaceCtrl(ListText);

                if (unitValue.DisplayString != oldValue)
                {
                    _ownerPropertyEnum.Property.ParentGrid.NotifyPropertyChanged(
                        new PropertyChangedEventArgs(_ownerPropertyEnum, unitValue.AdditionalValueKey));
                }
            }
        }