Added SettingsDialog
This commit is contained in:
parent
10359aa5e8
commit
0c98ce000b
@ -0,0 +1,33 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="LibationWinForms.AvaloniaUI.Controls.DirectoryOrCustomSelectControl">
|
||||||
|
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto">
|
||||||
|
<controls:DirectorySelectControl
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.Row="0"
|
||||||
|
Name="directorySelectControl"
|
||||||
|
SubDirectory="{Binding $parent.SubDirectory}"
|
||||||
|
KnownDirectories="{Binding $parent.KnownDirectories}" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
Name="knownDirRadio"
|
||||||
|
IsChecked="{Binding KnownChecked, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
Name="customDirRadio"
|
||||||
|
IsChecked="{Binding CustomChecked, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Grid.Row="1" ColumnDefinitions="*,Auto">
|
||||||
|
<TextBox IsEnabled="{Binding CustomChecked}" Name="customDirTbox" Grid.Column="0" IsReadOnly="True" Text="{Binding CustomDir, Mode=TwoWay}" />
|
||||||
|
<Button Name="customDirBrowseBtn" Grid.Column="1" Content="..." Margin="5,0,0,0" Padding="10,0,10,0" VerticalAlignment="Stretch" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,176 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Dinah.Core;
|
||||||
|
using LibationFileManager;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace LibationWinForms.AvaloniaUI.Controls
|
||||||
|
{
|
||||||
|
public partial class DirectoryOrCustomSelectControl : UserControl
|
||||||
|
{
|
||||||
|
public static readonly StyledProperty<List<Configuration.KnownDirectories>> KnownDirectoriesProperty =
|
||||||
|
AvaloniaProperty.Register<DirectorySelectControl, List<Configuration.KnownDirectories>>(nameof(KnownDirectories), DirectorySelectControl.DefaultKnownDirectories);
|
||||||
|
|
||||||
|
public static readonly StyledProperty<string> SubDirectoryProperty =
|
||||||
|
AvaloniaProperty.Register<DirectorySelectControl, string>(nameof(SubDirectory));
|
||||||
|
|
||||||
|
|
||||||
|
public static readonly StyledProperty<string> DirectoryProperty =
|
||||||
|
AvaloniaProperty.Register<DirectorySelectControl, string>(nameof(Directory));
|
||||||
|
|
||||||
|
public List<Configuration.KnownDirectories> KnownDirectories
|
||||||
|
{
|
||||||
|
get => GetValue(KnownDirectoriesProperty);
|
||||||
|
set => SetValue(KnownDirectoriesProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Directory
|
||||||
|
{
|
||||||
|
get => GetValue(DirectoryProperty);
|
||||||
|
set => SetValue(DirectoryProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SubDirectory
|
||||||
|
{
|
||||||
|
get => GetValue(SubDirectoryProperty);
|
||||||
|
set => SetValue(SubDirectoryProperty, value);
|
||||||
|
}
|
||||||
|
CustomState customStates = new();
|
||||||
|
public DirectoryOrCustomSelectControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
customDirBrowseBtn = this.Find<Button>(nameof(customDirBrowseBtn));
|
||||||
|
directorySelectControl = this.Find<DirectorySelectControl>(nameof(directorySelectControl));
|
||||||
|
|
||||||
|
this.Find<TextBox>(nameof(customDirTbox)).DataContext = customStates;
|
||||||
|
this.Find<RadioButton>(nameof(knownDirRadio)).DataContext = customStates;
|
||||||
|
this.Find<RadioButton>(nameof(customDirRadio)).DataContext = customStates;
|
||||||
|
|
||||||
|
customStates.PropertyChanged += CheckStates_PropertyChanged;
|
||||||
|
customDirBrowseBtn.Click += CustomDirBrowseBtn_Click;
|
||||||
|
PropertyChanged += DirectoryOrCustomSelectControl_PropertyChanged;
|
||||||
|
directorySelectControl.PropertyChanged += DirectorySelectControl_PropertyChanged;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private class CustomState: ViewModels.ViewModelBase
|
||||||
|
{
|
||||||
|
private string _customDir;
|
||||||
|
private bool _knownChecked;
|
||||||
|
private bool _customChecked;
|
||||||
|
public string CustomDir { get=> _customDir; set => this.RaiseAndSetIfChanged(ref _customDir, value); }
|
||||||
|
public bool KnownChecked
|
||||||
|
{
|
||||||
|
get => _knownChecked;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.RaiseAndSetIfChanged(ref _knownChecked, value);
|
||||||
|
if (value)
|
||||||
|
CustomChecked = false;
|
||||||
|
else if (!CustomChecked)
|
||||||
|
CustomChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool CustomChecked
|
||||||
|
{
|
||||||
|
get => _customChecked;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.RaiseAndSetIfChanged(ref _customChecked, value);
|
||||||
|
if (value)
|
||||||
|
KnownChecked = false;
|
||||||
|
else if (!KnownChecked)
|
||||||
|
KnownChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void CustomDirBrowseBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
OpenFolderDialog ofd = new();
|
||||||
|
customStates.CustomDir = await ofd.ShowAsync(VisualRoot as Window);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckStates_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName != nameof(CustomState.CustomDir))
|
||||||
|
{
|
||||||
|
directorySelectControl.IsEnabled = !customStates.CustomChecked;
|
||||||
|
customDirBrowseBtn.IsEnabled = customStates.CustomChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DirectorySelectControl_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Property.Name == nameof(DirectorySelectControl.SelectedDirectory))
|
||||||
|
{
|
||||||
|
setDirectory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDirectory()
|
||||||
|
{
|
||||||
|
Directory
|
||||||
|
= customStates.CustomChecked ? customStates.CustomDir
|
||||||
|
: directorySelectControl.SelectedDirectory is Configuration.KnownDirectories.AppDir ? Configuration.AppDir_Absolute
|
||||||
|
: Configuration.GetKnownDirectoryPath(directorySelectControl.SelectedDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DirectoryOrCustomSelectControl_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Property.Name == nameof(Directory) && e.OldValue is null)
|
||||||
|
{
|
||||||
|
var directory = Directory?.Trim() ?? "";
|
||||||
|
|
||||||
|
var noSubDir = RemoveSubDirectoryFromPath(directory);
|
||||||
|
var known = Configuration.GetKnownDirectory(noSubDir);
|
||||||
|
|
||||||
|
if (known == Configuration.KnownDirectories.None && noSubDir == Configuration.AppDir_Absolute)
|
||||||
|
known = Configuration.KnownDirectories.AppDir;
|
||||||
|
|
||||||
|
if (known is Configuration.KnownDirectories.None)
|
||||||
|
{
|
||||||
|
customStates.CustomChecked = true;
|
||||||
|
customStates.CustomDir = noSubDir;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
customStates.KnownChecked = true;
|
||||||
|
directorySelectControl.SelectedDirectory = known;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.Property.Name == nameof(KnownDirectories))
|
||||||
|
directorySelectControl.KnownDirectories = KnownDirectories;
|
||||||
|
else if (e.Property.Name == nameof(SubDirectory))
|
||||||
|
directorySelectControl.SubDirectory = SubDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string RemoveSubDirectoryFromPath(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(SubDirectory))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
path = path?.Trim() ?? "";
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
var bottomDir = System.IO.Path.GetFileName(path);
|
||||||
|
if (SubDirectory.EqualsInsensitive(bottomDir))
|
||||||
|
return System.IO.Path.GetDirectoryName(path);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<TemplatedControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -6,17 +6,9 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="LibationWinForms.AvaloniaUI.Controls.DirectorySelectControl">
|
x:Class="LibationWinForms.AvaloniaUI.Controls.DirectorySelectControl">
|
||||||
|
|
||||||
<Design.DataContext>
|
<UserControl.Resources>
|
||||||
</Design.DataContext>
|
<controls:KnownDirectoryConverter x:Key="KnownDirectoryConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
<TemplatedControl.Styles>
|
|
||||||
<Style Selector="controls|DirectorySelectControl Border">
|
|
||||||
<Setter Property="BorderBrush" Value="DarkGray" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="controls|DirectorySelectControl">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<ControlTemplate>
|
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
@ -25,29 +17,24 @@
|
|||||||
<Setter Property="Height" Value="NaN"/>
|
<Setter Property="Height" Value="NaN"/>
|
||||||
</Style>
|
</Style>
|
||||||
</StackPanel.Styles>
|
</StackPanel.Styles>
|
||||||
<ComboBox
|
<controls:WheelComboBox
|
||||||
HorizontalContentAlignment = "Stretch"
|
HorizontalContentAlignment = "Stretch"
|
||||||
HorizontalAlignment = "Stretch"
|
HorizontalAlignment = "Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
SelectedItem="{Binding SelectedComboBoxItem, Mode=TwoWay}"
|
SelectedItem="{Binding $parent[1].SelectedDirectory, Mode=TwoWay}"
|
||||||
Items="{Binding ComboBoxItems}">
|
Items="{Binding $parent[1].KnownDirectories}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontSize="12"
|
FontSize="12"
|
||||||
Text="{Binding Description}" />
|
Text="{Binding, Converter={StaticResource KnownDirectoryConverter}}" />
|
||||||
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</controls:WheelComboBox>
|
||||||
<TextBox Margin="0,10,0,10" Text="{Binding SelectedComboBoxItem.UiDisplayPath}" />
|
<TextBox Margin="0,10,0,10" IsReadOnly="True" Name="displayPathTbox" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</ControlTemplate>
|
</UserControl>
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</TemplatedControl.Styles>
|
|
||||||
|
|
||||||
</TemplatedControl>
|
|
||||||
|
|||||||
@ -4,37 +4,34 @@ using Avalonia.Markup.Xaml;
|
|||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using ReactiveUI;
|
|
||||||
using Avalonia.Controls.Primitives;
|
|
||||||
using System.Collections;
|
|
||||||
using Avalonia.Data.Converters;
|
using Avalonia.Data.Converters;
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reactive.Subjects;
|
||||||
|
|
||||||
namespace LibationWinForms.AvaloniaUI.Controls
|
namespace LibationWinForms.AvaloniaUI.Controls
|
||||||
{
|
{
|
||||||
public class TextCaseConverter : IValueConverter
|
public class KnownDirectoryConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is Configuration.KnownDirectories dir)
|
if (value is Configuration.KnownDirectories dir)
|
||||||
{
|
return dir.GetDescription();
|
||||||
|
|
||||||
}
|
|
||||||
return new BindingNotification(new InvalidCastException(), BindingErrorType.Error);
|
return new BindingNotification(new InvalidCastException(), BindingErrorType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return new BindingNotification(new InvalidCastException(), BindingErrorType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public partial class DirectorySelectControl : TemplatedControl
|
|
||||||
|
public partial class DirectorySelectControl : UserControl
|
||||||
{
|
{
|
||||||
private static readonly List<Configuration.KnownDirectories> defaultList = new List<Configuration.KnownDirectories>()
|
public static List<Configuration.KnownDirectories> DefaultKnownDirectories { get; }
|
||||||
|
= new()
|
||||||
{
|
{
|
||||||
Configuration.KnownDirectories.WinTemp,
|
Configuration.KnownDirectories.WinTemp,
|
||||||
Configuration.KnownDirectories.UserProfile,
|
Configuration.KnownDirectories.UserProfile,
|
||||||
@ -42,71 +39,56 @@ namespace LibationWinForms.AvaloniaUI.Controls
|
|||||||
Configuration.KnownDirectories.MyDocs,
|
Configuration.KnownDirectories.MyDocs,
|
||||||
Configuration.KnownDirectories.LibationFiles
|
Configuration.KnownDirectories.LibationFiles
|
||||||
};
|
};
|
||||||
public static readonly StyledProperty<Configuration.KnownDirectories?> SelectedirectoryProperty =
|
|
||||||
AvaloniaProperty.Register<DirectorySelectControl, Configuration.KnownDirectories?>(nameof(Selectedirectory), defaultList[0]);
|
public static readonly StyledProperty<Configuration.KnownDirectories> SelectedDirectoryProperty =
|
||||||
|
AvaloniaProperty.Register<DirectorySelectControl, Configuration.KnownDirectories>(nameof(SelectedDirectory));
|
||||||
|
|
||||||
public static readonly StyledProperty<List<Configuration.KnownDirectories>> KnownDirectoriesProperty =
|
public static readonly StyledProperty<List<Configuration.KnownDirectories>> KnownDirectoriesProperty =
|
||||||
AvaloniaProperty.Register<DirectorySelectControl, List<Configuration.KnownDirectories>>(nameof(KnownDirectories), defaultList);
|
AvaloniaProperty.Register<DirectorySelectControl, List<Configuration.KnownDirectories>>(nameof(KnownDirectories), DefaultKnownDirectories);
|
||||||
|
|
||||||
public static readonly StyledProperty<string?> SubdirectoryProperty =
|
public static readonly StyledProperty<string> SubDirectoryProperty =
|
||||||
AvaloniaProperty.Register<DirectorySelectControl, string?>(nameof(Subdirectory), "subdir");
|
AvaloniaProperty.Register<DirectorySelectControl, string>(nameof(SubDirectory));
|
||||||
|
|
||||||
DirectorySelectViewModel DirectorySelect { get; } = new();
|
|
||||||
public DirectorySelectControl()
|
public DirectorySelectControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
displayPathTbox = this.Get<TextBox>(nameof(displayPathTbox));
|
||||||
|
displayPathTbox.Bind(TextBox.TextProperty, TextboxPath);
|
||||||
|
PropertyChanged += DirectorySelectControl_PropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnInitialized()
|
private Subject<string> TextboxPath = new Subject<string>();
|
||||||
|
|
||||||
|
private void DirectorySelectControl_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
DirectorySelect.Directories.Clear();
|
if (e.Property.Name == nameof(SelectedDirectory))
|
||||||
|
{
|
||||||
int insertIndex = 0;
|
TextboxPath.OnNext(
|
||||||
foreach (var kd in KnownDirectories.Distinct())
|
Path.Combine(
|
||||||
DirectorySelect.Directories.Insert(insertIndex++, new(this, kd));
|
SelectedDirectory is Configuration.KnownDirectories.None ? string.Empty
|
||||||
|
: SelectedDirectory is Configuration.KnownDirectories.AppDir ? Configuration.AppDir_Absolute
|
||||||
DataContext = DirectorySelect;
|
: Configuration.GetKnownDirectoryPath(SelectedDirectory)
|
||||||
base.OnInitialized();
|
, SubDirectory ?? string.Empty));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Configuration.KnownDirectories> KnownDirectories
|
public List<Configuration.KnownDirectories> KnownDirectories
|
||||||
{
|
{
|
||||||
get { return GetValue(KnownDirectoriesProperty); }
|
get => GetValue(KnownDirectoriesProperty);
|
||||||
set
|
set => SetValue(KnownDirectoriesProperty, value);
|
||||||
{
|
|
||||||
SetValue(KnownDirectoriesProperty, value);
|
|
||||||
//SetDirectoryItems(KnownDirectories);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Configuration.KnownDirectories SelectedDirectory
|
||||||
public Configuration.KnownDirectories? Selectedirectory
|
|
||||||
{
|
{
|
||||||
get { return GetValue(SelectedirectoryProperty); }
|
get => GetValue(SelectedDirectoryProperty);
|
||||||
set
|
set => SetValue(SelectedDirectoryProperty, value);
|
||||||
{
|
|
||||||
SetValue(SelectedirectoryProperty, value);
|
|
||||||
|
|
||||||
if (value is null or Configuration.KnownDirectories.None)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// set default
|
|
||||||
var item = DirectorySelect.Directories.SingleOrDefault(item => item.Value == value.Value);
|
|
||||||
if (item is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DirectorySelect.SelectedDirectory = item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string SubDirectory
|
||||||
public string? Subdirectory
|
|
||||||
{
|
{
|
||||||
get { return GetValue(SubdirectoryProperty); }
|
get => GetValue(SubDirectoryProperty);
|
||||||
set
|
set => SetValue(SubDirectoryProperty, value);
|
||||||
{
|
|
||||||
SetValue(SubdirectoryProperty, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
@ -114,33 +96,4 @@ namespace LibationWinForms.AvaloniaUI.Controls
|
|||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DirectorySelectViewModel : ViewModels.ViewModelBase
|
|
||||||
{
|
|
||||||
public class DirectoryComboBoxItem
|
|
||||||
{
|
|
||||||
private readonly DirectorySelectControl _parentControl;
|
|
||||||
public string Description { get; }
|
|
||||||
public Configuration.KnownDirectories Value { get; }
|
|
||||||
|
|
||||||
public string FullPath => AddSubDirectoryToPath(Configuration.GetKnownDirectoryPath(Value));
|
|
||||||
|
|
||||||
/// <summary>Displaying relative paths is confusing. UI should display absolute equivalent</summary>
|
|
||||||
public string UiDisplayPath => Value == Configuration.KnownDirectories.AppDir ? AddSubDirectoryToPath(Configuration.AppDir_Absolute) : FullPath;
|
|
||||||
|
|
||||||
public DirectoryComboBoxItem(DirectorySelectControl parentControl, Configuration.KnownDirectories knownDirectory)
|
|
||||||
{
|
|
||||||
_parentControl = parentControl;
|
|
||||||
Value = knownDirectory;
|
|
||||||
Description = Value.GetDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal string AddSubDirectoryToPath(string path) => string.IsNullOrWhiteSpace(_parentControl.Subdirectory) ? path : System.IO.Path.Combine(path, _parentControl.Subdirectory);
|
|
||||||
|
|
||||||
public override string ToString() => Description;
|
|
||||||
}
|
|
||||||
public ObservableCollection<DirectoryComboBoxItem> Directories { get; } = new(new());
|
|
||||||
private DirectoryComboBoxItem _selectedDirectory;
|
|
||||||
public DirectoryComboBoxItem SelectedDirectory { get => _selectedDirectory; set => this.RaiseAndSetIfChanged(ref _selectedDirectory, value); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
<ComboBox xmlns="https://github.com/avaloniaui"
|
<ComboBox xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="LibationWinForms.AvaloniaUI.Controls.WheelComboBox">
|
x:Class="LibationWinForms.AvaloniaUI.Controls.WheelComboBox">
|
||||||
|
<ComboBox.Styles>
|
||||||
|
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
||||||
|
<Setter Property="Height" Value="NaN"/>
|
||||||
|
</Style>
|
||||||
|
</ComboBox.Styles>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
|
using Dinah.Core.Logging;
|
||||||
using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
|
using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
|
||||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||||
using System;
|
using System;
|
||||||
@ -201,6 +202,23 @@ namespace LibationWinForms.AvaloniaUI
|
|||||||
return await ShowCore(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
return await ShowCore(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task VerboseLoggingWarning_ShowIfTrue()
|
||||||
|
{
|
||||||
|
// when turning on debug (and especially Verbose) to share logs, some privacy settings may not be obscured
|
||||||
|
if (Serilog.Log.Logger.IsVerboseEnabled())
|
||||||
|
await Show(@"
|
||||||
|
Warning: verbose logging is enabled.
|
||||||
|
|
||||||
|
This should be used for debugging only. It creates many
|
||||||
|
more logs and debug files, neither of which are as
|
||||||
|
strictly anonymous.
|
||||||
|
|
||||||
|
When you are finished debugging, it's highly recommended
|
||||||
|
to set your debug MinimumLevel to Information and restart
|
||||||
|
Libation.
|
||||||
|
".Trim(), "Verbose logging enabled", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<DialogResult> ShowConfirmationDialog(Window owner, IEnumerable<LibraryBook> libraryBooks, string format, string title, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1)
|
public static async Task<DialogResult> ShowConfirmationDialog(Window owner, IEnumerable<LibraryBook> libraryBooks, string format, string title, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1)
|
||||||
{
|
{
|
||||||
if (libraryBooks is null || !libraryBooks.Any())
|
if (libraryBooks is null || !libraryBooks.Any())
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="600"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="620"
|
||||||
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.SettingsDialog"
|
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.SettingsDialog"
|
||||||
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
||||||
Title="Edit Settings"
|
Title="Edit Settings"
|
||||||
@ -22,13 +22,136 @@
|
|||||||
<TabControl Grid.Column="0">
|
<TabControl Grid.Column="0">
|
||||||
<TabControl.Styles>
|
<TabControl.Styles>
|
||||||
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
||||||
<Setter Property="Height" Value="33"/>
|
<Setter Property="Height" Value="18"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBlock">
|
<Style Selector="TabItem">
|
||||||
<Setter Property="FontSize" Value="12"/>
|
<Setter Property="MinHeight" Value="30"/>
|
||||||
|
<Setter Property="Height" Value="30"/>
|
||||||
|
<Setter Property="Padding" Value="8,2,8,0"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="TabItem#Header TextBlock">
|
||||||
|
<Setter Property="MinHeight" Value="5"/>
|
||||||
</Style>
|
</Style>
|
||||||
</TabControl.Styles>
|
</TabControl.Styles>
|
||||||
|
|
||||||
|
|
||||||
|
<TabItem Margin="0" Name="tabItem1">
|
||||||
|
|
||||||
|
<TabItem.Header>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
FontSize="14"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="Important Settings"/>
|
||||||
|
|
||||||
|
</TabItem.Header>
|
||||||
|
<Border
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
BorderThickness="2"
|
||||||
|
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||||
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
|
|
||||||
|
<controls:GroupBox
|
||||||
|
Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
BorderWidth="1"
|
||||||
|
Label="Books Location">
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="5"
|
||||||
|
Text="{Binding ImportantSettings.BooksText}" />
|
||||||
|
|
||||||
|
<controls:DirectoryOrCustomSelectControl Margin="0,10,0,10"
|
||||||
|
SubDirectory="Books"
|
||||||
|
Directory="{Binding ImportantSettings.BooksDirectory, Mode=TwoWay}"
|
||||||
|
KnownDirectories="{Binding ImportantSettings.KnownDirectories}" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox IsChecked="{Binding ImportantSettings.SavePodcastsToParentFolder, Mode=TwoWay}">
|
||||||
|
<TextBlock Text="{Binding ImportantSettings.SavePodcastsToParentFolderText}" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</controls:GroupBox>
|
||||||
|
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="1" Margin="5"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
|
||||||
|
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center" Text="Logging level" />
|
||||||
|
|
||||||
|
<controls:WheelComboBox
|
||||||
|
Width="150"
|
||||||
|
Height="25"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
SelectedItem="{Binding ImportantSettings.LoggingLevel, Mode=TwoWay}"
|
||||||
|
Items="{Binding ImportantSettings.LoggingLevels}" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Margin="50,0,0,0"
|
||||||
|
Padding="20,3,20,3"
|
||||||
|
Content="Open Log Folder"
|
||||||
|
Click="OpenLogFolderButton_Click" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="5"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
IsChecked="{Binding ImportantSettings.BetaOptIn, Mode=TwoWay}">
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding ImportantSettings.BetaOptInText}" />
|
||||||
|
|
||||||
|
</CheckBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
|
||||||
|
<TabItem>
|
||||||
|
|
||||||
|
<TabItem.Header>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
FontSize="14"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="Import Library"/>
|
||||||
|
|
||||||
|
</TabItem.Header>
|
||||||
|
<Border
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
BorderThickness="2"
|
||||||
|
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||||
|
|
||||||
|
<StackPanel Margin="5">
|
||||||
|
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.AutoScan, Mode=TwoWay}">
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.AutoScanText}" />
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.ShowImportedStats, Mode=TwoWay}">
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.ShowImportedStatsText}" />
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.ImportEpisodes, Mode=TwoWay}">
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.ImportEpisodesText}" />
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.DownloadEpisodes, Mode=TwoWay}">
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.DownloadEpisodesText}" />
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.AutoDownloadEpisodes, Mode=TwoWay}">
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.AutoDownloadEpisodesText}" />
|
||||||
|
</CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
<TabItem>
|
<TabItem>
|
||||||
|
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
@ -43,11 +166,14 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
BorderThickness="2"
|
BorderThickness="2"
|
||||||
Background="WhiteSmoke"
|
|
||||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto,Auto,*">
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
<controls:GroupBox Grid.Row="0" BorderWidth="1" Label="{Binding DownloadDecryptSettings.BadBookGroupboxText}">
|
<controls:GroupBox
|
||||||
|
Grid.Row="0"
|
||||||
|
Margin="5"
|
||||||
|
BorderWidth="1"
|
||||||
|
Label="{Binding DownloadDecryptSettings.BadBookGroupboxText}">
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
|
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
|
||||||
|
|
||||||
@ -56,34 +182,38 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="0,5,0,5"
|
Margin="0,5,0,5"
|
||||||
IsChecked="{Binding DownloadDecryptSettings.BadBookAsk, Mode=TwoWay}">
|
IsChecked="{Binding DownloadDecryptSettings.BadBookAsk, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookAskText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookAskText}" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="0,5,0,5"
|
Margin="0,5,0,5"
|
||||||
IsChecked="{Binding DownloadDecryptSettings.BadBookAbort, Mode=TwoWay}">
|
IsChecked="{Binding DownloadDecryptSettings.BadBookAbort, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookAbortText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookAbortText}" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="0,5,0,5"
|
Margin="0,5,0,5"
|
||||||
IsChecked="{Binding DownloadDecryptSettings.BadBookRetry, Mode=TwoWay}">
|
IsChecked="{Binding DownloadDecryptSettings.BadBookRetry, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookRetryText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookRetryText}" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="0,5,0,5"
|
Margin="0,5,0,5"
|
||||||
IsChecked="{Binding DownloadDecryptSettings.BadBookIgnore, Mode=TwoWay}">
|
IsChecked="{Binding DownloadDecryptSettings.BadBookIgnore, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookIgnoreText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookIgnoreText}" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</controls:GroupBox>
|
</controls:GroupBox>
|
||||||
|
|
||||||
<controls:GroupBox Grid.Row="1" BorderWidth="1" Label="Custom File Naming">
|
<controls:GroupBox
|
||||||
|
Margin="5"
|
||||||
|
Grid.Row="1"
|
||||||
|
BorderWidth="1"
|
||||||
|
Label="Custom File Naming">
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*,Auto">
|
<Grid RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*,Auto">
|
||||||
|
|
||||||
@ -141,18 +271,23 @@
|
|||||||
Content="{Binding DownloadDecryptSettings.EditCharReplacementText}"
|
Content="{Binding DownloadDecryptSettings.EditCharReplacementText}"
|
||||||
Height="30"
|
Height="30"
|
||||||
Padding="30,3,30,3"
|
Padding="30,3,30,3"
|
||||||
Click="EditChapterTitleTemplateButton_Click" />
|
Click="EditCharReplacementButton_Click" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</controls:GroupBox>
|
</controls:GroupBox>
|
||||||
|
|
||||||
<controls:DirectorySelectControl
|
<StackPanel
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Subdirectory="{Binding DownloadDecryptSettings.EditCharReplacementText}"
|
Margin="5" >
|
||||||
KnownDirectories="{Binding DownloadDecryptSettings.KnownDirectories}"
|
<TextBlock Margin="0,0,0,10" Text="{Binding DownloadDecryptSettings.InProgressDescriptionText}" />
|
||||||
Selectedirectory="{Binding DownloadDecryptSettings.SelectedDirectory, Mode=TwoWay}" />
|
|
||||||
|
|
||||||
|
<controls:DirectorySelectControl
|
||||||
|
SubDirectory="Libation\DecryptInProgress"
|
||||||
|
SelectedDirectory="{Binding DownloadDecryptSettings.InProgressDirectory, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
@ -173,7 +308,6 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
BorderThickness="2"
|
BorderThickness="2"
|
||||||
Background="WhiteSmoke"
|
|
||||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
@ -184,42 +318,42 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0">
|
Grid.Column="0">
|
||||||
|
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.CreateCueSheet, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.CreateCueSheet, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.CreateCueSheetText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.CreateCueSheetText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.DownloadCoverArt, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.DownloadCoverArt, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.DownloadCoverArtText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.DownloadCoverArtText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.RetainAaxFile, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.RetainAaxFile, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.RetainAaxFileText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.RetainAaxFileText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.MergeOpeningAndEndCredits, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.MergeOpeningAndEndCredits, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.MergeOpeningEndCreditsText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.MergeOpeningEndCreditsText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.AllowLibationFixup, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.AllowLibationFixup, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.AllowLibationFixupText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.AllowLibationFixupText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<controls:GroupBox BorderWidth="1" Label="Audiobook Fix-ups" IsEnabled="{Binding AudioSettings.AllowLibationFixup}">
|
<controls:GroupBox BorderWidth="1" Label="Audiobook Fix-ups" IsEnabled="{Binding AudioSettings.AllowLibationFixup}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.SplitFilesByChapter, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.SplitFilesByChapter, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.SplitFilesByChapterText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.SplitFilesByChapterText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.StripAudibleBrandAudio, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.StripAudibleBrandAudio, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.StripAudibleBrandingText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.StripAudibleBrandingText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<CheckBox IsChecked="{Binding AudioSettings.StripUnabridged, Mode=TwoWay}">
|
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.StripUnabridged, Mode=TwoWay}">
|
||||||
<TextBlock Text="{Binding AudioSettings.StripUnabridgedText}" />
|
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.StripUnabridgedText}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<RadioButton Margin="0,5,0,5" IsChecked="{Binding !AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
<RadioButton Margin="0,5,0,5" IsChecked="{Binding !AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
||||||
<TextBlock Text="Download my books in the original audio format (Lossless)" />
|
<TextBlock TextWrapping="Wrap" Text="Download my books in the original audio format (Lossless)" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
|
|
||||||
<RadioButton Margin="0,5,0,5" IsChecked="{Binding AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
<RadioButton Margin="0,5,0,5" IsChecked="{Binding AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
||||||
<TextBlock Text="Download my books as .MP3 files (transcode if necessary)" />
|
<TextBlock TextWrapping="Wrap" Text="Download my books as .MP3 files (transcode if necessary)" />
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@ -253,7 +387,7 @@
|
|||||||
</controls:GroupBox>
|
</controls:GroupBox>
|
||||||
|
|
||||||
<CheckBox HorizontalAlignment="Right" Grid.Column="1" IsChecked="{Binding AudioSettings.LameDownsampleMono, Mode=TwoWay}">
|
<CheckBox HorizontalAlignment="Right" Grid.Column="1" IsChecked="{Binding AudioSettings.LameDownsampleMono, Mode=TwoWay}">
|
||||||
<TextBlock Text="Downsample to mono?
(Recommended)" />
|
<TextBlock TextWrapping="Wrap" Text="Downsample to mono? (Recommended)" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
<controls:GroupBox Margin="5,5,5,0" BorderWidth="1" Label="Bitrate" IsEnabled="{Binding AudioSettings.LameTargetBitrate}" >
|
<controls:GroupBox Margin="5,5,5,0" BorderWidth="1" Label="Bitrate" IsEnabled="{Binding AudioSettings.LameTargetBitrate}" >
|
||||||
@ -280,13 +414,13 @@
|
|||||||
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding AudioSettings.LameBitrate}" />
|
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding AudioSettings.LameBitrate}" />
|
||||||
<TextBlock Grid.Column="2" Text=" Kbps" />
|
<TextBlock Grid.Column="2" Text=" Kbps" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
<Grid ColumnDefinitions="*,*">
|
||||||
|
|
||||||
<CheckBox Grid.Column="0" IsChecked="{Binding AudioSettings.LameConstantBitrate, Mode=TwoWay}">
|
<CheckBox Grid.Column="0" IsChecked="{Binding AudioSettings.LameConstantBitrate, Mode=TwoWay}">
|
||||||
<TextBlock Text="Restrict Encoder to Constant Bitrate?" />
|
<TextBlock TextWrapping="Wrap" Text="Restrict Encoder to Constant Bitrate?" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox Grid.Column="1" IsChecked="{Binding AudioSettings.LameMatchSource, Mode=TwoWay}" HorizontalAlignment="Right">
|
<CheckBox Grid.Column="1" IsChecked="{Binding AudioSettings.LameMatchSource, Mode=TwoWay}" HorizontalAlignment="Right">
|
||||||
<TextBlock Text="Match Source Bitrate?" />
|
<TextBlock TextWrapping="Wrap" Text="Match Source Bitrate?" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@ -358,48 +492,6 @@
|
|||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem>
|
|
||||||
|
|
||||||
<TabItem.Header>
|
|
||||||
|
|
||||||
<TextBlock
|
|
||||||
FontSize="14"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="Important Settings"/>
|
|
||||||
|
|
||||||
</TabItem.Header>
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Grid.Row="0"
|
|
||||||
BorderThickness="2"
|
|
||||||
Background="WhiteSmoke"
|
|
||||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
|
||||||
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
<TabItem>
|
|
||||||
|
|
||||||
<TabItem.Header>
|
|
||||||
|
|
||||||
<TextBlock
|
|
||||||
FontSize="14"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="Import Library"/>
|
|
||||||
|
|
||||||
</TabItem.Header>
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Grid.Row="0"
|
|
||||||
BorderThickness="2"
|
|
||||||
Background="WhiteSmoke"
|
|
||||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
|
||||||
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -7,19 +7,31 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Dinah.Core;
|
using Dinah.Core;
|
||||||
|
using System.Linq;
|
||||||
|
using FileManager;
|
||||||
|
|
||||||
namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
||||||
{
|
{
|
||||||
public partial class SettingsDialog : DialogWindow
|
public partial class SettingsDialog : DialogWindow
|
||||||
{
|
{
|
||||||
private SettingsPages settingsDisp;
|
private SettingsPages settingsDisp;
|
||||||
|
|
||||||
|
private readonly Configuration config = Configuration.Instance;
|
||||||
public SettingsDialog()
|
public SettingsDialog()
|
||||||
{
|
{
|
||||||
if (Design.IsDesignMode)
|
if (Design.IsDesignMode)
|
||||||
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
DataContext = settingsDisp = new(Configuration.Instance);
|
DataContext = settingsDisp = new(config);
|
||||||
|
|
||||||
|
tabItem1 = this.Find<TabItem>("tabItem1");
|
||||||
|
tabItem1.GotFocus += TabItem1_GotFocus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TabItem1_GotFocus(object sender, Avalonia.Input.GotFocusEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
@ -28,8 +40,8 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
}
|
}
|
||||||
protected override async Task SaveAndCloseAsync()
|
protected override async Task SaveAndCloseAsync()
|
||||||
{
|
{
|
||||||
|
settingsDisp.SaveSettings(config);
|
||||||
|
await MessageBox.VerboseLoggingWarning_ShowIfTrue();
|
||||||
await base.SaveAndCloseAsync();
|
await base.SaveAndCloseAsync();
|
||||||
}
|
}
|
||||||
public async void SaveButton_Clicked(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public async void SaveButton_Clicked(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
@ -37,30 +49,43 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void OpenLogFolderButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void EditFolderTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public void EditFolderTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.FolderTemplate);
|
||||||
if (newTemplate is not null)
|
if (newTemplate is not null)
|
||||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
settingsDisp.DownloadDecryptSettings.FolderTemplate = newTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void EditFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public void EditFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.FileTemplate);
|
||||||
if (newTemplate is not null)
|
if (newTemplate is not null)
|
||||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
settingsDisp.DownloadDecryptSettings.FileTemplate = newTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void EditChapterFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public void EditChapterFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.ChapterFileTemplate);
|
||||||
if (newTemplate is not null)
|
if (newTemplate is not null)
|
||||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
settingsDisp.DownloadDecryptSettings.ChapterFileTemplate = newTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void EditCharReplacementButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var form = new LibationWinForms.Dialogs.EditReplacementChars(config);
|
||||||
|
form.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
public void EditChapterTitleTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public void EditChapterTitleTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
||||||
@ -84,17 +109,118 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
void SaveSettings(Configuration config);
|
void SaveSettings(Configuration config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SettingsPages
|
public class SettingsPages : ISettingsTab
|
||||||
{
|
{
|
||||||
public Configuration config { get; }
|
|
||||||
public SettingsPages(Configuration config)
|
public SettingsPages(Configuration config)
|
||||||
{
|
{
|
||||||
this.config = config;
|
LoadSettings(config);
|
||||||
AudioSettings = new(config);
|
|
||||||
DownloadDecryptSettings = new(config);
|
|
||||||
}
|
}
|
||||||
public AudioSettings AudioSettings { get;}
|
|
||||||
public DownloadDecryptSettings DownloadDecryptSettings { get;}
|
public ImportantSettings ImportantSettings { get; private set; }
|
||||||
|
public ImportSettings ImportSettings { get; private set; }
|
||||||
|
public DownloadDecryptSettings DownloadDecryptSettings { get; private set; }
|
||||||
|
public AudioSettings AudioSettings { get; private set; }
|
||||||
|
|
||||||
|
public void LoadSettings(Configuration config)
|
||||||
|
{
|
||||||
|
ImportantSettings = new(config);
|
||||||
|
ImportSettings = new(config);
|
||||||
|
DownloadDecryptSettings = new(config);
|
||||||
|
AudioSettings = new(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettings(Configuration config)
|
||||||
|
{
|
||||||
|
ImportantSettings.SaveSettings(config);
|
||||||
|
ImportSettings.SaveSettings(config);
|
||||||
|
DownloadDecryptSettings.SaveSettings(config);
|
||||||
|
AudioSettings.SaveSettings(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ImportantSettings : ISettingsTab
|
||||||
|
{
|
||||||
|
private static Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||||
|
|
||||||
|
public ImportantSettings(Configuration config)
|
||||||
|
{
|
||||||
|
LoadSettings(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadSettings(Configuration config)
|
||||||
|
{
|
||||||
|
BooksDirectory = config.Books;
|
||||||
|
SavePodcastsToParentFolder = config.SavePodcastsToParentFolder;
|
||||||
|
LoggingLevel = config.LogLevel;
|
||||||
|
BetaOptIn = config.BetaOptIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettings(Configuration config)
|
||||||
|
{
|
||||||
|
config.Books = BooksDirectory;
|
||||||
|
config.SavePodcastsToParentFolder = SavePodcastsToParentFolder;
|
||||||
|
config.LogLevel = LoggingLevel;
|
||||||
|
config.BetaOptIn = BetaOptIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Configuration.KnownDirectories> KnownDirectories { get; } = new()
|
||||||
|
{
|
||||||
|
Configuration.KnownDirectories.UserProfile,
|
||||||
|
Configuration.KnownDirectories.AppDir,
|
||||||
|
Configuration.KnownDirectories.MyDocs
|
||||||
|
};
|
||||||
|
|
||||||
|
public string BooksText => desc(nameof(Configuration.Books));
|
||||||
|
public string SavePodcastsToParentFolderText => desc(nameof(Configuration.SavePodcastsToParentFolder));
|
||||||
|
public Serilog.Events.LogEventLevel[] LoggingLevels { get; } = Enum.GetValues<Serilog.Events.LogEventLevel>();
|
||||||
|
public string BetaOptInText => desc(nameof(Configuration.BetaOptIn));
|
||||||
|
|
||||||
|
public string BooksDirectory { get; set; }
|
||||||
|
public bool SavePodcastsToParentFolder { get; set; }
|
||||||
|
public Serilog.Events.LogEventLevel LoggingLevel { get; set; }
|
||||||
|
public bool BetaOptIn { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class ImportSettings : ISettingsTab
|
||||||
|
{
|
||||||
|
private static Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||||
|
|
||||||
|
public ImportSettings(Configuration config)
|
||||||
|
{
|
||||||
|
LoadSettings(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadSettings(Configuration config)
|
||||||
|
{
|
||||||
|
AutoScan = config.AutoScan;
|
||||||
|
ShowImportedStats = config.ShowImportedStats;
|
||||||
|
ImportEpisodes = config.ImportEpisodes;
|
||||||
|
DownloadEpisodes = config.DownloadEpisodes;
|
||||||
|
AutoDownloadEpisodes = config.AutoDownloadEpisodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettings(Configuration config)
|
||||||
|
{
|
||||||
|
config.AutoScan = AutoScan;
|
||||||
|
config.ShowImportedStats = ShowImportedStats;
|
||||||
|
config.ImportEpisodes = ImportEpisodes;
|
||||||
|
config.DownloadEpisodes = DownloadEpisodes;
|
||||||
|
config.AutoDownloadEpisodes = AutoDownloadEpisodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AutoScanText => desc(nameof(Configuration.AutoScan));
|
||||||
|
public string ShowImportedStatsText => desc(nameof(Configuration.ShowImportedStats));
|
||||||
|
public string ImportEpisodesText => desc(nameof(Configuration.ImportEpisodes));
|
||||||
|
public string DownloadEpisodesText => desc(nameof(Configuration.DownloadEpisodes));
|
||||||
|
public string AutoDownloadEpisodesText => desc(nameof(Configuration.AutoDownloadEpisodes));
|
||||||
|
|
||||||
|
public bool AutoScan { get; set; }
|
||||||
|
public bool ShowImportedStats { get; set; }
|
||||||
|
public bool ImportEpisodes { get; set; }
|
||||||
|
public bool DownloadEpisodes { get; set; }
|
||||||
|
public bool AutoDownloadEpisodes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DownloadDecryptSettings : ViewModels.ViewModelBase, ISettingsTab
|
public class DownloadDecryptSettings : ViewModels.ViewModelBase, ISettingsTab
|
||||||
@ -115,6 +241,7 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
LoadSettings(config);
|
LoadSettings(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Configuration.KnownDirectories InProgressDirectory { get; set; }
|
||||||
public void LoadSettings(Configuration config)
|
public void LoadSettings(Configuration config)
|
||||||
{
|
{
|
||||||
BadBookAsk = config.BadBook is Configuration.BadBookAction.Ask;
|
BadBookAsk = config.BadBook is Configuration.BadBookAction.Ask;
|
||||||
@ -124,6 +251,9 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
FolderTemplate = config.FolderTemplate;
|
FolderTemplate = config.FolderTemplate;
|
||||||
FileTemplate = config.FileTemplate;
|
FileTemplate = config.FileTemplate;
|
||||||
ChapterFileTemplate = config.ChapterFileTemplate;
|
ChapterFileTemplate = config.ChapterFileTemplate;
|
||||||
|
InProgressDirectory
|
||||||
|
= config.InProgress == Configuration.AppDir_Absolute ? Configuration.KnownDirectories.AppDir
|
||||||
|
: Configuration.GetKnownDirectory(config.InProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSettings(Configuration config)
|
public void SaveSettings(Configuration config)
|
||||||
@ -137,6 +267,9 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
config.FolderTemplate = FolderTemplate;
|
config.FolderTemplate = FolderTemplate;
|
||||||
config.FileTemplate = FileTemplate;
|
config.FileTemplate = FileTemplate;
|
||||||
config.ChapterFileTemplate = ChapterFileTemplate;
|
config.ChapterFileTemplate = ChapterFileTemplate;
|
||||||
|
config.InProgress
|
||||||
|
= InProgressDirectory is Configuration.KnownDirectories.AppDir ? Configuration.AppDir_Absolute
|
||||||
|
: Configuration.GetKnownDirectoryPath(InProgressDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string BadBookGroupboxText => desc(nameof(Configuration.BadBook));
|
public string BadBookGroupboxText => desc(nameof(Configuration.BadBook));
|
||||||
@ -144,11 +277,11 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||||||
public string BadBookAbortText { get; } = Configuration.BadBookAction.Abort.GetDescription();
|
public string BadBookAbortText { get; } = Configuration.BadBookAction.Abort.GetDescription();
|
||||||
public string BadBookRetryText { get; } = Configuration.BadBookAction.Retry.GetDescription();
|
public string BadBookRetryText { get; } = Configuration.BadBookAction.Retry.GetDescription();
|
||||||
public string BadBookIgnoreText { get; } = Configuration.BadBookAction.Ignore.GetDescription();
|
public string BadBookIgnoreText { get; } = Configuration.BadBookAction.Ignore.GetDescription();
|
||||||
|
|
||||||
public string FolderTemplateText => desc(nameof(Configuration.FolderTemplate));
|
public string FolderTemplateText => desc(nameof(Configuration.FolderTemplate));
|
||||||
public string FileTemplateText => desc(nameof(Configuration.FileTemplate));
|
public string FileTemplateText => desc(nameof(Configuration.FileTemplate));
|
||||||
public string ChapterFileTemplateText => desc(nameof(Configuration.ChapterFileTemplate));
|
public string ChapterFileTemplateText => desc(nameof(Configuration.ChapterFileTemplate));
|
||||||
public string? EditCharReplacementText => desc(nameof(Configuration.ReplacementCharacters));
|
public string EditCharReplacementText => desc(nameof(Configuration.ReplacementCharacters));
|
||||||
|
public string InProgressDescriptionText => desc(nameof(Configuration.InProgress));
|
||||||
|
|
||||||
public string FolderTemplate { get => _folderTemplate; set { this.RaiseAndSetIfChanged(ref _folderTemplate, value); } }
|
public string FolderTemplate { get => _folderTemplate; set { this.RaiseAndSetIfChanged(ref _folderTemplate, value); } }
|
||||||
public string FileTemplate { get => _fileTemplate; set { this.RaiseAndSetIfChanged(ref _fileTemplate, value); } }
|
public string FileTemplate { get => _fileTemplate; set { this.RaiseAndSetIfChanged(ref _fileTemplate, value); } }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace LibationWinForms.AvaloniaUI.Views
|
|||||||
|
|
||||||
public async void accountsToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => await new Dialogs.AccountsDialog().ShowDialog(this);
|
public async void accountsToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => await new Dialogs.AccountsDialog().ShowDialog(this);
|
||||||
|
|
||||||
public void basicSettingsToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => new SettingsDialog().ShowDialog();
|
public async void basicSettingsToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => await new Dialogs.SettingsDialog().ShowDialog(this);
|
||||||
|
|
||||||
public async void aboutToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public async void aboutToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
=> await MessageBox.Show($"Running Libation version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}");
|
=> await MessageBox.Show($"Running Libation version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}");
|
||||||
|
|||||||
@ -67,8 +67,7 @@ namespace LibationWinForms.AvaloniaUI.Views
|
|||||||
|
|
||||||
private async void MainWindow_Opened(object sender, EventArgs e)
|
private async void MainWindow_Opened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//var settings = new SettingsDialog();
|
|
||||||
//settings.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProductsDisplay_Initialized1(object sender, EventArgs e)
|
public void ProductsDisplay_Initialized1(object sender, EventArgs e)
|
||||||
|
|||||||
@ -5,12 +5,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>Any CPU</Platform>
|
||||||
<PublishDir>..\bin\publish\</PublishDir>
|
<PublishDir>..\bin\publish\</PublishDir>
|
||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
x
Reference in New Issue
Block a user