internal void InvokeSearchCommand()
        {
            _showingSearch = true;
            _images.Clear();

            string iconName = _searchText;

            if (iconName.StartsWith("pack"))
            {
                iconName = System.IO.Path.GetFileNameWithoutExtension(iconName);
            }

            foreach (string key in _resournceXaml.Keys)
            {
                if (string.IsNullOrEmpty(iconName) || Regex.IsMatch(key, Regex.Escape(iconName), RegexOptions.IgnoreCase))
                {
                    ImageSource imgSource = _resournceXaml[key] as ImageSource;
                    if (imgSource != null)
                    {
                        ProImage proImage = new ProImage();
                        proImage.Name   = key;
                        proImage.Source = imgSource;
                        _images.Add(proImage);
                    }
                }
            }

            // Sort by name
            _images = _images.OrderBy(o => o.Name).ToList();
            NotifyPropertyChanged("ProImages");
        }
        public AllProImagesPaneViewModel() : base()
        {
            if (FrameworkApplication.ApplicationTheme == ApplicationTheme.Dark)
            {
                _resournceXaml = new ResourceDictionary()
                {
                    Source = new Uri("pack://application:,,,/ArcGIS.Desktop.Resources;component/DarkXamlImages.xaml")
                }
            }
            ;
            else
            {
                _resournceXaml = new ResourceDictionary()
                {
                    Source = new Uri("pack://application:,,,/ArcGIS.Desktop.Resources;component/XamlImages.xaml")
                }
            };

            foreach (string key in _resournceXaml.Keys)
            {
                ImageSource imgSource = _resournceXaml[key] as ImageSource;
                if (imgSource != null)
                {
                    ProImage proImage = new ProImage();
                    proImage.Name   = key;
                    proImage.Source = imgSource;
                    _images.Add(proImage);
                }
            }
            _images = _images.OrderBy(o => o.Name).ToList();
        }
Ejemplo n.º 3
0
        private string GetImageName(Image img)
        {
            if (img == null || img.DataContext == null)
            {
                return(string.Empty);
            }
            ProImage proImage = img.DataContext as ProImage;

            img.ToolTip = proImage.Name;
            return(proImage.Name);
        }