|
@ -4,6 +4,8 @@ using Microsoft.Web.WebView2.Wpf; |
|
|
using System; |
|
|
using System; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
using System.Windows; |
|
|
using System.Windows; |
|
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
|
using System.Windows.Media; |
|
|
using io = System.IO; |
|
|
using io = System.IO; |
|
|
|
|
|
|
|
|
namespace BBWY.Client.Views.Order |
|
|
namespace BBWY.Client.Views.Order |
|
@ -16,6 +18,7 @@ namespace BBWY.Client.Views.Order |
|
|
private WebView2Manager w2m; |
|
|
private WebView2Manager w2m; |
|
|
//private Stopwatch sw;
|
|
|
//private Stopwatch sw;
|
|
|
private string orderId; |
|
|
private string orderId; |
|
|
|
|
|
private bool isNavigated; |
|
|
|
|
|
|
|
|
public GrabJDMibole(string orderId) |
|
|
public GrabJDMibole(string orderId) |
|
|
{ |
|
|
{ |
|
@ -40,8 +43,12 @@ namespace BBWY.Client.Views.Order |
|
|
} |
|
|
} |
|
|
grid.Children.Add(w2m.wb2); |
|
|
grid.Children.Add(w2m.wb2); |
|
|
|
|
|
|
|
|
|
|
|
if(w2m.IsInitializationCompleted) |
|
|
|
|
|
txtMsg.Text = "Grabbing Mobile"; |
|
|
|
|
|
|
|
|
w2m.CoreWebView2InitializationCompleted = (e) => |
|
|
w2m.CoreWebView2InitializationCompleted = (e) => |
|
|
{ |
|
|
{ |
|
|
|
|
|
isNavigated = true; |
|
|
w2m.wb2.CoreWebView2.Navigate($"https://neworder.shop.jd.com/order/orderDetail?orderId={orderId}"); |
|
|
w2m.wb2.CoreWebView2.Navigate($"https://neworder.shop.jd.com/order/orderDetail?orderId={orderId}"); |
|
|
}; |
|
|
}; |
|
|
w2m.OnNavigationCompleted = async (e) => |
|
|
w2m.OnNavigationCompleted = async (e) => |
|
@ -55,6 +62,9 @@ namespace BBWY.Client.Views.Order |
|
|
else if (w2m.wb2.CoreWebView2.Source.StartsWith("https://neworder.shop.jd.com/order/orderDetail")) |
|
|
else if (w2m.wb2.CoreWebView2.Source.StartsWith("https://neworder.shop.jd.com/order/orderDetail")) |
|
|
{ |
|
|
{ |
|
|
//进入订单详情页面,触发点击查看手机号
|
|
|
//进入订单详情页面,触发点击查看手机号
|
|
|
|
|
|
txtMsg.Text = "Grabbing Mobile"; |
|
|
|
|
|
w2m.wb2.Width = 0.1; |
|
|
|
|
|
w2m.wb2.Height = 0.1; |
|
|
var js = @"var mobileNode = document.getElementById('mobile');
|
|
|
var js = @"var mobileNode = document.getElementById('mobile');
|
|
|
mobileNode.addEventListener('DOMNodeInserted',function(e){ var m=mobileNode.innerText; window.chrome.webview.postMessage(m);}); |
|
|
mobileNode.addEventListener('DOMNodeInserted',function(e){ var m=mobileNode.innerText; window.chrome.webview.postMessage(m);}); |
|
|
document.getElementById('viewOrderMobile').click();";
|
|
|
document.getElementById('viewOrderMobile').click();";
|
|
@ -68,6 +78,12 @@ namespace BBWY.Client.Views.Order |
|
|
this.DialogResult = true; |
|
|
this.DialogResult = true; |
|
|
this.Close(); |
|
|
this.Close(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (w2m.IsInitializationCompleted && !isNavigated) |
|
|
|
|
|
{ |
|
|
|
|
|
w2m.wb2.CoreWebView2.Navigate($"https://neworder.shop.jd.com/order/orderDetail?orderId={orderId}"); |
|
|
|
|
|
isNavigated = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|