HuanMengAdmin/admin-server/MiaoYu.WinFormDemo/Form1.cs
2024-07-18 02:27:50 +08:00

36 lines
1009 B
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 HZY.Framework.Repository.EntityFramework;
using MiaoYu.Repository.Admin.Entities.Systems;
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.Logging;
namespace MiaoYu.WinFormDemo;
public partial class Form1 : Form
{
private readonly ILogger<Form1> _logger;
private IRepository<SysUser> _sysUserRepository;
public Form1(ILogger<Form1> logger, IRepository<SysUser> sysUserRepository)
{
InitializeComponent();
_logger = logger;
_sysUserRepository = sysUserRepository;
}
private void Form1_Load(object sender, EventArgs e)
{
// ¼ÓÈëÆô¶¯ blazor
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = HZY.Framework.Core.App.WebApplication?.Services!;
blazorWebView1.RootComponents.Add<MiaoYu.WinFormDemo.App>("#app");
// ´ò¿ª´°¿Ú2
var form2 = HZY.Framework.Core.App.WebApplication?.Services?.GetService<Form2>();
form2?.Show();
}
}