zoukankan      html  css  js  c++  java
  • 获取实例

    public class WaitFormService
        {
            public static void CreateWaitForm(string message)
            {
                WaitFormService.Instance.CreateForm(message);
            }
    
            public static void CloseWaitForm()
            {
                WaitFormService.Instance.CloseForm();
            }
    
            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 Lba_Ciac.Loading waitForm;
    
            public void CreateForm(string message)
            {
                if (waitThread != null)
                {
                    try
                    {
                        waitThread.Abort();
                    }
                    catch (Exception)
                    {
                    }
                }
    
                waitThread = new Thread(new ThreadStart(delegate()
                {
                    waitForm = new Lba_Ciac.Loading();
                    waitForm.Text = message;
                    Application.Run(waitForm);
                }));
                waitThread.Start();
            }
    
            public void CloseForm()
            {
                if (waitForm != null)
                {
                    try
                    {
                        waitForm.Invoke((Action)(() =>
                        {
                            waitForm.Close();
                        }));
                    }
                    catch (Exception)
                    {
                    }
                }
                if (waitThread != null)
                {
                    try
                    {
                        waitThread.Abort();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
    

      

  • 相关阅读:
    windows加固方案
    redis集群
    tar命令
    nfs安装配置
    nginx php版本隐藏
    细谈select函数(C语言)
    linux 下各errno的意义(转)
    iperf交叉编译:
    主机和虚拟机不能ping通问题
    Linux中tcpdump的编译和使用
  • 原文地址:https://www.cnblogs.com/XuPengLB/p/7346830.html
Copyright © 2011-2022 走看看