Tidy up
This commit is contained in:
parent
8e13aa7513
commit
58a0468728
@ -20,6 +20,9 @@
|
||||
Name="replacementGrid"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="False"
|
||||
BeginningEdit="ReplacementGrid_BeginningEdit"
|
||||
CellEditEnding="ReplacementGrid_CellEditEnding"
|
||||
KeyDown="ReplacementGrid_KeyDown"
|
||||
Items="{Binding replacements}">
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
@ -20,7 +20,6 @@ namespace LibationAvalonia.Dialogs
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
replacements = new(SOURCE);
|
||||
|
||||
if (Design.IsDesignMode)
|
||||
@ -29,12 +28,6 @@ namespace LibationAvalonia.Dialogs
|
||||
}
|
||||
|
||||
DataContext = this;
|
||||
|
||||
replacementGrid = this.FindControl<DataGrid>(nameof(replacementGrid));
|
||||
replacementGrid.BeginningEdit += ReplacementGrid_BeginningEdit;
|
||||
replacementGrid.CellEditEnding += ReplacementGrid_CellEditEnding;
|
||||
replacementGrid.KeyDown += ReplacementGrid_KeyDown;
|
||||
|
||||
}
|
||||
|
||||
public EditReplacementChars(Configuration config) : this()
|
||||
@ -49,11 +42,11 @@ namespace LibationAvalonia.Dialogs
|
||||
=> LoadTable(ReplacementCharacters.LoFiDefault.Replacements);
|
||||
public void Barebones_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
=> LoadTable(ReplacementCharacters.Barebones.Replacements);
|
||||
|
||||
public void Save_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
=> SaveAndClose();
|
||||
public void Cancel_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
=> Close();
|
||||
|
||||
protected override void SaveAndClose()
|
||||
{
|
||||
var replacements = SOURCE
|
||||
@ -65,6 +58,7 @@ namespace LibationAvalonia.Dialogs
|
||||
config.ReplacementCharacters = new ReplacementCharacters { Replacements = replacements };
|
||||
base.SaveAndClose();
|
||||
}
|
||||
|
||||
private void LoadTable(IReadOnlyList<Replacement> replacements)
|
||||
{
|
||||
SOURCE.Clear();
|
||||
@ -73,7 +67,7 @@ namespace LibationAvalonia.Dialogs
|
||||
this.replacements.Refresh();
|
||||
}
|
||||
|
||||
private void ReplacementGrid_KeyDown(object sender, Avalonia.Input.KeyEventArgs e)
|
||||
public void ReplacementGrid_KeyDown(object sender, Avalonia.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Avalonia.Input.Key.Delete
|
||||
&& replacementGrid.SelectedItem is ReplacementsExt repl
|
||||
@ -84,7 +78,7 @@ namespace LibationAvalonia.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
private void ReplacementGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
public void ReplacementGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var replacement = e.Row.DataContext as ReplacementsExt;
|
||||
var colBinding = columnBindingPath(e.Column);
|
||||
@ -111,7 +105,7 @@ namespace LibationAvalonia.Dialogs
|
||||
replacement.PropertyChanged += Replacement_PropertyChanged;
|
||||
}
|
||||
|
||||
private void ReplacementGrid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
public void ReplacementGrid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
var replacement = e.Row.DataContext as ReplacementsExt;
|
||||
|
||||
|
||||
@ -37,10 +37,13 @@ Find books that you haven't rated:
|
||||
" + string.Join("\r\n", LibationSearchEngine.SearchEngine.GetSearchBoolFields());
|
||||
|
||||
IdFields = @"
|
||||
Alice's Adventures in Wonderland (ID: B015D78L0U)
|
||||
Alice's Adventures in
|
||||
Wonderland (ID: B015D78L0U)
|
||||
|
||||
id:B015D78L0U
|
||||
|
||||
All of these are synonyms for the ID field
|
||||
All of these are synonyms
|
||||
for the ID field
|
||||
|
||||
|
||||
" + string.Join("\r\n", LibationSearchEngine.SearchEngine.GetSearchIdFields());
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
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"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="330"
|
||||
MinWidth="500" MinHeight="330"
|
||||
MaxWidth="500" MaxHeight="330"
|
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="350"
|
||||
MinWidth="500" MinHeight="350"
|
||||
MaxWidth="500" MaxHeight="350"
|
||||
x:Class="LibationAvalonia.Dialogs.SetupDialog"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Icon="/Assets/libation.ico"
|
||||
Title="Welcome to Libation">
|
||||
|
||||
<Grid Margin="10" RowDefinitions="*,Auto,Auto">
|
||||
<Grid Margin="10" ColumnDefinitions="*" RowDefinitions="*,Auto,Auto">
|
||||
|
||||
<TextBlock Grid.Row="0" Text="This appears to be your first time using Libation or a previous setup was incomplete.
|
||||
<TextBlock Grid.Row="0" TextWrapping="Wrap" Text="This appears to be your first time using Libation or a previous setup was incomplete.
|
||||


|
||||

Please fill in a few settings. You can also change these settings later.
|
||||


|
||||
@ -22,11 +22,10 @@
|
||||

Download your entire library from the "Liberate" tab or
|
||||

liberate your books one at a time by clicking the stoplight." />
|
||||
|
||||
<Button
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,10"
|
||||
Padding="0,10,0,10"
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="480"
|
||||
Margin="0,0,0,10"
|
||||
Click="NewUser_Click">
|
||||
|
||||
<TextBlock
|
||||
@ -35,12 +34,11 @@
|
||||
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Padding="0,10,0,10"
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="480"
|
||||
Click="ReturningUser_Click">
|
||||
|
||||
|
||||
<TextBlock
|
||||
TextAlignment="Center"
|
||||
Text="RETURNING USER

I have previously installed Libation. This is an upgrade or re-install."/>
|
||||
|
||||
@ -31,8 +31,7 @@ namespace LibationAvalonia.ViewModels
|
||||
|
||||
public List<LibraryBook> GetVisibleBookEntries()
|
||||
=> GridEntries
|
||||
.Cast<GridEntry>()
|
||||
.BookEntries()
|
||||
.OfType<LibraryBookEntry>()
|
||||
.Select(lbe => lbe.LibraryBook)
|
||||
.ToList();
|
||||
|
||||
@ -94,9 +93,7 @@ namespace LibationAvalonia.ViewModels
|
||||
|
||||
var episodes = dbBooks.Where(lb => lb.Book.IsEpisodeChild());
|
||||
|
||||
var seriesBooks = dbBooks.Where(lb => lb.Book.IsEpisodeParent()).ToList();
|
||||
|
||||
foreach (var parent in seriesBooks)
|
||||
foreach (var parent in dbBooks.Where(lb => lb.Book.IsEpisodeParent()))
|
||||
{
|
||||
var seriesEpisodes = episodes.FindChildren(parent);
|
||||
|
||||
|
||||
@ -14,12 +14,6 @@ namespace LibationAvalonia.ViewModels
|
||||
public static IEnumerable<SeriesEntry> SeriesEntries(this IEnumerable<GridEntry> gridEntries)
|
||||
=> gridEntries.OfType<SeriesEntry>();
|
||||
|
||||
public static T? FindByAsin<T>(this IEnumerable<T> gridEntries, string audibleProductID) where T : GridEntry
|
||||
=> gridEntries.FirstOrDefault(i => i.AudibleProductId == audibleProductID);
|
||||
|
||||
public static IEnumerable<SeriesEntry> EmptySeries(this IEnumerable<GridEntry> gridEntries)
|
||||
=> gridEntries.SeriesEntries().Where(i => i.Children.Count == 0);
|
||||
|
||||
public static SeriesEntry? FindSeriesParent(this IEnumerable<GridEntry> gridEntries, LibraryBook seriesEpisode)
|
||||
{
|
||||
if (seriesEpisode.Book.SeriesLink is null) return null;
|
||||
|
||||
@ -68,8 +68,6 @@ namespace LibationAvalonia.Views
|
||||
|
||||
private async void MainWindow_Opened(object sender, EventArgs e)
|
||||
{
|
||||
var dialog = new EditReplacementChars();
|
||||
await dialog.ShowDialog(this);
|
||||
#if !DEBUG
|
||||
//This is temporaty until we have a solution for linux/mac so that
|
||||
//Libation doesn't download a zip every time it runs.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user