Exemplo n.º 1
0
 public static USB GetInstance()
 {
     if (instance == null)
     {
         lock (locker)
         {
             if (instance == null)
             {
                 instance = new USB();
             }
         }
         return(instance);
     }
     return(instance);
 }
Exemplo n.º 2
0
        private MainForm()
        {
            InitializeComponent();

            this.IsMdiContainer = true;

            //实例化子窗体
            homeForm  = HomeForm.GetInstance();
            dataForm  = DataForm.GetInstance();
            usb       = USB.GetInstance();
            delete    = Delete.GetInstance();
            setupForm = SetupForm.GetInstance();

            homeForm.Click_InMain += simpleButton1_Click;
            dataForm.Click_InData += simpleButton2_Click;

            #region 添加子窗体
            homeForm.MdiParent  = this;
            dataForm.MdiParent  = this;
            usb.MdiParent       = this;
            delete.MdiParent    = this;
            setupForm.MdiParent = this;

            //pnlCenter.BeginInit();
            //pnlCenter.Controls.Add(homeForm);
            //pnlCenter.Controls.Add(dataForm);
            //pnlCenter.Controls.Add(usb);
            //pnlCenter.Controls.Add(delete);
            //pnlCenter.Controls.Add(setupForm);
            //pnlCenter.EndInit();
            #endregion

            ////计时服务
            System.Timers.Timer clock = new System.Timers.Timer(1000);
            clock.Elapsed  += Timer_Elapsed;
            clock.AutoReset = true;
            clock.Enabled   = true;
        }