加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
WaitForm.cs 2.83 KB
一键复制 编辑 原始数据 按行查看 历史
jlshiwei 提交于 2018-12-25 17:34 . jlshiwei 2018.12.25
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace TabHeaderDemo
{
public partial class WaitForm : Frm.FormLink
{
public WaitForm()
{
}
private delegate void SetTextHandler(string text);
}
public class WaitFormService
{
public static void CreateWaitForm()
{
WaitFormService.Instance.CreateForm();
}
public static void CloseWaitForm()
{
WaitFormService.Instance.CloseForm();
}
public static void SetWaitFormCaption(string text)
{
WaitFormService.Instance.SetFormCaption(text);
}
private static WaitFormService _instance;
private static readonly Object syncLock = new Object();
public static WaitFormService Instance
{
get
{
if (WaitFormService._instance == null)
{
lock (syncLock)
{
if (WaitFormService._instance == null)
{
WaitFormService._instance = new WaitFormService();
}
}
}
return WaitFormService._instance;
}
}
private WaitFormService()
{
}
private Thread waitThread;
private WaitForm waitForm;
public void CreateForm()
{
return;
if (waitThread != null)
{
try
{
waitThread.Abort();
}
catch (Exception)
{
}
}
waitThread = new Thread(new ThreadStart(delegate ()
{
waitForm = new WaitForm();
try
{
Application.Run(waitForm);
}
catch(Exception e)
{
}
}));
waitThread.Start();
}
public void CloseForm()
{
if (waitThread != null)
{
try
{
waitThread.Abort();
}
catch (Exception)
{
}
}
}
public void SetFormCaption(string text)
{
if (waitForm != null)
{
try
{
}
catch (Exception)
{
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化