#include #include #include #include #include #include #include #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) ViewPictures : public xframe { public: KXMLDOMElement imageElement; xstring m_customer; public: ViewPictures(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: static ViewPictures* CreateInstance(void* implPtr, void* hWnd) { ViewPictures* pWin = new ViewPictures(implPtr, (HWND)hWnd); return pWin; } int OnCmdDispatch(xstring comdid) { if (comdid == L"xmClose") { CloseWindow(); return 1; } return 0; } int OnXCommand(TEvent* evt, LPARAM param) { return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { AttachEvent(L"WM_XCOMMAND", (FEvent)&ViewPictures::OnXCommand); return 1; } int OnShowImage(xstring skuid) { ximageview im = GetControl(L"im1"); //im.RemoveImage(); im.Reset(); xml xp ; xaserverarg arg_pic; arg_pic.AddArg(L"SKUID", skuid); if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKU", arg_pic.GetString(), xp) != 1) { trace(L"error:" + xstring(xp.xml(), true)); } else { trace(skuid + L"===== L" + xp.xml()); imageElement = xp.documentElement(); KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image"); int lenp = nlistp.length(); for (int ip = 0; ip < lenp; ip++) { KXMLDOMElement xitem = nlistp.item(ip); xstring picname = xitem.selectSingleNode(L"PicPath").text(); xstring goodno = xitem.selectSingleNode(L"GoodsNo").text(); if (picname == L"/business/products/Thumbs//") picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; im.AddImages(picname, L""); } im.Redraw(); //win32::SendMessage(im.GetId(),0x000f,0,1); //win32::InvalidateRect(im.GetId(),cast(0 as ref xrect),true); } return 1; } int onload() { SetArg(); OnAttachEvent(); xaserverarg arg; int p = GetArg(); xstring skuid = arg.GetArgString(L"guid"); xstring customerItemNo = arg.GetArgString(L"CustomerItemNo"); OnShowImage(skuid); return 1; } };