Beispiel #1
0
    void SetDataSource(ImageProxy selected)
    {
      string selHash = null==selected ? null : selected.ContentHash;

      this.BeginUpdate();

      Items.Clear();

      int selIndex = -1;
      foreach (KeyValuePair<string, ImageProxy> pair in TextureManager.BuiltinTextures)
      {
        if (selIndex < 0 && pair.Value.ContentHash==selHash)
          selIndex = Items.Count;

        Items.Add(pair);
      }
      foreach (KeyValuePair<string, ImageProxy> pair in TextureManager.UserTextures)
      {
        if (selIndex < 0 && pair.Value.ContentHash== selHash)
          selIndex = Items.Count;

        Items.Add(pair);
      }

      if (selIndex < 0 && selected!=null)
      {
        selIndex = Items.Count;
        TextureManager.UserTextures.Add(selected);
      }

      SelectedIndex = selIndex;

      this.EndUpdate();
    }
Beispiel #2
0
 public bool HasSameContentAs(ImageProxy from)
 {
   return this.ContentHash == from.ContentHash;
 }
Beispiel #3
0
 public TextureImageComboBox(ImageProxy selected)
   : this()
 {
   SetDataSource(selected);
 }
Beispiel #4
0
 public bool HasSameContentAs(ImageProxy from)
 {
     return(ContentHash == from.ContentHash);
 }
		public static ImageSource GetImage(ImageProxy val)
		{
			return GuiHelper.ToWpf(val);
		}
		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);
		}
		public void InitTextureImage(ImageProxy proxy, BrushType imageType)
		{
			_cbTextureImage.TextureImageType = imageType;
			_cbTextureImage.TextureImage = proxy;
		}