Exemple #1
0
        private void RemoveAllControls()
        {
            Controls.Remove(readerControl);
            if (readerControl != null)
            {
                readerControl.Stop();
            }
            readerControl = null;

            Controls.Remove(logControl);
            logControl = null;

            Controls.Remove(stockInControl);

            // 尝试注销config control的read tags监听事件
            try
            {
                stockInControl.ReadTagsClicked -= stockInControl_ReadTagsClicked;
            }
            // 但是如果没有注册过,注销可能失败,不影响程序正常使用,故不处理异常
            catch (Exception ex) { }

            stockInControl = null;

            Controls.Remove(configControl);
            configControl = null;
        }
Exemple #2
0
 private void AddReaderControl(IList <ReaderProductViewModel> products)
 {
     if (readerControl == null)
     {
         readerControl          = new ReaderControl(config, products);
         readerControl.Dock     = System.Windows.Forms.DockStyle.Fill;
         readerControl.Location = new System.Drawing.Point(0, 0);
         readerControl.Name     = "reader";
         Controls.Add(readerControl);
         readerControl.Start();
     }
 }