Ejemplo n.º 1
0
        public async void ImportCSV(object parameter)
        {
            App.AppLogger.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Import CSV.");

            FileData file = await CrossFilePicker.Current.PickFile(new string[] { ".csv" });

            if (file != null)
            {
                string destinationPath = file.FilePath;
                byte[] fileData        = await devoctomy.cachy.Framework.Native.Native.FileHandler.ReadAsync(destinationPath);

                string           fileStringData = System.Text.Encoding.UTF8.GetString(fileData);
                CSVImporter      import         = new CSVImporter(fileStringData);
                Common.CSVFormat autoFormat     = await import.DetermineFormat();

                App.Controller.ShowPopup("vault.importsource",
                                         new KeyValuePair <string, object>("Format", autoFormat),
                                         new KeyValuePair <string, object>("CSVImporter", import));
            }
        }