56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using AIProofread.core;
|
|
using System;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace AIProofread.Controls
|
|
{
|
|
[ClassInterface(ClassInterfaceType.AutoDual)]
|
|
[ComVisible(true)]
|
|
public partial class FormReadme : BaseWinForm
|
|
{
|
|
/// <summary>
|
|
/// 单例实例。
|
|
/// </summary>
|
|
private static FormReadme INSTANCE = null;
|
|
public FormReadme()
|
|
{
|
|
InitializeComponent();
|
|
// 写入缓存
|
|
File.WriteAllText(Config.GetCurrentVersionReadmeCacheFile(), DateTime.Now.ToString("yyyy-M-d"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取单例对象。
|
|
/// </summary>
|
|
public static FormReadme GetInstance(bool newInstance = true)
|
|
{
|
|
if (newInstance && (INSTANCE == null || INSTANCE.IsDisposed))
|
|
{
|
|
INSTANCE = new FormReadme();
|
|
}
|
|
return INSTANCE;
|
|
}
|
|
|
|
public void CloseAndDispose()
|
|
{
|
|
if (INSTANCE != null && !INSTANCE.IsDisposed)
|
|
{
|
|
INSTANCE.Close();
|
|
INSTANCE = null;
|
|
}
|
|
}
|
|
|
|
private void FormReadme_Load(object sender, EventArgs e)
|
|
{
|
|
// 初始化
|
|
InitWebView(WebView_ReadMe, Config.WebPath("version-readme"), "version-readme", () =>
|
|
{
|
|
WebView_ReadMe.CoreWebView2.AddHostObjectToScript("readme", this);
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
}
|