private void PopulateFilesList() { ProtectedFiles.GetProtectedFilesFromRegistryKey(); filesList.ItemsSource = ProtectedFiles.files; foreach (var f in ProtectedFiles.files) { var path = "\\??\\" + f.Path; ProtectFile(path, (ushort)path.Length); } }
private async void RemoveButtonClick(object sender, RoutedEventArgs e) { FileDTO selectedFile = filesList.SelectedItem as FileDTO; if (selectedFile != null) { ProtectedFiles.RemoveFile(selectedFile); } else { await this.ShowMessageAsync("No file was selected", "Please go back and select a file to be removed"); } }
private void BrowseButtonClick(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog openFileDlg = new Microsoft.Win32.OpenFileDialog(); openFileDlg.Multiselect = true; openFileDlg.Filter = "All files (*.*)|*.*"; Nullable <bool> result = openFileDlg.ShowDialog(); if (result == true) { ProtectedFiles.AddFile(openFileDlg.FileName); var path = "\\??\\" + openFileDlg.FileName; ProtectFile(path, (ushort)path.Length); } }