/// <inheritdoc/> public bool SelectValueType(DialogArgs args, Type paramType, object initialValue, out object chosen) { var underlying = Nullable.GetUnderlyingType(paramType); if ((underlying ?? paramType).IsEnum) { bool ok = SelectEnum(args, underlying ?? paramType, out Enum enumChosen); chosen = enumChosen; return(ok); } if (paramType == typeof(bool) || paramType == typeof(bool?)) { bool ok = YesNo(args, out bool boolChosen); chosen = boolChosen; return(ok); } if (paramType == typeof(string)) { bool ok = TypeText(args, int.MaxValue, initialValue?.ToString(), out string stringChosen, false); chosen = stringChosen; return(ok); } return(SelectValueTypeImpl(args, paramType, initialValue, out chosen)); }
public virtual void SelectAnythingThen(DialogArgs args, Action <IMapsDirectlyToDatabaseTable> callback) { var selected = SelectOne(args, CoreChildProvider.GetAllSearchables().Keys.ToArray()); if (selected != null) { callback(selected); } }
/// <inheritdoc/> public bool Confirm(DialogArgs args) { // auto confirm if not in user interactive mode if (!IsInteractive) { return(true); } return(YesNo(args)); }
public bool SelectType(DialogArgs args, Type baseTypeIfAny, bool allowAbstract, bool allowInterfaces, out Type chosen) { Type[] available = RepositoryLocator.CatalogueRepository.MEF.GetAllTypes() .Where(t => (baseTypeIfAny == null || baseTypeIfAny.IsAssignableFrom(t)) && (allowAbstract || !t.IsAbstract) && (allowInterfaces || !t.IsInterface)) .ToArray(); return(SelectType(args, available, out chosen)); }
public abstract bool YesNo(DialogArgs args, out bool chosen);
public abstract bool SelectObjects <T>(DialogArgs args, T[] available, out T[] selected) where T : class;
/// <inheritdoc/> public abstract IMapsDirectlyToDatabaseTable SelectOne(DialogArgs args, IMapsDirectlyToDatabaseTable[] availableObjects);
/// <inheritdoc/> public abstract IMapsDirectlyToDatabaseTable[] SelectMany(DialogArgs args, Type arrayElementType, IMapsDirectlyToDatabaseTable[] availableObjects);
public abstract bool TypeText(DialogArgs args, int maxLength, string initialText, out string text, bool requireSaneHeaderText);
protected abstract bool SelectValueTypeImpl(DialogArgs args, Type paramType, object initialValue, out object chosen);
/// <summary> /// Prompts user to select 1 of the objects of type T in the list you provide, returns true if they made a non null selection /// </summary> /// <typeparam name="T"></typeparam> /// <param name="args"></param> /// <param name="availableObjects"></param> /// <param name="selected"></param> /// <returns></returns> protected bool SelectOne <T>(DialogArgs args, IList <T> availableObjects, out T selected) where T : DatabaseEntity { selected = (T)BasicActivator.SelectOne(args, availableObjects.ToArray()); return(selected != null); }
public abstract bool SelectType(DialogArgs args, Type[] available, out Type chosen);
public bool SelectType(DialogArgs args, Type baseTypeIfAny, out Type chosen) { return(SelectType(args, baseTypeIfAny, false, false, out chosen)); }
public abstract bool SelectEnum(DialogArgs args, Type enumType, out Enum chosen);
/// <summary> /// Prompts user to select 1 of the objects of type T from the objects existing in <paramref name="repository"/>, returns true if they made a non null selection /// </summary> /// <typeparam name="T"></typeparam> /// <param name="args"></param> /// <param name="repository"></param> /// <param name="selected"></param> /// <returns></returns> protected bool SelectOne <T>(DialogArgs args, IRepository repository, out T selected) where T : DatabaseEntity { selected = (T)BasicActivator.SelectOne(args, repository.GetAllObjects <T>().ToArray()); return(selected != null); }
public bool YesNo(DialogArgs args) { return(YesNo(args, out bool chosen) && chosen); }
/// <summary> /// Prompts user to select 1 of the objects of type T in the list you provide /// </summary> /// <typeparam name="T"></typeparam> /// <param name="args"></param> /// <param name="availableObjects"></param> /// <returns></returns> protected T SelectOne <T>(DialogArgs args, IList <T> availableObjects) where T : DatabaseEntity { return(SelectOne(args, availableObjects, out T selected) ? selected : null); }