예제 #1
0
 protected override void PrintContent()
 {
     Console.CursorLeft = Indent;
     InputSplash.Write(DisplayFormat(PreviewValue));
     Console.CursorTop += 2;
     Console.CursorLeft = Indent;
     Range.DrawBar(SlideWidth, SlideValueWidth, SlideSymbols, SlideSplash, SlideBackgroundSplash);
     Console.CursorTop += 2;
     Console.CursorLeft = Indent;
 }
예제 #2
0
        public override IInputTool Activate()
        {
            PreActivateTrigger(Value);
            var input = ValueAsString;
            T   selected;

            while (true)
            {
                PrintAll();
                Console.CursorLeft = Indent;
                Console.CursorTop  = ContentCursorTop;
                InputSplash.Act(() =>
                {
                    try
                    {
                        System.Windows.Forms.SendKeys.SendWait(input);
                    }
                    catch
                    {
                        foreach (var c in input)
                        {
                            try { System.Windows.Forms.SendKeys.SendWait(c.ToString()); }
                            catch { /***** swollow everything! *****/ }
                        }
                    }
                    input = Console.ReadLine();
                });
                try
                {
                    selected = Converter(input);
                    if (Predicate(selected))
                    {
                        break;
                    }
                }
                catch { /*empty*/ }
                HasError = true;
            }
            Value    = Converter(input);
            HasError = false;
            PostActivateTrigger(Value);
            return(this);
        }