You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
1 year ago
|
using API;
|
||
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
using Microsoft.Extensions.Hosting;
|
||
|
using Serilog;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
using Volo.Abp;
|
||
|
using Volo.Abp.DependencyInjection;
|
||
|
|
||
|
namespace WinFormsApp
|
||
|
{
|
||
|
public partial class Form1 : Form,ITransientDependency
|
||
|
{
|
||
|
//private readonly IHost _host;
|
||
|
//private readonly IAbpApplicationWithExternalServiceProvider _application;
|
||
|
//private IBackgroundJobManagerApplication _service;
|
||
|
private IBackgroundJobManagerApplication _service;
|
||
|
|
||
|
public Form1(IBackgroundJobManagerApplication service)
|
||
|
{
|
||
|
//_host = CreateHostBuilder();
|
||
|
|
||
|
//_service = _host.Services.GetService<IBackgroundJobManagerApplication>();
|
||
|
_service= service;
|
||
|
InitializeComponent();
|
||
|
|
||
|
|
||
|
}
|
||
|
private IHost CreateHostBuilder()
|
||
|
{
|
||
|
return Host
|
||
|
.CreateDefaultBuilder(null)
|
||
|
.UseAutofac()
|
||
|
.UseSerilog()
|
||
|
.ConfigureServices((hostContext, services) =>
|
||
|
{
|
||
|
services.AddApplication<WinFormModule>();
|
||
|
}).Build();
|
||
|
}
|
||
|
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
ToDo();
|
||
|
}
|
||
|
|
||
|
private async void ToDo()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
List<RequestDto> dtos = new List<RequestDto>();
|
||
|
RequestDto dto = new RequestDto();
|
||
|
dto.SheetCode = "TO_CWC14";
|
||
|
dto.SheetName = "TO_CWC14";
|
||
|
dto.Year = 2020;
|
||
|
dto.Month = 1;
|
||
|
dtos.Add(dto);
|
||
|
// var aa = await _service.AddBackgroundJob(dtos);
|
||
|
var str = _service.SayHello();
|
||
|
}
|
||
|
catch (Exception ex )
|
||
|
{
|
||
|
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|