private void AddFileBtn_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog { Multiselect = true }; if (openFileDialog.ShowDialog() == true) { if (!Directory.Exists(Constants.AdditionalDocumentsDirectory)) { Directory.CreateDirectory(Constants.AdditionalDocumentsDirectory); } foreach (var ofdFileName in openFileDialog.FileNames) { var possiblePathToFile = Path.GetFullPath(Path.Combine(Constants.AdditionalDocumentsDirectory + "/" + Path.GetFileName(ofdFileName))); if (!File.Exists(possiblePathToFile)) { File.Copy(ofdFileName, possiblePathToFile); } var fileInfo = new FileInfo(possiblePathToFile); if (!LocalFiles.Contains(fileInfo, new FileInfoEqualityComparer())) { LocalFiles.Add(fileInfo); attachedFilesListView.Items.Add(new ListViewItem(new[] { "Number of contract", fileInfo.Name, fileInfo.FullName })); } } } IsDirty = true; }
public async Task StopRoamingFile(IBindableStorageFile file) { using (await f_lock.Acquire()) { if (!LocalFiles.Contains(file)) { //Backing values string oldPath = GetParentFolder(file.BackingFile); string value = await _ivService.GetValue(oldPath, FileLocation.Roamed); await _ivService.Remove(oldPath, FileLocation.Roamed); await file.BackingFile.MoveAsync(_localFolder, file.BackingFile.Name, NameCollisionOption.GenerateUniqueName); await _ivService.Add(GetParentFolder(file.BackingFile), value, FileLocation.Local); RoamedFiles.Remove(file); //UI file.IsRoamed = false; LocalFiles.Add(file); } } }