HuNan_DM/DM_Weight/Views/Dialog/PrintPdfView.xaml.cs

62 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DM_Weight.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
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;
namespace DM_Weight.Views.Dialog
{
/// <summary>
/// PrintPdfView.xaml 的交互逻辑
/// </summary>
public partial class PrintPdfView : UserControl
{
public PrintPdfView()
{
InitializeComponent();
}
///// <summary>
///// 配置 WebView2加载 vuejs加载 pdf 模板,传递数据到 html 中
///// </summary>
///// <returns></returns>
//private async Task Load()
//{
// await webView2.EnsureCoreWebView2Async();
// webView2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; // 禁止右键菜单
// var assembly = Assembly.GetExecutingAssembly();
// var resourceName = "PrintPdf.Views.vue.global.js";
// using var stream = assembly.GetManifestResourceStream(resourceName);
// if (stream != null)
// {
// using var reader = new StreamReader(stream);
// var vue = await reader.ReadToEndAsync();
// await webView2.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(vue); // 加载 vuejs
// }
// var vm = (PrintPdfViewModel)DataContext;
// webView2.CoreWebView2.NavigateToString(vm.Template); // 加载 pdf 模板
// webView2.CoreWebView2.NavigationCompleted += (sender, args) =>
// {
// var json = JsonSerializer.Serialize(vm.Data);
// webView2.CoreWebView2.PostWebMessageAsJson(json); // 将数据传递到 html 中
// };
//}
}
}