using System;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using 常用工具集.Base;

namespace 常用工具集.ViewModel._03图片相关
{
    public class 色卡包ViewModel : ViewModelBase
    {
        public Bitmap ImageSource { get; set; } = null;
        public DelegateCommand ButtonCmd { get; set; }
        public 色卡包ViewModel()
        {
            ButtonCmd = new DelegateCommand(ButtonCmdFunc);
        }

        private void ButtonCmdFunc(object obj)
        {
            string fileName = obj.ToString();
            // 获取Pack URI
            string packUri = $"avares://常用工具集/Assets/ColorBag/{fileName}.gif";
            ImageSource = new Bitmap(AssetLoader.Open(new Uri(packUri)));
        }
    }
}
