private static bool IsItemMatchKey(SymbolTableItemModel item, string key)
        {
            if (item.SignalType.ToLower().Equals(key.ToLower()))
            {
                return(true);
            }
            if (item.SignalComment.ToLower().Contains(key.ToLower()))
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Создание символьной таблицы из одномерной коллекции строк (колонки таблицы)
        /// </summary>
        /// <param name="fromList">Колонка таблицы</param>
        public SymbolTableModel(IEnumerable <string> fromList)
        {
            Symbols = new ObservableCollection <SymbolTableItemModel>();

            int i = 1;

            foreach (var line in fromList)
            {
                var item = new SymbolTableItemModel();

                item.SignalName = line;
                Symbols.Add(item);

                i++;
            }
        }
Exemple #3
0
 public SymbolItemModel(SymbolTableItemModel source)
 {
     this.SignalDataType = source.SignalDataType;
     this.Codename       = source.Codename;
     this.DbArrayIndex   = source.DbArrayIndex;
     this.DbArrayName    = source.DbArrayName;
     this.DbFullName     = source.DbFullName;
     this.DeviceNumber   = source.DeviceNumber;
     this.DeviceTag      = source.DeviceTag;
     this.DeviceType     = source.DeviceType;
     this.Etc            = source.Etc;
     this.SignalAdress   = source.SignalAdress;
     this.SignalComment  = source.SignalComment;
     this.SignalName     = source.SignalName;
     this.Codename       = source.Codename;
     this.ItemId         = source.ItemId;
 }
        /// <summary>
        /// Создание символьной таблицы из массива, соответствующего таблице Excel
        /// </summary>
        /// <param name="arr">Символьная таблица в виде массива массива строк [4,xxx]</param>
        public SymbolTableModel(string[,] arr)
        {
            Symbols = new ObservableCollection <SymbolTableItemModel>();

            string s = arr[1, 1];

            for (int row = 0; row < arr.GetLength(0); row++)
            {
                var item = new SymbolTableItemModel();

                item.SignalName     = arr[row, 0];
                item.SignalAdress   = arr[row, 1];
                item.SignalDataType = arr[row, 2];
                item.SignalComment  = arr[row, 3];
                item.SignalType     = arr[row, 4];
                item.Codename       = arr[row, 5];
                item.SystemNumber   = arr[row, 6];
                item.DeviceType     = arr[row, 7];
                item.DeviceNumber   = arr[row, 8];
                item.Etc            = arr[row, 9];
                item.DeviceTag      = arr[row, 10];

                item.DbFullName = item.SystemNumber;

                try
                {
                    item.DbArrayIndex = int.Parse(arr[row, 8]);
                }
                catch (Exception)
                {
                    item.DbArrayIndex = 0;
                }


                Symbols.Add(item);
            }
        }