private void SetDefaultValues()
 {
     foreach (LineCapExtension cap in LineCapExtension.GetRegisteredValues())
     {
         var item = new ImageComboBoxItem(this, cap);
         _cachedItems.Add(cap.Name, item);
         Items.Add(item);
     }
 }
        private void AddImage(ImageProxy img)
        {
            if (null == img)
            {
                return;
            }
            if (_cachedItems.ContainsKey(img.ContentHash))
            {
                return;
            }
            ImageComboBoxItem it;

            _cachedItems.Add(img.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair <string, ImageProxy>(img.Name, img)));
            _currentItemsSource.Add(it);
        }
        private void InitializeItemLists()
        {
            ImageComboBoxItem it;

            // Texture items
            {
                foreach (KeyValuePair <string, ImageProxy> pair in TextureManager.BuiltinTextures)
                {
                    _cachedItems.Add(pair.Value.ContentHash, it = new ImageComboBoxItem(this, pair));
                    _textureItems.Add(it);
                }

                foreach (KeyValuePair <string, ImageProxy> pair in TextureManager.UserTextures)
                {
                    _cachedItems.Add(pair.Value.ContentHash, it = new ImageComboBoxItem(this, pair));
                    _textureItems.Add(it);
                }

                if (!_cachedItems.ContainsKey(BrushX.DefaultTextureBrush.ContentHash))
                {
                    _cachedItems.Add(BrushX.DefaultTextureBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair <string, ImageProxy>(BrushX.DefaultTextureBrush.Name, BrushX.DefaultTextureBrush)));
                    _textureItems.Add(it);
                }
            }

            // Hatch items
            {
                var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase));
                foreach (var t in types)
                {
                    Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase brush = null;
                    try
                    {
                        brush = Activator.CreateInstance(t) as Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase;
                    }
                    catch (Exception) { }
                    if (null != brush)
                    {
                        var pair = new KeyValuePair <string, ImageProxy>(t.Name, brush);
                        if (!_cachedItems.TryGetValue(brush.ContentHash, out it))
                        {
                            _cachedItems.Add(brush.ContentHash, it = new ImageComboBoxItem(this, pair));
                        }
                        _hatchItems.Add(it);
                    }
                }
                if (!_cachedItems.ContainsKey(BrushX.DefaultHatchBrush.ContentHash))
                {
                    _cachedItems.Add(BrushX.DefaultHatchBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair <string, ImageProxy>(BrushX.DefaultHatchBrush.Name, BrushX.DefaultHatchBrush)));
                    _hatchItems.Add(it);
                }
            }

            // Synthetic items
            {
                var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase));
                foreach (var t in types)
                {
                    Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase brush = null;
                    try
                    {
                        brush = Activator.CreateInstance(t) as Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase;
                    }
                    catch (Exception) { }
                    if (null != brush)
                    {
                        var pair = new KeyValuePair <string, ImageProxy>(t.Name, brush);
                        if (!_cachedItems.TryGetValue(brush.ContentHash, out it))
                        {
                            _cachedItems.Add(brush.ContentHash, it = new ImageComboBoxItem(this, pair));
                        }
                        _syntheticItems.Add(it);
                    }
                }
                if (!_cachedItems.ContainsKey(BrushX.DefaultSyntheticBrush.ContentHash))
                {
                    _cachedItems.Add(BrushX.DefaultSyntheticBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair <string, ImageProxy>(BrushX.DefaultSyntheticBrush.Name, BrushX.DefaultSyntheticBrush)));
                    _syntheticItems.Add(it);
                }
            }
        }
		private void AddImage(ImageProxy img)
		{
			if (null == img)
				return;
			if (_cachedItems.ContainsKey(img.ContentHash))
				return;
			ImageComboBoxItem it;
			_cachedItems.Add(img.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair<string, ImageProxy>(img.Name, img)));
			_currentItemsSource.Add(it);
		}
		private void InitializeItemLists()
		{
			ImageComboBoxItem it;

			// Texture items
			{
				foreach (KeyValuePair<string, ImageProxy> pair in TextureManager.BuiltinTextures)
				{
					_cachedItems.Add(pair.Value.ContentHash, it = new ImageComboBoxItem(this, pair));
					_textureItems.Add(it);
				}

				foreach (KeyValuePair<string, ImageProxy> pair in TextureManager.UserTextures)
				{
					_cachedItems.Add(pair.Value.ContentHash, it = new ImageComboBoxItem(this, pair));
					_textureItems.Add(it);
				}

				if (!_cachedItems.ContainsKey(BrushX.DefaultTextureBrush.ContentHash))
				{
					_cachedItems.Add(BrushX.DefaultTextureBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair<string, ImageProxy>(BrushX.DefaultTextureBrush.Name, BrushX.DefaultTextureBrush)));
					_textureItems.Add(it);
				}
			}

			// Hatch items
			{
				var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase));
				foreach (var t in types)
				{
					Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase brush = null;
					try
					{
						brush = Activator.CreateInstance(t) as Altaxo.Graph.Gdi.HatchBrushes.HatchBrushBase;
					}
					catch (Exception) { }
					if (null != brush)
					{
						KeyValuePair<string, ImageProxy> pair = new KeyValuePair<string, ImageProxy>(t.Name, brush);
						if (!_cachedItems.TryGetValue(brush.ContentHash, out it))
							_cachedItems.Add(brush.ContentHash, it = new ImageComboBoxItem(this, pair));
						_hatchItems.Add(it);
					}
				}
				if (!_cachedItems.ContainsKey(BrushX.DefaultHatchBrush.ContentHash))
				{
					_cachedItems.Add(BrushX.DefaultHatchBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair<string, ImageProxy>(BrushX.DefaultHatchBrush.Name, BrushX.DefaultHatchBrush)));
					_hatchItems.Add(it);
				}
			}

			// Synthetic items
			{
				var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase));
				foreach (var t in types)
				{
					Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase brush = null;
					try
					{
						brush = Activator.CreateInstance(t) as Altaxo.Graph.Gdi.SyntheticBrushes.SyntheticBrushBase;
					}
					catch (Exception) { }
					if (null != brush)
					{
						KeyValuePair<string, ImageProxy> pair = new KeyValuePair<string, ImageProxy>(t.Name, brush);
						if (!_cachedItems.TryGetValue(brush.ContentHash, out it))
							_cachedItems.Add(brush.ContentHash, it = new ImageComboBoxItem(this, pair));
						_syntheticItems.Add(it);
					}
				}
				if (!_cachedItems.ContainsKey(BrushX.DefaultSyntheticBrush.ContentHash))
				{
					_cachedItems.Add(BrushX.DefaultSyntheticBrush.ContentHash, it = new ImageComboBoxItem(this, new KeyValuePair<string, ImageProxy>(BrushX.DefaultSyntheticBrush.Name, BrushX.DefaultSyntheticBrush)));
					_syntheticItems.Add(it);
				}
			}
		}
		private void SetDefaultValues()
		{
			foreach (LineCapExtension cap in LineCapExtension.GetRegisteredValues())
			{
				var item = new ImageComboBoxItem(this, cap);
				_cachedItems.Add(cap.Name, item);
				this.Items.Add(item);
			}
		}