The BackgroundWorker_DoWork method.
44 MainForm.Instance.dgvDataSources.Invoke(
new MethodInvoker(delegate { MainForm.Instance.dgvDataSources.Rows.Clear(); }));
46 if (MainForm.CurrentDevices != null)
47 MainForm.CurrentDevices.Clear();
48 MainForm.CurrentDevices = MainForm.CurrentSystem.GetDevices();
50 if (MainForm.CurrentDataSources != null)
51 MainForm.CurrentDataSources.Clear();
54 MainForm.CurrentDataSources = MainForm.CurrentSystem.GetDataSources();
56 var dataSourceTotal = MainForm.CurrentDataSources.Count;
57 var dataSourceNum = 0;
58 foreach (var dataSource
in MainForm.CurrentDataSources)
64 var progress = ((decimal)dataSourceNum / dataSourceTotal) * 100;
65 MainForm.Instance.bgWorker.ReportProgress((
int)progress, null);
67 if (dataSource.DataInterfaces.Any(item => (
int) item.RenderType > 0 && (
int) item.RenderType <= 4))
69 camIcon = dataSource.State ==
DataSource.
States.Offline ? Resources.cam_pano_offline : Resources.cam_pano;
74 camIcon = dataSource.State ==
DataSource.
States.Offline ? Resources.cam_ptz_offline : Resources.cam_ptz;
76 camIcon = dataSource.State ==
DataSource.
States.Offline ? Resources.cam_fixed_offline : Resources.cam_fixed;
79 object[] row = { camIcon, dataSource.Name, dataSource.Number.ToString() };
81 var newRow = MainForm.Instance.dgvDataSources.Rows[index];
82 newRow.Tag = dataSource;
85 MainForm.Instance.BeginInvoke((MethodInvoker)delegate
88 MainForm.Instance.eventsToolStripMenuItem.Enabled =
true;
89 MainForm.Instance.manageToolStripMenuItem.Enabled =
true;
90 MainForm.Instance.btnSeek.Enabled =
true;
91 MainForm.Instance.btnPause.Enabled =
true;
92 MainForm.Instance.btnPlay.Enabled =
true;
93 MainForm.Instance.btnStop.Enabled =
true;
94 MainForm.Instance.btnSnapshot.Enabled =
true;
95 MainForm.Instance.btnRefreshDataSources.Enabled =
true;
static void ChangeProgressViewState(bool isVisible)
The ChangeProgressViewState method.
static int AddRowToGridView(object[] item)
The AddRowToGridView method.