From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../ImportViewModel.cs | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs b/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs new file mode 100644 index 0000000..34daacf --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels/ImportViewModel.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Generic; +using Microsoft.Win32; + +namespace Gestor.Application.ViewModels; + +public class ImportViewModel : BaseViewModel +{ + private ObservableCollection _arquivos = new ObservableCollection(); + + public ObservableCollection Arquivos + { + get + { + return _arquivos; + } + set + { + _arquivos = value; + OnPropertyChanged("Arquivos"); + } + } + + public void CarregarArquivos() + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + OpenFileDialog val = new OpenFileDialog + { + Title = "Selecione o PDF", + Filter = "Arquivos PDF|*.pdf", + Multiselect = true + }; + if (((CommonDialog)val).ShowDialog().GetValueOrDefault()) + { + Arquivos = new ObservableCollection(); + ((FileDialog)val).FileNames.ToList().ForEach(delegate(string x) + { + Arquivos.Add(new Arquivo + { + Nome = x, + Processo = 0 + }); + }); + } + } + + public void Importar() + { + new TaskFactory().StartNew(() => Importar(Arquivos.ToList())); + } + + public async Task Importar(List arquivos) + { + arquivos.ForEach(async delegate(Arquivo x) + { + await Import(x); + }); + return true; + } + + public async Task Import(Arquivo arquivo) + { + await Task.Run(delegate + { + try + { + Process process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "C:\\AggerSeguros\\Agger.Import201911261630\\Agger.ImportPDF.exe", + Arguments = $" {((DomainBase)Recursos.Empresa).Id} {((DomainBase)Recursos.Usuario).Id} NOVOGESTOR {arquivo.Nome}", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + } + }; + process.Start(); + process.WaitForExit(); + string text = process.StandardError.ReadToEnd(); + string text2 = process.StandardOutput.ReadToEnd(); + if (process.ExitCode != 0) + { + throw new Exception("netsh exit code: " + process.ExitCode + " " + ((!string.IsNullOrEmpty(text)) ? (" " + text) : "") + " " + ((!string.IsNullOrEmpty(text2)) ? (" " + text2) : "")); + } + } + catch (Exception) + { + } + }); + } +} -- cgit v1.2.3