private void BackButton_Click(object sender, RoutedEventArgs e) { if (FilesSelected != null) { FilesSelected.Invoke(this, null); } }
public void SetFileToProcess() { //Select all imported files. Yes, this is dumb. FilesSelected.Visible = false; for (int i = 0; i < FilesSelected.Items.Count; i++) { FilesSelected.SetSelected(i, true); } FilesSelected.Visible = true; //Create array and fill with the strings of each file location String[] selectedFileList = new string[FilesSelected.Items.Count]; FilesSelected.SelectedItems.CopyTo(selectedFileList, 0); //Add each line of this array to a list. Why? Why not. for (int i = 0; i < selectedFileList.Length; i++) { if (!testFileList.Any(e => e.Equals(selectedFileList[i]))) //add only if DNE { if (!String.IsNullOrEmpty(selectedFileList[i])) { { testFileList.Add(selectedFileList[i]); } } } } MessageBox.Show(Convert.ToString(selectedFileList.Length), "Selected files in array are:"); }
private async void AddFileList() { try { var result = await fileSelectService.SelectFile(); if (result.Name != null) { FilesSelected.Add( new DocumentRequiredViewModel { Base64 = result.File, NameDocument = result.Name, Extension = fileSelectService.MimeType(result.Extension) }); if (FilesSelected.Count() >= MaxFiles) { ListFilled = true; } } } catch (Exception ex) { ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(ex); } }
private async void DeleteFileList(DocumentRequiredViewModel file) { if (await dialogService.ShowConfirm("", "¿Deseas eliminar este archivo?")) { FilesSelected.Remove(file); ListFilled = false; } }
private void FillMainReposEventHandler(object sender, FilesSelected args) { try { ScriptRepository.Create(args.ScriptNameLeft, args.ScriptNameRight); } catch (System.Exception mainRepoFillException) { MessageBox.Show(mainRepoFillException.ToString()); } ShowContent(); }
private void NextButton_Click(object sender, RoutedEventArgs e) { if (FilesListBox.SelectedItems == null || FilesListBox.SelectedItems.Count == 0) { return; } if (FilesSelected != null) { var results = new ObservableCollection <string>(); foreach (var item in FilesListBox.SelectedItems) { results.Add(((FileEntry)item).File); } FilesSelected.Invoke(this, results); } }
/// <summary> /// Carga los nodos hijos de un árbol /// </summary> private void LoadNodes(TreeViewItemsViewModelCollection nodes, TreeViewItemViewModel nodeParent, FileModelCollection files) { foreach (FileModel file in files) { TreeViewItemViewModel node; // Crea un nuevo nodo node = new TreeViewItemViewModel(file.FullFileName, file.Name, nodeParent, false, file); node.IsExpanded = true; // Selecciona el nodo if (files != null) { node.IsChecked = FilesSelected.ExistsByFileName(file.FullFileName); } // Lo añade al árbol if (nodeParent == null) { nodes.Add(node); } else { nodeParent.Children.Add(node); } // Añade el manejador de eventos if (node != null) { node.PropertyChanged += (sender, evntArgs) => { if (evntArgs.PropertyName.EqualsIgnoreCase("IsChecked") || evntArgs.PropertyName.EqualsIgnoreCase("IsSelected")) { IsTreeeUpdated = true; } } } ; // Añade los nodos hijo if (file.IsFolder) { LoadNodes(nodes, node, file.Files); } } }
/** * A event handler to add test button. */ private void AddTest_Click(object sender, RoutedEventArgs e) { string testDriver = DriverSelected.SelectedItem.ToString(); xmlStructure.Append(testDriver); xmlStructure.Append(":"); XmlPreview.Text += "\n" + DriverSelected.SelectedItem.ToString(); foreach (var tf in FilesSelected.SelectedItems) { xmlStructure.Append(tf); xmlStructure.Append(","); XmlPreview.Text += "\n\t" + tf.ToString(); } FilesSelected.UnselectAll(); DriverSelected.UnselectAll(); Clear.IsEnabled = true; Build.IsEnabled = true; xmlStructure.Append(";"); }
public async Task FilesSelectedAsync(SelectedFile[] files) { if (files?.Length > 0) { if (blobContainer is null) { blobContainer = new FileBlobContainer(JsRuntime, fileSelect); } else { await blobContainer.ResetAsync().ConfigureAwait(false); } selectedFiles = files; // clone var eventArgFiles = new SelectedFile[files.Length]; Array.Copy(files, eventArgFiles, files.Length); await FilesSelected.InvokeAsync(eventArgFiles).ConfigureAwait(false); await FilesChanged.InvokeAsync(new FileSelectChangeArgs(this, eventArgFiles)); } }