public void Test2() { Ask.AskQuestion Questioner = new CIFactory.NAnt.Tasks.Ask.AskQuestion(); Questioner.SetFreeTextMode(); Questioner.StateQuestion(string.Format("{0}{1}{0}", "I really have a lot to say.", Environment.NewLine)); Questioner.ShowDialog(); string Answer = Questioner.GetAnswer(); Console.WriteLine(Answer); }
protected override void ExecuteTask() { string Answer = string.Empty; if (this.ShowDialog) { if (this.DialogMode == Mode.Options) { Ask.AskQuestion Questioner = new CIFactory.NAnt.Tasks.Ask.AskQuestion(); int OptionCount = 0; foreach (String Choice in this.Options) { ++OptionCount; if (OptionCount > 6) { break; } Questioner.AddChoice(Choice); } Questioner.StateQuestion(this.Question); if (!String.IsNullOrEmpty(this.Caption)) { Questioner.SetCaption(this.Caption); } Questioner.ShowDialog(); Answer = Questioner.GetAnswer(); } else if (this.DialogMode == Mode.FreeText) { Ask.AskQuestion Questioner = new CIFactory.NAnt.Tasks.Ask.AskQuestion(); Questioner.SetFreeTextMode(); Questioner.StateQuestion(this.Question); if (!String.IsNullOrEmpty(this.Caption)) { Questioner.SetCaption(this.Caption); } Questioner.ShowDialog(); Answer = Questioner.GetAnswer(); } } else { Log(Level.Info, this.Question); Answer = Console.ReadLine(); } this.Properties[this.AnswerProperty] = Answer; }
protected override void ExecuteTask() { string Answer = string.Empty; if (this.ShowDialog) { if (this.DialogMode == Mode.Options) { Ask.AskQuestion Questioner = new CIFactory.NAnt.Tasks.Ask.AskQuestion(); int OptionCount = 0; foreach (String Choice in this.Options) { ++OptionCount; if (OptionCount > 6) break; Questioner.AddChoice(Choice); } Questioner.StateQuestion(this.Question); if (!String.IsNullOrEmpty(this.Caption)) Questioner.SetCaption(this.Caption); Questioner.ShowDialog(); Answer = Questioner.GetAnswer(); } else if (this.DialogMode == Mode.FreeText) { Ask.AskQuestion Questioner = new CIFactory.NAnt.Tasks.Ask.AskQuestion(); Questioner.SetFreeTextMode(); Questioner.StateQuestion(this.Question); if (!String.IsNullOrEmpty(this.Caption)) Questioner.SetCaption(this.Caption); Questioner.ShowDialog(); Answer = Questioner.GetAnswer(); } } else { Log(Level.Info, this.Question); Answer = Console.ReadLine(); } this.Properties[this.AnswerProperty] = Answer; }