调整日志
This commit is contained in:
parent
3f5ea7a5af
commit
54ec14c527
@ -49,7 +49,7 @@ namespace AIMS
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Log.Information("Application exiting.");
|
||||
// Important to call at exit so that batched events are flushed.
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
//"Serilog.Sinks.Console",
|
||||
//"Serilog.Sinks.Debug",
|
||||
"Serilog.Sinks.Seq",
|
||||
"Serilog.Sinks.File",
|
||||
"Serilog.Settings.Configuration",
|
||||
"Serilog.Exceptions",
|
||||
"Serilog.Enrichers.Span",
|
||||
|
||||
@ -11,13 +11,16 @@ using AIMSExtension;
|
||||
using AIMSModel;
|
||||
using DevComponents.DotNetBar;
|
||||
using HelperDB;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AIMS
|
||||
{
|
||||
public partial class FormLogin : Office2007Form
|
||||
{
|
||||
ILogger<FormLogin> logger;
|
||||
public FormLogin()
|
||||
{
|
||||
logger = this.GetLogger();
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.EnableGlass = false;
|
||||
|
||||
@ -31,7 +34,7 @@ namespace AIMS
|
||||
AIMSExtension.PublicMethod.SetLocalDateTime();
|
||||
AIMSExtension.PublicMethod.HospitalName = PublicMethod.GetHospital();
|
||||
//label1.Text = AIMSExtension.PublicMethod.GetSystemName();
|
||||
label2.Text = PublicMethod.HospitalName + " V" + PublicMethod.NowVersion;
|
||||
label2.Text = PublicMethod.HospitalName + " V" + PublicMethod.NowVersion;
|
||||
txtNo.Select();
|
||||
txtNo.Focus();
|
||||
List<string> list = xmlUse.GetNode("LastLoginNo");
|
||||
@ -53,7 +56,8 @@ namespace AIMS
|
||||
#if DEBUG
|
||||
txtNo.Text = "admin";
|
||||
txtPassWord.Text = "1";
|
||||
btnOk_Click(null, null);
|
||||
|
||||
btnOk_Click(btnOk, new EventArgs());
|
||||
#endif
|
||||
}
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
@ -80,8 +84,8 @@ namespace AIMS
|
||||
{
|
||||
PublicMethod.LastOperationSite = list[0];
|
||||
}
|
||||
PublicMethod.WriteLog("登录", PersonObj.Id.Value);
|
||||
|
||||
using var userScope = logger.BeginScope(new Dictionary<string, object> { { "OperatorId", PersonObj.Id.Value }, { "OperatorNo", PersonObj.No }, { "OperatorName", PersonObj.Name } });
|
||||
logger.LogInformation("登录成功:{userno}",txtNo.Text);
|
||||
PublicMethod.StartCollectorDataProgram();
|
||||
Hide();
|
||||
//在这里为编辑器注册
|
||||
@ -91,6 +95,7 @@ namespace AIMS
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("登录失败:{userno}",txtNo.Text);
|
||||
MessageBox.Show("用户名或密码有错误,请重新输入!", "提示", MessageBoxButtons.OK);
|
||||
|
||||
txtPassWord.Text = "";
|
||||
|
||||
@ -16,6 +16,10 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using MaterialSkin;
|
||||
#if MD
|
||||
using MaterialSkin.Controls;
|
||||
#endif
|
||||
|
||||
namespace AIMS
|
||||
{
|
||||
@ -54,6 +58,14 @@ namespace AIMS
|
||||
SetGridAlternatingRows(lv4);
|
||||
SetGridAlternatingRows(lv5);
|
||||
SetGridAlternatingRows(lv6);
|
||||
#if MD
|
||||
|
||||
var materialSkinManager = MaterialSkinManager.Instance;
|
||||
//materialSkinManager.AddFormToManage(this);
|
||||
materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
|
||||
materialSkinManager.ColorScheme = new MaterialSkin.ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
private void switchButton1_ValueChanged(object sender, EventArgs e)
|
||||
@ -388,24 +400,23 @@ namespace AIMS
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (Form frm in Application.OpenForms)
|
||||
var forms = Application.OpenForms.OfType<Form>().ToList() ;
|
||||
foreach (var frm in forms)
|
||||
{
|
||||
if (frm.Name != "frmLogin" && frm.Name != this.Name)
|
||||
if (frm == this)
|
||||
{
|
||||
frm.Close();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach (Form frm in Application.OpenForms)
|
||||
{
|
||||
if (frm.Name == "frmLogin")
|
||||
if (frm is FormLogin fl)
|
||||
{
|
||||
frm.Show();
|
||||
isClose = true;
|
||||
this.Close();
|
||||
break;
|
||||
fl.Show();
|
||||
continue;
|
||||
}
|
||||
|
||||
frm.Close();
|
||||
}
|
||||
isClose = true;
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -419,15 +430,36 @@ namespace AIMS
|
||||
{
|
||||
if (MessageBox.Show(this, "确定要退出当前系统?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
this.Dispose();
|
||||
Environment.Exit(0);
|
||||
isClose = true;
|
||||
//关闭所有窗体
|
||||
Task.Factory.StartNew(CloseAll);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CloseAll()
|
||||
{
|
||||
var forms = Application.OpenForms.OfType<Form>().ToList();
|
||||
foreach (var frm in forms)
|
||||
{
|
||||
if (frm == this)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
frm.Close();
|
||||
}
|
||||
await Task.Delay(10 * 1000);//等待10秒
|
||||
logger.LogWarning("等待10秒未能关闭所有窗体,即将强制关闭");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private void buttonX1_Click(object sender, EventArgs e)
|
||||
{
|
||||
AIMS.PublicUI.UI.frmAbout frmEditPassWord = new PublicUI.UI.frmAbout();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user