Exemple #1
0
        private void Export(FileType fileType)
        {
            var    fileInfo = new SalaryFileInfo(fileType);
            string filePath = dialogService.ShowSaveFileDialog(fileInfo.Extension, string.Format(Resources.OpenFileDialogText, SalaryFileInfo.CsvDescription, SalaryFileInfo.CsvExtension, SalaryFileInfo.XmlDescription, SalaryFileInfo.XmlExtension));

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            ExportAsync(fileType, filePath);
        }
Exemple #2
0
        private async void Import()
        {
            string filePath = dialogService.ShowOpenFileDialog(string.Format(Resources.OpenFileDialogText, SalaryFileInfo.CsvDescription, SalaryFileInfo.CsvExtension, SalaryFileInfo.XmlDescription, SalaryFileInfo.XmlExtension));

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            string extension = Path.GetExtension(filePath).Substring(1);
            var    fileInfo  = new SalaryFileInfo(extension);

            IEnumerable <Salary> importedCollection = await ImportAsync(filePath, fileInfo.FileType);

            AddSalaries(importedCollection);
        }