private void cmdDeviceComponentChange_Performance_Click(object sender, EventArgs e)
 {
     List<ComponentPackageType> _componentPackageLst = new List<ComponentPackageType>();
     for (int row = 0; row < dgvReportDeviceComponentChange.Rows.Count; row++)
     {
         try
         {
             if (
                 this.dgvReportDeviceComponentChange.Rows[row].Cells[0].Value != null &&
                 this.dgvReportDeviceComponentChange.Rows[row].Cells[1].Value != null &&
                 this.dgvReportDeviceComponentChange.Rows[row].Cells[2].Value != null &&
                 this.dgvReportDeviceComponentChange.Rows[row].Cells[3].Value != null &&
                 (Convert.ToString((dgvReportDeviceComponentChange.Rows[row].Cells[7] as DataGridViewComboBoxCell).FormattedValue.ToString()) == "Add" || Convert.ToString((dgvReportDeviceComponentChange.Rows[row].Cells[7] as DataGridViewComboBoxCell).FormattedValue.ToString()) == "Remove")
                 )
             {
                 ComponentType[] Arrcomponents = new ComponentType[1];
                 ComponentPackageType ComponentPackage = new ComponentPackageType();
                 ComponentPackage.DeviceGUID = this.dgvReportDeviceComponentChange.Rows[row].Cells[0].Value.ToString();
                 ComponentType oComponentType = new ComponentType();
                 oComponentType.SerialNumber = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[1].Value);
                 oComponentType.Type = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[2].Value);
                 oComponentType.Manufacturer = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[3].Value);
                 oComponentType.Model = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[4].Value);
                 oComponentType.Description = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[5].Value);
                 oComponentType.UserName = Convert.ToString(this.dgvReportDeviceComponentChange.Rows[row].Cells[6].Value);
                 oComponentType.Action = Convert.ToString((this.dgvReportDeviceComponentChange.Rows[row].Cells[7] as DataGridViewComboBoxCell).FormattedValue.ToString()) == "Add" ? 0 : 1;
                 oComponentType.StatusDate = Convert.ToDateTime(this.dgvReportDeviceComponentChange.Rows[row].Cells[8].Value.ToString());
                 Arrcomponents[0] = oComponentType;
                 ComponentPackage.Components = Arrcomponents;
                 _componentPackageLst.Add(ComponentPackage);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     try
     {
         int i = 0;
         foreach (var item in _componentPackageLst)
         {
             i = i + 1;
             Thread SendComponentPackageChange = new Thread(() => { proxy.ReportDeviceComponentChanges(item); });
             SendComponentPackageChange.Name = "Thread" + i.ToString();
             SendComponentPackageChange.Start();
             System.Threading.Thread.Sleep(20);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     System.Threading.Thread.Sleep(2000);
     _ManualResetEvent.Set();
     System.Threading.Thread.Sleep(2000);
     _ManualResetEvent.Reset();
 }
Esempio n. 2
0
 public void ReportDeviceComponentChanges(ComponentPackageType ComponentPackage)
 {
     base.Channel.ReportDeviceComponentChanges(ComponentPackage);
 }
 public void LogAndSendComponentPackageChange(ComponentPackageType _ComponentPackageType, string threadid)
 {
     _ManualResetEvent.WaitOne();
     try
     {
         //DumpLogMessage(new LogMessage(_ComponentPackageType.DeviceGUID, "Started Device ComponentPackage change for " + threadid + " @ " + System.DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")));
         proxy.ReportDeviceComponentChanges(_ComponentPackageType);
         //DumpLogMessage(new LogMessage(_ComponentPackageType.DeviceGUID, "Ended Device ComponentPackage change for " + threadid + " @ " + System.DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }