Example #1
0
        public static ITag NewTag(string type)
        {
            switch (type)
            {
            case "Digital":
                TagDigital tagDigital = new TagDigital();
                return(tagDigital);

            case "Analog":
                TagAnalog tagAnalog = new TagAnalog();
                return(tagAnalog);

            case "Sql":
                TagSql tagSql = new TagSql();
                return(tagSql);

            default:
                return(null);
            }
        }
Example #2
0
        void ButtonOkClick(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;

            _items = new TagAnalog[dataGridView1.RowCount - 1];
            int idx = 0;

            IDriver[]        drivers = DriverManager.Instance.Drivers.ToArray();
            ISignalCondition sc      = null;

            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                _items[idx]             = new TagAnalog();
                _items[idx].Name        = dataGridView1.Rows[i].Cells[0].Value.ToString();
                _items[idx].Description = dataGridView1.Rows[i].Cells[1].Value.ToString();
                foreach (IDriver driver in drivers)
                {
                    if (driver.ToString() == dataGridView1.Rows[i].Cells[2].Value.ToString())
                    {
                        _items[idx].Driver = driver;
                    }
                }
                _items[idx].Address    = dataGridView1.Rows[i].Cells[3].Value.ToString();
                _items[idx].Historical = Convert.ToBoolean(dataGridView1.Rows[i].Cells[4].Value.ToString());
                if (dataGridView1.Rows[i].Cells[5].Value.ToString().Equals(""))
                {
                    sc = null;
                }
                else
                {
                    sc = new SignalCondition16383();
                }
                _items[idx].SignalCondition = sc;
                _items[idx].Min             = dataGridView1.Rows[i].Cells[6].Value.ToString();
                _items[idx].Max             = dataGridView1.Rows[i].Cells[7].Value.ToString();

                idx++;
            }

            return;
        }
		void ButtonOkClick(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.OK;
			
			_items = new TagAnalog[dataGridView1.RowCount -1];
			int idx = 0;

			IDriver[] drivers = DriverManager.Instance.Drivers.ToArray();
			ISignalCondition sc = null;
			for (int i = 0; i < dataGridView1.RowCount - 1; i++)
			{
				_items[idx] = new TagAnalog();
				_items[idx].Name        = dataGridView1.Rows[i].Cells[0].Value.ToString();
				_items[idx].Description = dataGridView1.Rows[i].Cells[1].Value.ToString();
				foreach (IDriver driver in drivers)
				{
					if (driver.ToString() == dataGridView1.Rows[i].Cells[2].Value.ToString())
					{
						_items[idx].Driver = driver;
					}
				}
				_items[idx].Address     = dataGridView1.Rows[i].Cells[3].Value.ToString();
				_items[idx].Historical  = Convert.ToBoolean(dataGridView1.Rows[i].Cells[4].Value.ToString());
				if (dataGridView1.Rows[i].Cells[5].Value.ToString().Equals(""))
				{
					sc = null;
				}
				else
				{
					sc = new SignalCondition16383();
				}
				_items[idx].SignalCondition = sc;
				_items[idx].Min = dataGridView1.Rows[i].Cells[6].Value.ToString();
				_items[idx].Max = dataGridView1.Rows[i].Cells[7].Value.ToString();
				
				idx++;
			}
			
			return;
		}
Example #4
0
		public static ITag NewTag(string type)
		{
			switch (type)
			{
				case "Digital":
					TagDigital tagDigital = new TagDigital();
					return tagDigital;
				case "Analog":
					TagAnalog tagAnalog = new TagAnalog();
					return tagAnalog;
				case "Sql":
					TagSql tagSql = new TagSql();
					return tagSql;
				default:
					return null;
			}
		}