The ZipFile sink could cause program hangs. Additionally, the only reason it was ever used was to package verbose AudibleApi account login errors, saving the returned Html page as a file. Otherwise, the zip file only contains a .log text file. - Removed Serilog.Sinks.ZipFile - Add Serilog configuration migration - Added a custom destructure to handle logging files. If any files are logged, they will be written to "LogyyyyMM_AdditionalFiles.zip"
63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
using Dinah.Core;
|
|
using FileManager;
|
|
using LibationAvalonia.Dialogs;
|
|
using LibationAvalonia.ViewModels.Settings;
|
|
using LibationFileManager;
|
|
using System.Linq;
|
|
|
|
#nullable enable
|
|
namespace LibationAvalonia.Controls.Settings
|
|
{
|
|
public partial class Important : UserControl
|
|
{
|
|
private ImportantSettingsVM? ViewModel => DataContext as ImportantSettingsVM;
|
|
public Important()
|
|
{
|
|
InitializeComponent();
|
|
if (Design.IsDesignMode)
|
|
{
|
|
_ = Configuration.Instance.LibationFiles;
|
|
DataContext = new ImportantSettingsVM(Configuration.Instance);
|
|
}
|
|
|
|
ThemeComboBox.SelectionChanged += ThemeComboBox_SelectionChanged;
|
|
}
|
|
|
|
private void EditThemeColors_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
|
{
|
|
if (App.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
|
|
{
|
|
//Only allow a single instance of the theme picker
|
|
//Show it as a window, not a dialog, so users can preview
|
|
//their changes throughout the entire app.
|
|
if (lifetime.Windows.OfType<ThemePickerDialog>().FirstOrDefault() is ThemePickerDialog dialog)
|
|
{
|
|
dialog.BringIntoView();
|
|
}
|
|
else
|
|
{
|
|
var themePicker = new ThemePickerDialog();
|
|
themePicker.Show();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ThemeComboBox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
|
{
|
|
//Remove the combo box before changing the theme, then re-add it.
|
|
//This is a workaround to a crash that will happen if the theme
|
|
//is changed while the combo box is open
|
|
ThemeComboBox.SelectionChanged -= ThemeComboBox_SelectionChanged;
|
|
var parent = ThemeComboBox.Parent as Panel;
|
|
if (parent?.Children.Remove(ThemeComboBox) ?? false)
|
|
{
|
|
Configuration.Instance.SetString(ViewModel?.ThemeVariant, nameof(ViewModel.ThemeVariant));
|
|
parent.Children.Add(ThemeComboBox);
|
|
}
|
|
ThemeComboBox.SelectionChanged += ThemeComboBox_SelectionChanged;
|
|
}
|
|
}
|
|
}
|