Horizon – Diff between revs 22 and 23
?pathlinks?
Rev 22 | Rev 23 | |||
---|---|---|---|---|
Line 93... | Line 93... | |||
93 | CancellationToken cancellationToken) : this() |
93 | CancellationToken cancellationToken) : this() |
|
94 | { |
94 | { |
|
95 | _mainForm = mainForm; |
95 | _mainForm = mainForm; |
|
96 | _snapshotDatabase = snapshotDatabase; |
96 | _snapshotDatabase = snapshotDatabase; |
|
97 | _snapshotDatabase.SnapshotCreate += SnapshotManager_SnapshotCreate; |
97 | _snapshotDatabase.SnapshotCreate += SnapshotManager_SnapshotCreate; |
|
- | 98 | _snapshotDatabase.SnapshotTransferReceived += _snapshotDatabase_SnapshotTransferReceived; |
||
Line 98... | Line 99... | |||
98 | |
99 | |
|
99 | _cancellationTokenSource = |
100 | _cancellationTokenSource = |
|
100 | CancellationTokenSource.CreateLinkedTokenSource(_cancellationToken, cancellationToken); |
101 | CancellationTokenSource.CreateLinkedTokenSource(_cancellationToken, cancellationToken); |
|
101 | _cancellationToken = _cancellationTokenSource.Token; |
102 | _cancellationToken = _cancellationTokenSource.Token; |
|
Line 111... | Line 112... | |||
111 | { |
112 | { |
|
112 | components.Dispose(); |
113 | components.Dispose(); |
|
113 | } |
114 | } |
|
Line 114... | Line 115... | |||
114 | |
115 | |
|
- | 116 | _snapshotDatabase.SnapshotCreate -= SnapshotManager_SnapshotCreate; |
||
Line 115... | Line 117... | |||
115 | _snapshotDatabase.SnapshotCreate -= SnapshotManager_SnapshotCreate; |
117 | _snapshotDatabase.SnapshotTransferReceived -= _snapshotDatabase_SnapshotTransferReceived; |
|
116 | |
118 | |
|
117 | _horizonServiceBrowser.ServiceAdded -= OnHorizonServiceBrowserOnServiceAdded; |
119 | _horizonServiceBrowser.ServiceAdded -= OnHorizonServiceBrowserOnServiceAdded; |
|
Line 511... | Line 513... | |||
511 | dataGridView.Rows[index].Cells["NameColumn"].Value = snapshotCreateSuccessEventArgs.Name; |
513 | dataGridView.Rows[index].Cells["NameColumn"].Value = snapshotCreateSuccessEventArgs.Name; |
|
512 | dataGridView.Rows[index].Cells["PathColumn"].Value = snapshotCreateSuccessEventArgs.Path; |
514 | dataGridView.Rows[index].Cells["PathColumn"].Value = snapshotCreateSuccessEventArgs.Path; |
|
513 | dataGridView.Rows[index].Cells["HashColumn"].Value = snapshotCreateSuccessEventArgs.Hash; |
515 | dataGridView.Rows[index].Cells["HashColumn"].Value = snapshotCreateSuccessEventArgs.Hash; |
|
514 | dataGridView.Rows[index].DefaultCellStyle.BackColor = snapshotCreateSuccessEventArgs.Color; |
516 | dataGridView.Rows[index].DefaultCellStyle.BackColor = snapshotCreateSuccessEventArgs.Color; |
|
Line -... | Line 517... | |||
- | 517 | |
||
- | 518 | dataGridView.Rows[index].Selected = true; |
||
- | 519 | dataGridView.Sort(dataGridView.Columns["TimeColumn"], ListSortDirection.Descending); |
||
- | 520 | }); |
||
- | 521 | break; |
||
- | 522 | case SnapshotCreateFailureEventArgs snapshotCreateFailure: |
||
- | 523 | Log.Warning(snapshotCreateFailure.Exception, "Could not create snapshot."); |
||
- | 524 | break; |
||
- | 525 | } |
||
- | 526 | } |
||
- | 527 | |
||
- | 528 | |
||
- | 529 | private void _snapshotDatabase_SnapshotTransferReceived(object sender, SnapshotCreateEventArgs e) |
||
- | 530 | { |
||
- | 531 | switch (e) |
||
- | 532 | { |
||
- | 533 | case SnapshotCreateSuccessEventArgs snapshotCreateSuccessEventArgs: |
||
- | 534 | dataGridView1.InvokeIfRequired(dataGridView => |
||
- | 535 | { |
||
- | 536 | var index = dataGridView.Rows.Add(); |
||
- | 537 | |
||
- | 538 | dataGridView.Rows[index].Cells["TimeColumn"].Value = |
||
- | 539 | DateTime.Parse(snapshotCreateSuccessEventArgs.Time); |
||
- | 540 | dataGridView.Rows[index].Cells["NameColumn"].Value = snapshotCreateSuccessEventArgs.Name; |
||
- | 541 | dataGridView.Rows[index].Cells["PathColumn"].Value = snapshotCreateSuccessEventArgs.Path; |
||
- | 542 | dataGridView.Rows[index].Cells["HashColumn"].Value = snapshotCreateSuccessEventArgs.Hash; |
||
- | 543 | dataGridView.Rows[index].DefaultCellStyle.BackColor = snapshotCreateSuccessEventArgs.Color; |
||
- | 544 | |
||
515 | |
545 | dataGridView.Rows[index].Selected = true; |
|
516 | dataGridView.Sort(dataGridView.Columns["TimeColumn"], ListSortDirection.Descending); |
546 | dataGridView.Sort(dataGridView.Columns["TimeColumn"], ListSortDirection.Descending); |
|
517 | }); |
547 | }); |
|
518 | break; |
548 | break; |
|
519 | case SnapshotCreateFailureEventArgs snapshotCreateFailure: |
549 | case SnapshotCreateFailureEventArgs snapshotCreateFailure: |
|
Line 1871... | Line 1901... | |||
1871 | } |
1901 | } |
|
1872 | } |
1902 | } |
|
1873 | } |
1903 | } |
|
Line 1874... | Line 1904... | |||
1874 | |
1904 | |
|
- | 1905 | #endregion |
||
- | 1906 | |
||
- | 1907 | private void copyHashToolStripMenuItem_Click(object sender, EventArgs e) |
||
- | 1908 | { |
||
- | 1909 | var row = GetSelectedDataGridViewRows(dataGridView1).FirstOrDefault(); |
||
- | 1910 | if (row == null) |
||
- | 1911 | { |
||
- | 1912 | return; |
||
- | 1913 | } |
||
- | 1914 | |
||
- | 1915 | Clipboard.SetText($"{row.Cells["HashColumn"].Value}"); |
||
- | 1916 | |
||
1875 | #endregion |
1917 | } |
|
1876 | } |
1918 | } |
|
1877 | } |
1919 | } |