优化图片显示

This commit is contained in:
wule committed 2026-10-19 14:22:25 +08:00
1 parent 1d4867ebf2
commit 17728c074c
3 files changed
+101 -15

No files matched your search

@@ -769,7 +769,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
}
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
private async void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (this.DataContext is oms_wei_order_item_info order_item)
{
@@ -782,19 +782,22 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 绑定时即刻生效,无需再次手动调用
//order_item.UpdateOrderItemBuyButton();
Task.Run(() =>
{
// 异步加载图片防止卡顿
// 缩略图在有的电脑上无法显示
//BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img, 100, 100);
//BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img);
Thread.Sleep(Randomx.GetId(1000));
Dispatcher.Invoke(new Action(() =>
{
imgOrderItem.Source = bImg;
}));
});
//Task.Run(() =>
//{
// // 异步加载图片防止卡顿
// // 缩略图在有的电脑上无法显示
// //BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
// BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img, 100, 100);
// //BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img);
// Thread.Sleep(Randomx.GetId(1000));
// Dispatcher.Invoke(new Action(() =>
// {
// imgOrderItem.Source = bImg;
// }));
//});
var bImg = await AllBase.ImageBuild.LoadBitmipImageFromUrlAsync(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
imgOrderItem.Source = bImg;
// 待采购不显示所有采购信息状态(否则会显示作废订单状态)