Пример #1
0
        /// <summary>
        /// Adding a question which expects a optional integer as answer
        /// </summary>
        /// <typeparam name="T">bound type</typeparam>
        /// <param name="dialog">the dialog</param>
        /// <param name="field">field to be bound</param>
        /// <param name="question">the question</param>
        /// <returns>the dialog</returns>

        public static ISimpleDialog <T> AskOptional <T>(this ISimpleDialog <T> dialog, Expression <Func <T, int?> > field, string question)
        {
            dialog.AddOption(new OptIntegerDialogOption <T>(field, question, dialog.Item));
            return(dialog);
        }
Пример #2
0
        /// <summary>
        /// Adding a question which expects a decimal as answer
        /// </summary>
        /// <typeparam name="T">bound type</typeparam>
        /// <param name="dialog">the dialog</param>
        /// <param name="field">field to be bound</param>
        /// <param name="question">the question</param>
        /// <returns>the dialog</returns>

        public static ISimpleDialog <T> Ask <T>(this ISimpleDialog <T> dialog, Expression <Func <T, decimal> > field, string question)
        {
            dialog.AddOption(new DecimalDialogOption <T>(field, question, dialog.Item));
            return(dialog);
        }
Пример #3
0
 /// <summary>
 /// Adding a question which expects a optional string that matches the given regex as answer
 /// </summary>
 /// <typeparam name="T">bound type</typeparam>
 /// <param name="dialog">the dialog</param>
 /// <param name="field">field to be bound</param>
 /// <param name="question">the question</param>
 /// <param name="filter">regex</param>
 /// <returns>the dialog</returns>
 public static ISimpleDialog <T> AskOptional <T>(this ISimpleDialog <T> dialog, Expression <Func <T, string> > field, string question, Regex filter)
 {
     dialog.AddOption(new StringDialogOption <T>(field, question, dialog.Item, true, filter));
     return(dialog);
 }
Пример #4
0
        /// <summary>
        /// Adding a question which expects a string as answer
        /// </summary>
        /// <typeparam name="T">bound type</typeparam>
        /// <param name="dialog">the dialog</param>
        /// <param name="field">field to be bound</param>
        /// <param name="question">the question</param>
        /// <returns>the dialog</returns>

        public static ISimpleDialog <T> Ask <T>(this ISimpleDialog <T> dialog, Expression <Func <T, string> > field, string question)
        {
            dialog.AddOption(new StringDialogOption <T>(field, question, dialog.Item, false));
            return(dialog);
        }