示例#1
0
        // when grid selected row changes call the DisplayPhotos4SHA form passing in the SHA value
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            string _fileExt = this.dataGridView1.SelectedRows[0].Cells["FileExt"].Value.ToString();

            _fileExt = _fileExt.Substring(startIndex: _fileExt.Length - 4);

            if (!_fileExt.Equals(".jpg", StringComparison.OrdinalIgnoreCase) && !_fileExt.Equals(".png", StringComparison.OrdinalIgnoreCase))
            {
                MessageBox.Show($"ERROR - File type {_fileExt} cannot be displayed.");
                return;
            }

            // get the SHA value from the selected grid row
            string SHA = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();

            // call DisplayPhotos4SHA passing in the SHA of the selected duplicates
            Form displayPhotos4SHA = new DisplayPhotos4SHA(SHA);

            if (!displayPhotos4SHA.IsDisposed)
            {
                displayPhotos4SHA.ShowDialog();
            }

            // refresh the datagrid in case DisplayPhotos4SHA has deleted 2 CheckSumDups rows
            this.dataGridView1.Refresh();
            this.toolStripStatusLabel1.Text = $"{this.dataGridView1.RowCount} CheckSumDups rows.";
        }
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count > 0)
            {
                // get the SHA value from the selected grid row
                string SHA = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();

                // call DisplayPhotos4SHA passing in the SHA of the selected duplicates
                Form displayPhotos4SHA = new DisplayPhotos4SHA(SHA);

                if (!displayPhotos4SHA.IsDisposed)
                {
                    displayPhotos4SHA.ShowDialog();
                }

                // refresh the datagrid
                this.dataGridView1.Refresh();
            }
        }