mirror of
https://github.com/rmcrackan/Libation.git
synced 2025-12-23 22:17:52 -05:00
Add Account column #1398
This commit is contained in:
@@ -481,6 +481,7 @@ namespace LibationAvalonia.ViewModels
|
||||
public DataGridLength LastDownloadWidth { get => getColumnWidth("LastDownload", 100); set => setColumnWidth("LastDownload", value); }
|
||||
public DataGridLength BookTagsWidth { get => getColumnWidth("BookTags", 100); set => setColumnWidth("BookTags", value); }
|
||||
public DataGridLength IsSpatialWidth { get => getColumnWidth("IsSpatial", 100); set => setColumnWidth("IsSpatial", value); }
|
||||
public DataGridLength AccountWidth { get => getColumnWidth(nameof(GridEntry.Account), 100); set => setColumnWidth(nameof(GridEntry.Account), value); }
|
||||
|
||||
private static DataGridLength getColumnWidth(string columnName, double defaultWidth)
|
||||
=> Configuration.Instance.GridColumnsWidths.TryGetValue(columnName, out var val)
|
||||
|
||||
@@ -236,12 +236,22 @@
|
||||
<controls:DataGridTemplateColumnExt Header="Is
Spatial" MinWidth="10" Width="{CompiledBinding IsSpatialWidth, Mode=TwoWay}" CanUserSort="True" SortMemberPath="IsSpatial" ClipboardContentBinding="{Binding IsSpatial}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate x:DataType="uibase:GridEntry">
|
||||
<Panel Opacity="{CompiledBinding Liberate.Opacity}" ToolTip.Tip="{CompiledBinding LastDownload.ToolTipText}">
|
||||
<Panel Opacity="{CompiledBinding Liberate.Opacity}">
|
||||
<CheckBox IsChecked="{CompiledBinding IsSpatial}" IsEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</controls:DataGridTemplateColumnExt>
|
||||
|
||||
<controls:DataGridTemplateColumnExt Header="Account" MinWidth="10" Width="{CompiledBinding AccountWidth, Mode=TwoWay}" CanUserSort="True" SortMemberPath="Account" ClipboardContentBinding="{Binding Account}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate x:DataType="uibase:GridEntry">
|
||||
<Panel Opacity="{CompiledBinding Liberate.Opacity}">
|
||||
<TextBlock Text="{CompiledBinding Account}" TextWrapping="Wrap" />
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</controls:DataGridTemplateColumnExt>
|
||||
|
||||
<controls:DataGridTemplateColumnExt Header="Tags" MinWidth="10" Width="{CompiledBinding BookTagsWidth, Mode=TwoWay}" CanUserSort="True" SortMemberPath="BookTags" ClipboardContentBinding="{Binding BookTags}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
|
||||
@@ -211,6 +211,7 @@ namespace LibationFileManager
|
||||
new ("LastDownload", false),
|
||||
new ("IsSpatial", false),
|
||||
new ("IncludedUntil", false),
|
||||
new ("Account", false),
|
||||
]);
|
||||
public bool GetColumnVisibility(string columnName)
|
||||
=> GridColumnsVisibilities.TryGetValue(columnName, out var isVisible) ? isVisible
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace LibationUiBase.GridView
|
||||
private Rating _myRating;
|
||||
private bool _isSpatial;
|
||||
private string _includedUntil;
|
||||
private string _account;
|
||||
public abstract bool? Remove { get; set; }
|
||||
public EntryStatus Liberate { get => _liberate; private set => RaiseAndSetIfChanged(ref _liberate, value); }
|
||||
public string PurchaseDate { get => _purchasedate; protected set => RaiseAndSetIfChanged(ref _purchasedate, value); }
|
||||
@@ -68,6 +69,7 @@ namespace LibationUiBase.GridView
|
||||
public string BookTags { get => _bookTags; private set => RaiseAndSetIfChanged(ref _bookTags, value); }
|
||||
public bool IsSpatial { get => _isSpatial; protected set => RaiseAndSetIfChanged(ref _isSpatial, value); }
|
||||
public string IncludedUntil { get => _includedUntil; protected set => RaiseAndSetIfChanged(ref _includedUntil, value); }
|
||||
public string Account { get => _account; protected set => RaiseAndSetIfChanged(ref _account, value); }
|
||||
|
||||
public Rating MyRating
|
||||
{
|
||||
@@ -123,7 +125,7 @@ namespace LibationUiBase.GridView
|
||||
BookTags = GetBookTags();
|
||||
IsSpatial = Book.IsSpatial;
|
||||
IncludedUntil = GetIncludedUntilString();
|
||||
|
||||
Account = libraryBook.Account;
|
||||
|
||||
UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged;
|
||||
}
|
||||
@@ -215,6 +217,7 @@ namespace LibationUiBase.GridView
|
||||
nameof(DateAdded) => DateAdded,
|
||||
nameof(IsSpatial) => IsSpatial,
|
||||
nameof(IncludedUntil) => GetIncludedUntil() ?? default,
|
||||
nameof(Account) => Account,
|
||||
_ => null
|
||||
};
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ namespace LibationWinForms.GridView
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
gridEntryDataGridView = new System.Windows.Forms.DataGridView();
|
||||
showHideColumnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
|
||||
syncBindingSource = new SyncBindingSource(components);
|
||||
removeGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
liberateGVColumn = new LiberateDataGridViewImageButtonColumn();
|
||||
coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn();
|
||||
@@ -55,6 +53,9 @@ namespace LibationWinForms.GridView
|
||||
isSpatialGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
tagAndDetailsGVColumn = new EditTagsDataGridViewImageButtonColumn();
|
||||
includedUntilGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
showHideColumnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
|
||||
syncBindingSource = new SyncBindingSource(components);
|
||||
accountGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)gridEntryDataGridView).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)syncBindingSource).BeginInit();
|
||||
SuspendLayout();
|
||||
@@ -67,7 +68,7 @@ namespace LibationWinForms.GridView
|
||||
gridEntryDataGridView.AllowUserToResizeRows = false;
|
||||
gridEntryDataGridView.AutoGenerateColumns = false;
|
||||
gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { removeGVColumn, liberateGVColumn, coverGVColumn, titleGVColumn, authorsGVColumn, narratorsGVColumn, lengthGVColumn, seriesGVColumn, seriesOrderGVColumn, descriptionGVColumn, categoryGVColumn, productRatingGVColumn, purchaseDateGVColumn, myRatingGVColumn, miscGVColumn, lastDownloadedGVColumn, isSpatialGVColumn, tagAndDetailsGVColumn, includedUntilGVColumn });
|
||||
gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { removeGVColumn, liberateGVColumn, coverGVColumn, titleGVColumn, authorsGVColumn, narratorsGVColumn, lengthGVColumn, seriesGVColumn, seriesOrderGVColumn, descriptionGVColumn, categoryGVColumn, productRatingGVColumn, purchaseDateGVColumn, myRatingGVColumn, miscGVColumn, lastDownloadedGVColumn, isSpatialGVColumn, tagAndDetailsGVColumn, includedUntilGVColumn, accountGVColumn });
|
||||
gridEntryDataGridView.ContextMenuStrip = showHideColumnsContextMenuStrip;
|
||||
gridEntryDataGridView.DataSource = syncBindingSource;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
@@ -91,17 +92,6 @@ namespace LibationWinForms.GridView
|
||||
gridEntryDataGridView.CellContentClick += DataGridView_CellContentClick;
|
||||
gridEntryDataGridView.CellToolTipTextNeeded += gridEntryDataGridView_CellToolTipTextNeeded;
|
||||
//
|
||||
// showHideColumnsContextMenuStrip
|
||||
//
|
||||
showHideColumnsContextMenuStrip.ImageScalingSize = new System.Drawing.Size(32, 32);
|
||||
showHideColumnsContextMenuStrip.Name = "contextMenuStrip1";
|
||||
showHideColumnsContextMenuStrip.ShowCheckMargin = true;
|
||||
showHideColumnsContextMenuStrip.Size = new System.Drawing.Size(83, 4);
|
||||
//
|
||||
// syncBindingSource
|
||||
//
|
||||
syncBindingSource.DataSource = typeof(GridEntry);
|
||||
//
|
||||
// removeGVColumn
|
||||
//
|
||||
removeGVColumn.DataPropertyName = "Remove";
|
||||
@@ -284,9 +274,27 @@ namespace LibationWinForms.GridView
|
||||
includedUntilGVColumn.MinimumWidth = 10;
|
||||
includedUntilGVColumn.Name = "includedUntilGVColumn";
|
||||
includedUntilGVColumn.ReadOnly = true;
|
||||
includedUntilGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
includedUntilGVColumn.Width = 108;
|
||||
//
|
||||
// showHideColumnsContextMenuStrip
|
||||
//
|
||||
showHideColumnsContextMenuStrip.ImageScalingSize = new System.Drawing.Size(32, 32);
|
||||
showHideColumnsContextMenuStrip.Name = "contextMenuStrip1";
|
||||
showHideColumnsContextMenuStrip.ShowCheckMargin = true;
|
||||
showHideColumnsContextMenuStrip.Size = new System.Drawing.Size(83, 4);
|
||||
//
|
||||
// syncBindingSource
|
||||
//
|
||||
syncBindingSource.DataSource = typeof(GridEntry);
|
||||
//
|
||||
// accountGVColumn
|
||||
//
|
||||
accountGVColumn.DataPropertyName = "Account";
|
||||
accountGVColumn.HeaderText = "Account";
|
||||
accountGVColumn.MinimumWidth = 10;
|
||||
accountGVColumn.Name = "accountGVColumn";
|
||||
accountGVColumn.ReadOnly = true;
|
||||
//
|
||||
// ProductsGrid
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
@@ -326,5 +334,6 @@ namespace LibationWinForms.GridView
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn isSpatialGVColumn;
|
||||
private EditTagsDataGridViewImageButtonColumn tagAndDetailsGVColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn includedUntilGVColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn accountGVColumn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,9 @@
|
||||
<metadata name="isSpatialGVColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="accountGVColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="showHideColumnsContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>171, 17</value>
|
||||
</metadata>
|
||||
|
||||
Reference in New Issue
Block a user