Linux compat

This commit is contained in:
Michael Bucari-Tovo 2022-07-24 14:46:27 -06:00
parent 683c221ca8
commit 3fc1da66de
4 changed files with 18 additions and 13 deletions

View file

@ -10,7 +10,7 @@ namespace LibationAvalonia.Views
{
private void Configure_Export() { }
public void exportLibraryToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
public async void exportLibraryToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
try
{
@ -22,26 +22,26 @@ namespace LibationAvalonia.Views
saveFileDialog.Filters.Add(new FileDialogFilter { Name = "CSV files (*.csv)", Extensions = new() { "csv" } });
saveFileDialog.Filters.Add(new FileDialogFilter { Name = "JSON files (*.json)", Extensions = new() { "json" } });
saveFileDialog.Filters.Add(new FileDialogFilter { Name = "All files (*.*)", Extensions = new() { "*" } });
// FilterIndex is 1-based, NOT 0-based
/*
switch (saveFileDialog.FilterIndex)
var fileName = await saveFileDialog.ShowAsync(this);
if (fileName is null) return;
var ext = System.IO.Path.GetExtension(fileName);
switch (ext)
{
case 1: // xlsx
case "xlsx": // xlsx
default:
LibraryExporter.ToXlsx(saveFileDialog.FileName);
LibraryExporter.ToXlsx(fileName);
break;
case 2: // csv
LibraryExporter.ToCsv(saveFileDialog.FileName);
case "csv": // csv
LibraryExporter.ToCsv(fileName);
break;
case 3: // json
LibraryExporter.ToJson(saveFileDialog.FileName);
case "json": // json
LibraryExporter.ToJson(fileName);
break;
}
MessageBox.Show("Library exported to:\r\n" + saveFileDialog.FileName);
*/
MessageBox.Show("Library exported to:\r\n" + fileName, "Library Exported");
}
catch (Exception ex)
{