示例#1
0
        /// <summary>
        /// Завершен цикл опроса устройств
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Serial_OnStaticComplete(Object sender, CommutatorEventArgs 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)
                        {
                            Parameter parameter = row.Tag as Parameter;
                            if (parameter != null)
                            {
                                row.Cells[2].Value = parameter.FormattedCurrentValue;
                            }
                        }
                    }
                }
            }
            finally
            {
                if (blocked)
                {
                    mutex.ReleaseMutex();
                }
            }
        }
示例#2
0
 /// <summary>
 /// Завершен цикл опроса устройств
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Serial_OnStaticComplete(Object sender, CommutatorEventArgs 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)
                 {
                     Parameter parameter = row.Tag as Parameter;
                     if (parameter != null)
                     {
                         row.Cells[2].Value = parameter.FormattedCurrentValue;
                     }
                 }
             }
         }
     }
     finally
     {
         if (blocked) mutex.ReleaseMutex();
     }
 }