/// <summary> /// настраиваем технологический параметр /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tune_btn_Click(object sender, EventArgs e) { if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0) { TParameter sel_par = listView1.SelectedItems[0].Tag as TParameter; if (sel_par != null) { SelectParameterForm frm = new SelectParameterForm(); if (frm.ShowDialog(this) == DialogResult.OK) { Parameter selected = frm.SelectedParameter; if (selected != null) { if (selected.Channel != null) { sel_par.Identifier = selected.Identifier; //sel_par.PNumber = selected.Channel.Number; listView1.SelectedItems[0].SubItems[1].Text = selected.Name; } else { MessageBox.Show(this, "Выбранный параметр не настроен.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } } }
/// <summary> /// отображаем данные /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Technology_onComplete(object sender, EventArgs e) { bool blocked = false; try { if (mutex.WaitOne(1000, false)) { blocked = true; foreach (DataGridViewRow row in dataGridView10.Rows) { if (row.Index < dataGridView10.Rows.Count - 1) { TParameter parameter = row.Tag as TParameter; if (parameter != null) { row.Cells[2].Value = string.Format("{0:F3}", parameter.Value); } } } } } finally { if (blocked) { mutex.ReleaseMutex(); } } }
/// <summary> /// Настроить таблицу /// </summary> protected void InitializeTable() { for (int i = 0; i < 56; i++) { if (i > -1 && i < _app.Technology.Parameters.Length) { TParameter parameter = _app.Technology.Parameters[i]; if (parameter != null) { ListViewItem item = new ListViewItem(parameter.Name); //Parameter par = _app.GetParameter(parameter.PNumber); Parameter par = _app.GetParameter(parameter.Identifier); if (par != null) { ListViewItem.ListViewSubItem sub = new ListViewItem.ListViewSubItem(item, par.Name); item.SubItems.Add(sub); } else { ListViewItem.ListViewSubItem sub = new ListViewItem.ListViewSubItem(item, "не определен"); item.SubItems.Add(sub); } item.Tag = parameter; listView1.Items.Add(item); } } } }
/// <summary> /// очистить параметр /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0) { TParameter s_par = listView1.SelectedItems[0].Tag as TParameter; if (s_par != null) { //s_par.SNumber = -1; s_par.Identifier = Guid.Empty; listView1.SelectedItems[0].SubItems[1].Text = string.Empty; } } }
public IdealRashodForm(TParameter parameter) { InitializeComponent(); if (parameter is P0109) { p109 = parameter as P0109; } else p112 = parameter as P0112; _app = SgtApplication.CreateInstance(); listView1.ListViewItemSorter = new ListComparer(); }
/// <summary> /// сбрасываем настройки технологического параметра /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void clear_btn_Click(object sender, EventArgs e) { if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0) { TParameter sel_par = listView1.SelectedItems[0].Tag as TParameter; if (sel_par != null) { //sel_par.PNumber = -1; sel_par.Identifier = Guid.Empty; sel_par.Calculate(float.NaN); listView1.SelectedItems[0].SubItems[1].Text = "не определен"; } } }
public IdealRashodForm(TParameter parameter) { InitializeComponent(); if (parameter is P0109) { p109 = parameter as P0109; } else { p112 = parameter as P0112; } _app = SgtApplication.CreateInstance(); listView1.ListViewItemSorter = new ListComparer(); }
/// <summary> /// добавить технологический параметр в список /// </summary> /// <param name="parameter"></param> protected void InsertParameter(TParameter parameter) { ListViewItem item = new ListViewItem(parameter.Name); ListViewItem.ListViewSubItem s_name = new ListViewItem.ListViewSubItem(item, string.Empty); if (parameter.SNumber != -1) { //Parameter par = _app.GetParameter(parameter.SNumber); Parameter par = _app.GetParameter(parameter.Identifier); if (par != null) { s_name.Text = par.Name; } } if (s_name != null) { item.SubItems.Add(s_name); } item.Tag = parameter; listView1.Items.Add(item); }
/// <summary> /// Загрузить данные в технологический параметр /// </summary> /// <param name="prms">Список технологических параметров</param> /// <param name="node">Узел в котором содержаться данные</param> /// <param name="id">Идентификатор параметра</param> protected void LdrPrm(TParameter[] prms, XmlNode node, String id) { try { foreach (TParameter prm in prms) { if (prm != null) { if (prm.UnigueClassName == id) { prm.Load(node); break; } } } } catch { } }