public IList <TO> Lookup <TO, TL>(TL lookupObjectList, IList <TO> selectedObjects)
            where TO : class, ILookupObject
            where TL : ILookupObjectList
        {
            IList <ILookupObject> selected = null;

            if (selectedObjects != null)
            {
                selected = selectedObjects.Cast <ILookupObject>().ToList();
            }

            var command = new CommandLookup(lookupObjectList, selected, AllowNullSelection, true);

            command.UnitTestingMode = UnitTestingMode;
            CommandExecutor.Execute(command);

            SelectedDisplayText = BuildDisplayText(command.SelectedObjects);

            return(command.SelectedObjects != null?command.SelectedObjects.Cast <TO>().ToList() : null);
        }
Esempio n. 2
0
        public TO Lookup <TO, TL>(TL lookupObjectList, TO selectedObject)
            where TO : class, ILookupObject
            where TL : ILookupObjectList
        {
            var selectedObjects = new List <ILookupObject>();

            if (selectedObject != null)
            {
                selectedObjects.Add(selectedObject);
            }

            var command = new CommandLookup(lookupObjectList, selectedObjects, AllowNullSelection, false);

            command.UnitTestingMode = UnitTestingMode;
            CommandExecutor.Execute(command);

            if (command.SelectedObjects != null && command.SelectedObjects.Count == 1)
            {
                return((TO)command.SelectedObjects[0]);
            }
            return(default(TO));
        }