Beispiel #1
0
 /// <summary>
 /// Получить обозначение команды в дереве
 /// </summary>
 private string GetCmdCaption(ModbusCmd modbusCmd)
 {
     return((string.IsNullOrEmpty(modbusCmd.Name) ? KpPhrases.DefCmdName : modbusCmd.Name) +
            " (" + ModbusUtils.GetTableTypeName(modbusCmd.TableType) + ", " +
            ModbusUtils.GetAddressRange(modbusCmd.Address, modbusCmd.ElemCnt,
                                        template.Sett.ZeroAddr, template.Sett.DecAddr) + ")");
 }
        /// <summary>
        /// Gets the command node text.
        /// </summary>
        private string GetCmdNodeText(CmdConfig cmd)
        {
            string cmdName   = string.IsNullOrEmpty(cmd.Name) ? ModbusDriverPhrases.UnnamedCommand : cmd.Name;
            string blockName = ModbusUtils.GetDataBlockName(cmd.DataBlock);

            if (cmd.DataBlock == DataBlock.Custom)
            {
                return(string.Format("{0} ({1})", cmdName, blockName));
            }
            else
            {
                string addrRange = ModbusUtils.GetAddressRange(cmd.Address,
                                                               cmd.ElemCnt * ModbusUtils.GetQuantity(cmd.ElemType),
                                                               template.Options.ZeroAddr, template.Options.DecAddr);
                return(string.Format("{0} ({1}, {2})", cmdName, blockName, addrRange));
            }
        }