private void OnDiskAddedMountDiskCryptorDisk(DiskCryptor.DriveInfo driveInfo) { if (_cachedDriveInfo == null) { return; } //find newly added drive var found = _cachedDriveInfo.FirstOrDefault(d => d.ToString() == driveInfo.ToString()); if (found == null) { _diskCryptor.OnDisksAdded -= OnDiskAddedMountDiskCryptorDisk; _cachedDriveInfo = null; Debug.WriteLine("On Disk Added: " + driveInfo.Description()); _diskCryptor.ExecuteMount(driveInfo, _selectedDriveLetterForMount, GetPasswordFunc()); ReloadDriveData(1000); } }
private void m_btnMount_Click(object sender, EventArgs e) { ExecuteClickAction(() => { m_lblSelected.Text = "Selected: ???"; if (m_listDrives.SelectedIndices.Count <= 0) { return; } if (string.IsNullOrWhiteSpace(m_txtPwd.Text)) { MessageBox.Show(this, "Password is empty"); return; } DiskCryptor.DriveInfo drive = m_listDrives.SelectedItems[0].Tag as DiskCryptor.DriveInfo; _diskCryptor.ExecuteMount(drive, m_cmbAvailableDriveLetters.SelectedItem.ToString(), m_txtPwd.Text); ReloadDriveData(); }, sender); }