82 lines
2.1 KiB
C#
82 lines
2.1 KiB
C#
using _29WxOrderWpf.ViewModels;
|
|
using AllBase;
|
|
using AllBase.Model.DBModel;
|
|
using AllBase.Model.Result;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using Work._29Tools.Forms.ToolForms;
|
|
|
|
namespace _29WxOrderWpf.Ctrls.BuyerCtrls;
|
|
|
|
/// <summary>
|
|
/// SkuSelectListRowCtrl.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class SkuSelectListRowCtrl : UserControl
|
|
{
|
|
public SkuSelectListRowCtrl()
|
|
{
|
|
InitializeComponent();
|
|
this.DataContextChanged += SkuSelectListRowCtrl_DataContextChanged;
|
|
}
|
|
|
|
private void SkuSelectListRowCtrl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (this.DataContext is frontSkuInfo3 frontSku)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
// 异步加载图片防止卡顿
|
|
// 缩略图在有的电脑上无法显示
|
|
//BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
|
|
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(frontSku.thumbUrl);
|
|
Thread.Sleep(Randomx.GetId(200));
|
|
Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
imgSku.Source = bImg;
|
|
}));
|
|
});
|
|
}
|
|
}
|
|
|
|
private void imgSku_MouseDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (this.DataContext is frontSkuInfo3 frontSku)
|
|
{
|
|
ShowImgForm imgFrom = new ShowImgForm(frontSku.thumbUrl);
|
|
imgFrom.TopMost = true;
|
|
imgFrom.Show();
|
|
}
|
|
}
|
|
|
|
private void imgSku_MouseEnter(object sender, MouseEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void imgSku_MouseLeave(object sender, MouseEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (this.DataContext is frontSkuInfo3 frontSku)
|
|
{
|
|
await BuyMapSkuViewModel.BuyMapSkuInstance.SetOrderMapSku(frontSku);
|
|
}
|
|
}
|
|
}
|