Пример #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;
        }
Пример #2
0
        private void AddStockInControl()
        {
            if (stockInControl == null)
            {
                stockInControl      = new StockInControl();
                stockInControl.Dock = DockStyle.Fill;
                stockInControl.Name = "stockIn";
                Controls.Add(stockInControl);

                stockInControl.ReadTagsClicked += new EventHandler <ReadTagsClickedEventArgs>(stockInControl_ReadTagsClicked);
            }
        }