コード例 #1
0
        public override void DoubleClick(Action <string> showMsg)
        {
            Tuple <DataSet, string> tp = AccessAndExcelOp.GetDataFromExcelByConn(NamesManage.ConTactorTbName, NamesManage.RelayTbName, NamesManage.IndicatorTbName);

            if (tp != null)
            {
                TerminalRelationsDao dao = new TerminalRelationsDao();//Table到实体类的映射工具
                /*接触器库*/
                DataTable table = tp.Item1.Tables[NamesManage.ConTactorTbName];
                config.ContactorPins = dao.getRelayPins(table);
                showMsg(String.Format("加载接触器端子信息{0}条。\r\n", config.ContactorPins.Count));
                base.Itemvms.Add(new ConTactorLibDisplay(this));
                /*继电器库*/
                table            = tp.Item1.Tables[NamesManage.RelayTbName];
                config.RelayPins = dao.getRelayPins(table);
                showMsg(String.Format("加载继电器端子信息{0}条。\r\n", config.RelayPins.Count));
                base.Itemvms.Add(new RelayLibDisplay(this));
                /*指示灯模块库*/
                table = tp.Item1.Tables[NamesManage.IndicatorTbName];
                config.IndicatorPins = dao.getIndicatorPins(table);
                showMsg(String.Format("加载指示灯模块端子信息{0}条。\r\n", config.IndicatorPins.Count));
                base.Itemvms.Add(new IndicatorLibDisplay(this));
                /*保存本地*/
                SerializeData <Configuration> .T_WriteBinary(config, NamesManage.ConfigFileName);
            }
        }
コード例 #2
0
        public override void DoubleClick(Action <string> showMsg)
        {
            base.Itemvms.Clear();
            Tuple <DataSet, string> tp = AccessAndExcelOp.GetDataFromExcelByConn(NamesManage.VoltTbName, NamesManage.CptTbName, NamesManage.TBTbName);

            if (tp != null)
            {
                ComponentConfigDao dao = new ComponentConfigDao();//元件配置表实体转换类
                /*电压给定表*/
                DataTable table = tp.Item1.Tables[NamesManage.VoltTbName];
                config.Vsets = dao.getVccConfig(table);
                showMsg(String.Format("加载电压给定表{0}条。\r\n", config.Vsets.Count));
                base.Itemvms.Add(new VoltDisplay(this));
                /*元件配置表*/
                table         = tp.Item1.Tables[NamesManage.CptTbName];
                config.Cptlib = dao.getComponentInfo(table);
                showMsg(String.Format("加载元件名称表{0}条。\r\n", config.Cptlib.Count));
                base.Itemvms.Add(new CptDisplay(this));
                /*端子排短接表*/
                table        = tp.Item1.Tables[NamesManage.TBTbName];
                config.Tblib = dao.getTermialRelations(table);
                showMsg(String.Format("加载端子排短接表{0}条。\r\n", config.Tblib.Count));
                base.Itemvms.Add(new TBDisplay(this));
            }
            /*保存本地*/
            try
            {
                SerializeData <Configuration> .T_WriteBinary(Configuration.GetInstance(), NamesManage.ConfigFileName);
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        public override void DoubleClick(Action <string> showMsg)
        {
            Tuple <DataSet, string> tp = AccessAndExcelOp.GetDataFromExcelByConn(NamesManage.OriginTbName);
            Action waitForFinish       = () =>
            {
                if (tp != null)
                {
                    GraphDao  dao   = new GraphDao();
                    DataTable table = tp.Item1.Tables[NamesManage.OriginTbName];
                    pro.Cells          = dao.getComponentRelations(table);
                    pro.OriginFileName = tp.Item2;
                    showMsg(String.Format("加载元件清单信息{0}条。\r\n", pro.Cells.Count));
                    pro.BuildGraphData();
                    showMsg(String.Format("电路图拓扑结构导入完成,共包含{0}个节点。\r\n", pro.Nodes.Count));
                }
            };

            Messenger.Default.Send <Action>(waitForFinish, "WaitForFinish");
            base.Itemvms.Add(new CptRelationDisplay(this));
        }