CollabVMDesktopClient/CollabVMClient/App.axaml.cs
2023-08-29 08:52:35 -04:00

41 lines
1.1 KiB
C#

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using CollabVMClient.ViewModels;
using CollabVMClient.Views;
namespace CollabVMClient;
public partial class App : Application
{
private IConfig _config;
public IConfig Config => _config;
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
// Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT
BindingPlugins.DataValidators.RemoveAt(0);
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
this._config = Utilities.LoadConfig();
desktop.MainWindow = new MainWindow
{
DataContext = new ServerListViewModel(this.Config)
};
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
}
base.OnFrameworkInitializationCompleted();
}
}