Exemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int slotSize && slotSize >= 1 && slotSize <= 3 && parameter is string rasterSizeStr && int.TryParse(rasterSizeStr, out int rasterSize))
            {
                return(RasterizedImageContainer.GetRasterizedImage(rasterSize, $"Icons/Jewels/Jewel{slotSize}.svg"));
            }

            return(null);
        }
        public void ForceRender()
        {
            RasterizedImageContainer.ClearCache();

            // Classic MVVM hack to force re-render of the view from view model.
            IList <WeaponUsageValueViewModel> originalValues = Values;

            Values = null;
            Values = originalValues;
        }
Exemplo n.º 3
0
        public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || parameter == null)
            {
                return(null);
            }

            string strType = value.ToString();

            if (parameter is string strParam && int.TryParse(strParam, out int rasterSize))
            {
                return(RasterizedImageContainer.GetRasterizedImage(rasterSize, $"{relativeDirectory}/{strType}.svg"));
            }

            return(null);
        }
 static WeaponUsageViewModel()
 {
     RasterizedImageContainer.Initialize(() => PersistedZoomFactor);
 }
Exemplo n.º 5
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     return(RasterizedImageContainer.GetRasterizedImage(Size, Location));
 }