diff --git a/Aaru.Gui/Aaru.Gui.csproj b/Aaru.Gui/Aaru.Gui.csproj
index 903343b62..5b14b5275 100644
--- a/Aaru.Gui/Aaru.Gui.csproj
+++ b/Aaru.Gui/Aaru.Gui.csproj
@@ -1,363 +1,369 @@
-
- Aaru.Gui
- Aaru.Gui
- $(Version)
- true
- 4.5.99.2020
- Claunia.com
- Copyright © 2011-2020 Natalia Portillo
- Aaru Data Preservation Suite
- Aaru Data Preservation Suite
- $(Version)
- netcoreapp3.0
- CS0649,CS0169
-
-
- $(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %(Filename)
-
-
- Designer
-
-
-
- Designer
-
-
- SplashWindow.xaml
-
-
- Designer
-
-
- LicenseDialog.xaml
-
-
-
-
-
-
-
- LICENSE
-
-
-
-
-
-
- /Library/Frameworks/Mono.framework/Versions/Current/lib/mono
- /usr/lib/mono
- /usr/local/lib/mono
-
- $(BaseFrameworkPathOverrideForMono)/4.0-api
- $(BaseFrameworkPathOverrideForMono)/4.5-api
- $(BaseFrameworkPathOverrideForMono)/4.5.1-api
- $(BaseFrameworkPathOverrideForMono)/4.5.2-api
- $(BaseFrameworkPathOverrideForMono)/4.6-api
- $(BaseFrameworkPathOverrideForMono)/4.6.1-api
- $(BaseFrameworkPathOverrideForMono)/4.6.2-api
- $(BaseFrameworkPathOverrideForMono)/4.7-api
- $(BaseFrameworkPathOverrideForMono)/4.7.1-api
- true
-
- $(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)
-
+
+ Aaru.Gui
+ Aaru.Gui
+ $(Version)
+ true
+ 4.5.99.2020
+ Claunia.com
+ Copyright © 2011-2020 Natalia Portillo
+ Aaru Data Preservation Suite
+ Aaru Data Preservation Suite
+ $(Version)
+ netcoreapp3.0
+ CS0649,CS0169
+
+
+ $(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %(Filename)
+
+
+ Designer
+
+
+
+ Designer
+
+
+ SplashWindow.xaml
+
+
+ Designer
+
+
+ LicenseDialog.xaml
+
+
+ Designer
+
+
+ EncodingsDialog.xaml
+
+
+
+
+
+
+
+ LICENSE
+
+
+
+
+
+
+ /Library/Frameworks/Mono.framework/Versions/Current/lib/mono
+ /usr/lib/mono
+ /usr/local/lib/mono
+
+ $(BaseFrameworkPathOverrideForMono)/4.0-api
+ $(BaseFrameworkPathOverrideForMono)/4.5-api
+ $(BaseFrameworkPathOverrideForMono)/4.5.1-api
+ $(BaseFrameworkPathOverrideForMono)/4.5.2-api
+ $(BaseFrameworkPathOverrideForMono)/4.6-api
+ $(BaseFrameworkPathOverrideForMono)/4.6.1-api
+ $(BaseFrameworkPathOverrideForMono)/4.6.2-api
+ $(BaseFrameworkPathOverrideForMono)/4.7-api
+ $(BaseFrameworkPathOverrideForMono)/4.7.1-api
+ true
+
+ $(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)
+
\ No newline at end of file
diff --git a/Aaru.Gui/Dialogs/dlgEncodings.xeto b/Aaru.Gui/Dialogs/dlgEncodings.xeto
deleted file mode 100644
index 502bbd584..000000000
--- a/Aaru.Gui/Dialogs/dlgEncodings.xeto
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Aaru.Gui/Dialogs/dlgEncodings.xeto.cs b/Aaru.Gui/Dialogs/dlgEncodings.xeto.cs
deleted file mode 100644
index c0dce208b..000000000
--- a/Aaru.Gui/Dialogs/dlgEncodings.xeto.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// /***************************************************************************
-// Aaru Data Preservation Suite
-// ----------------------------------------------------------------------------
-//
-// Filename : dlgEncodings.xeto.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Plugins dialog.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Implements the encodings list dialog.
-//
-// --[ License ] --------------------------------------------------------------
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General public License for more details.
-//
-// You should have received a copy of the GNU General public License
-// along with this program. If not, see .
-//
-// ----------------------------------------------------------------------------
-// Copyright © 2011-2020 Natalia Portillo
-// ****************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using Eto.Forms;
-using Eto.Serialization.Xaml;
-
-namespace Aaru.Gui.Dialogs
-{
- public class dlgEncodings : Dialog
- {
- readonly ObservableCollection encodings;
-
- public dlgEncodings()
- {
- XamlReader.Load(this);
-
- DefaultButton = btnClose;
- DisplayMode = DialogDisplayMode.Attached;
-
- encodings = new ObservableCollection();
-
- grdEncodings.DataStore = encodings;
-
- grdEncodings.Columns.Add(new GridColumn
- {
- DataCell = new TextBoxCell
- {
- Binding = Binding.Property(r => r.Name)
- },
- HeaderText = "Code", Sortable = true
- });
-
- grdEncodings.Columns.Add(new GridColumn
- {
- DataCell = new TextBoxCell
- {
- Binding = Binding.Property(r => r.DisplayName)
- },
- HeaderText = "Name", Sortable = true
- });
-
- grdEncodings.AllowMultipleSelection = false;
- grdEncodings.AllowColumnReordering = true;
- }
-
- protected override void OnLoadComplete(EventArgs e)
- {
- base.OnLoadComplete(e);
-
- encodings.Clear();
-
- List _encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo
- {
- Name = info.Name, DisplayName = info.GetEncoding().EncodingName
- }).ToList();
-
- _encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new CommonEncodingInfo
- {
- Name = info.Name, DisplayName = info.DisplayName
- }));
-
- foreach(CommonEncodingInfo encoding in _encodings.OrderBy(t => t.DisplayName))
- encodings.Add(encoding);
- }
-
- protected void OnBtnClose(object sender, EventArgs e) => Close();
-
- class CommonEncodingInfo
- {
- public string Name { get; set; }
- public string DisplayName { get; set; }
- }
-
- #region XAML controls
- GridView grdEncodings;
- Button btnClose;
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Aaru.Gui/Forms/frmMain.xeto.cs b/Aaru.Gui/Forms/frmMain.xeto.cs
index 17360c307..81dcd9980 100644
--- a/Aaru.Gui/Forms/frmMain.xeto.cs
+++ b/Aaru.Gui/Forms/frmMain.xeto.cs
@@ -686,8 +686,6 @@ namespace Aaru.Gui.Forms
protected void OnMenuPlugins(object sender, EventArgs e) => new dlgPlugins().ShowModal(this);
- protected void OnMenuEncodings(object sender, EventArgs e) => new dlgEncodings().ShowModal(this);
-
protected void OnMenuStatistics(object sender, EventArgs e)
{
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
diff --git a/Aaru.Gui/Models/EncodingModel.cs b/Aaru.Gui/Models/EncodingModel.cs
new file mode 100644
index 000000000..cf9d5530f
--- /dev/null
+++ b/Aaru.Gui/Models/EncodingModel.cs
@@ -0,0 +1,8 @@
+namespace Aaru.Gui.Models
+{
+ public class EncodingModel
+ {
+ public string Name { get; set; }
+ public string DisplayName { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Aaru.Gui/ViewModels/EncodingsDialogViewModel.cs b/Aaru.Gui/ViewModels/EncodingsDialogViewModel.cs
new file mode 100644
index 000000000..9017af113
--- /dev/null
+++ b/Aaru.Gui/ViewModels/EncodingsDialogViewModel.cs
@@ -0,0 +1,48 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reactive;
+using System.Text;
+using System.Threading.Tasks;
+using Aaru.Gui.Models;
+using Aaru.Gui.Views;
+using ReactiveUI;
+
+namespace Aaru.Gui.ViewModels
+{
+ public class EncodingsDialogViewModel : ViewModelBase
+ {
+ readonly EncodingsDialog _view;
+ string _versionText;
+
+ public EncodingsDialogViewModel(EncodingsDialog view)
+ {
+ _view = view;
+ Encodings = new ObservableCollection();
+ CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
+
+ Task.Run(() =>
+ {
+ List encodings = Encoding.GetEncodings().Select(info => new EncodingModel
+ {
+ Name = info.Name, DisplayName = info.GetEncoding().EncodingName
+ }).ToList();
+
+ encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new EncodingModel
+ {
+ Name = info.Name, DisplayName = info.DisplayName
+ }));
+
+ foreach(EncodingModel encoding in encodings.OrderBy(t => t.DisplayName))
+ Encodings.Add(encoding);
+ });
+ }
+
+ public string Title => "Encodings";
+ public string CloseLabel => "Close";
+ public ReactiveCommand CloseCommand { get; }
+ public ObservableCollection Encodings { get; }
+
+ void ExecuteCloseCommand() => _view.Close();
+ }
+}
\ No newline at end of file
diff --git a/Aaru.Gui/ViewModels/MainWindowViewModel.cs b/Aaru.Gui/ViewModels/MainWindowViewModel.cs
index f20e38615..b4e56240a 100644
--- a/Aaru.Gui/ViewModels/MainWindowViewModel.cs
+++ b/Aaru.Gui/ViewModels/MainWindowViewModel.cs
@@ -13,8 +13,9 @@ namespace Aaru.Gui.ViewModels
public MainWindowViewModel(MainWindow view)
{
- AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand);
- _view = view;
+ AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand);
+ EncodingsCommand = ReactiveCommand.Create(ExecuteEncodingsCommand);
+ _view = view;
}
public string Greeting => "Welcome to Aaru!";
@@ -23,7 +24,8 @@ namespace Aaru.Gui.ViewModels
!NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as
IClassicDesktopStyleApplicationLifetime)?.MainWindow);
- public ReactiveCommand AboutCommand { get; }
+ public ReactiveCommand AboutCommand { get; }
+ public ReactiveCommand EncodingsCommand { get; }
internal void ExecuteAboutCommand()
{
@@ -31,5 +33,12 @@ namespace Aaru.Gui.ViewModels
dialog.DataContext = new AboutDialogViewModel(dialog);
dialog.ShowDialog(_view);
}
+
+ internal void ExecuteEncodingsCommand()
+ {
+ var dialog = new EncodingsDialog();
+ dialog.DataContext = new EncodingsDialogViewModel(dialog);
+ dialog.ShowDialog(_view);
+ }
}
}
\ No newline at end of file
diff --git a/Aaru.Gui/Views/EncodingsDialog.xaml b/Aaru.Gui/Views/EncodingsDialog.xaml
new file mode 100644
index 000000000..a6c65ec22
--- /dev/null
+++ b/Aaru.Gui/Views/EncodingsDialog.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aaru.Gui/Views/EncodingsDialog.xaml.cs b/Aaru.Gui/Views/EncodingsDialog.xaml.cs
new file mode 100644
index 000000000..15010ce91
--- /dev/null
+++ b/Aaru.Gui/Views/EncodingsDialog.xaml.cs
@@ -0,0 +1,19 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace Aaru.Gui.Views
+{
+ public class EncodingsDialog : Window
+ {
+ public EncodingsDialog()
+ {
+ InitializeComponent();
+ #if DEBUG
+ this.AttachDevTools();
+ #endif
+ }
+
+ void InitializeComponent() => AvaloniaXamlLoader.Load(this);
+ }
+}
\ No newline at end of file
diff --git a/Aaru.Gui/Views/MainWindow.xaml b/Aaru.Gui/Views/MainWindow.xaml
index bf169e66a..42bc4d91b 100644
--- a/Aaru.Gui/Views/MainWindow.xaml
+++ b/Aaru.Gui/Views/MainWindow.xaml
@@ -20,8 +20,8 @@