Beispiel #1
0
        // Test checks png images. If at least one icon is not presented, test fails.
        public void SearchForPNGFiles()
        {
            var model = DynamoModel.Start();

            IEnumerable   searchEntries            = model.SearchModel.SearchEntries.OfType <NodeSearchElement>();
            IconServices  iconServices             = new IconServices(model.PathManager);
            IconWarehouse currentWarehouse         = null;
            var           currentWarehouseAssembly = string.Empty;

            List <String> missingIcons = new List <string>();

            foreach (var entry in searchEntries)
            {
                var searchEle = entry as NodeSearchElement;
                if (String.IsNullOrEmpty(searchEle.IconName))
                {
                    continue;
                }

                var smallIconName = searchEle.IconName + Configurations.SmallIconPostfix;
                var largeIconName = searchEle.IconName + Configurations.LargeIconPostfix;


                // Only retrieve the icon warehouse for different assembly.
                if (currentWarehouseAssembly != searchEle.Assembly)
                {
                    currentWarehouseAssembly = searchEle.Assembly;
                    currentWarehouse         = iconServices.GetForAssembly(searchEle.Assembly);
                }

                ImageSource smallIcon = null;
                ImageSource largeIcon = null;
                if (currentWarehouse != null)
                {
                    smallIcon = currentWarehouse.LoadIconInternal(smallIconName);
                    largeIcon = currentWarehouse.LoadIconInternal(largeIconName);
                }

                if (smallIcon == null)
                {
                    missingIcons.Add(smallIconName);
                }
                if (largeIcon == null)
                {
                    missingIcons.Add(largeIconName);
                }
            }

            Assert.IsTrue(missingIcons.Count == 0, String.Join(Environment.NewLine, missingIcons));
            model.ShutDown(false);
        }
        internal SearchViewModel(DynamoViewModel dynamoViewModel)
        {
            Model = dynamoViewModel.Model.SearchModel;
            this.dynamoViewModel = dynamoViewModel;

            IPathManager pathManager = null;

            if (dynamoViewModel != null && (dynamoViewModel.Model != null))
            {
                pathManager = dynamoViewModel.Model.PathManager;
            }

            iconServices = new IconServices(pathManager);

            InitializeCore();
        }
Beispiel #3
0
        internal SearchViewModel(DynamoViewModel dynamoViewModel)
        {
            Model = dynamoViewModel.Model.SearchModel;
            this.dynamoViewModel = dynamoViewModel;

            IPathManager pathManager = null;

            if (dynamoViewModel != null && (dynamoViewModel.Model != null))
            {
                pathManager = dynamoViewModel.Model.PathManager;
            }

            iconServices = new IconServices(pathManager);

            MaxNumSearchResults = 15;

            selectionNavigator = new SelectionNavigator(SearchRootCategories);
            InitializeCore();
        }