diff --git a/PinCab.Configurator/AddEditGameForm.Designer.cs b/PinCab.Configurator/AddEditGameForm.Designer.cs index bea2c8c..3593eef 100644 --- a/PinCab.Configurator/AddEditGameForm.Designer.cs +++ b/PinCab.Configurator/AddEditGameForm.Designer.cs @@ -597,7 +597,7 @@ private void InitializeComponent() this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnSave); this.Controls.Add(this.label1); - this.MinimumSize = new System.Drawing.Size(550, 622); + this.MinimumSize = new System.Drawing.Size(597, 622); this.Name = "AddEditGameForm"; this.Text = "Edit Game"; this.ResumeLayout(false); diff --git a/PinCab.Configurator/AddNewGameForm.Designer.cs b/PinCab.Configurator/AddNewGameForm.Designer.cs index 4585a95..83bae6e 100644 --- a/PinCab.Configurator/AddNewGameForm.Designer.cs +++ b/PinCab.Configurator/AddNewGameForm.Designer.cs @@ -74,6 +74,7 @@ private void InitializeComponent() this.Controls.Add(this.button1); this.Controls.Add(this.btnSelect); this.Controls.Add(this.lstFiles); + this.MinimumSize = new System.Drawing.Size(471, 298); this.Name = "AddNewGameForm"; this.Text = "Add New Game"; this.ResumeLayout(false); diff --git a/PinCab.Configurator/AddRelatedDatabaseEntryForm.Designer.cs b/PinCab.Configurator/AddRelatedDatabaseEntryForm.Designer.cs new file mode 100644 index 0000000..283232d --- /dev/null +++ b/PinCab.Configurator/AddRelatedDatabaseEntryForm.Designer.cs @@ -0,0 +1,356 @@ + +namespace PinCab.Configurator +{ + partial class AddRelatedDatabaseEntryForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.label1 = new System.Windows.Forms.Label(); + this.txtSearch = new System.Windows.Forms.TextBox(); + this.dataGridViewRelated = new System.Windows.Forms.DataGridView(); + this.idDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.TagsString = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.majorCategoryDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.urlDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.titleDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.fileNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.changeLogDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.authorsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.versionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.featuresDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.manufacturerDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.yearDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.playersDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.themeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ipdbNumberDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.fileSizeBytesDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.downloadCountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ratingDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lastModifiedDateUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.databaseEntryBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelated)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Search"; + // + // txtSearch + // + this.txtSearch.Location = new System.Drawing.Point(60, 10); + this.txtSearch.Name = "txtSearch"; + this.txtSearch.Size = new System.Drawing.Size(230, 20); + this.txtSearch.TabIndex = 1; + this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged); + // + // dataGridViewRelated + // + this.dataGridViewRelated.AllowUserToAddRows = false; + this.dataGridViewRelated.AllowUserToDeleteRows = false; + this.dataGridViewRelated.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewRelated.AutoGenerateColumns = false; + this.dataGridViewRelated.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; + this.dataGridViewRelated.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; + this.dataGridViewRelated.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.idDataGridViewTextBoxColumn, + this.TagsString, + this.majorCategoryDataGridViewTextBoxColumn, + this.urlDataGridViewTextBoxColumn, + this.titleDataGridViewTextBoxColumn, + this.fileNameDataGridViewTextBoxColumn, + this.descriptionDataGridViewTextBoxColumn, + this.changeLogDataGridViewTextBoxColumn, + this.authorsDataGridViewTextBoxColumn, + this.versionDataGridViewTextBoxColumn, + this.featuresDataGridViewTextBoxColumn, + this.manufacturerDataGridViewTextBoxColumn, + this.yearDataGridViewTextBoxColumn, + this.playersDataGridViewTextBoxColumn, + this.themeDataGridViewTextBoxColumn, + this.ipdbNumberDataGridViewTextBoxColumn, + this.fileSizeBytesDataGridViewTextBoxColumn, + this.downloadCountDataGridViewTextBoxColumn, + this.ratingDataGridViewTextBoxColumn, + this.lastModifiedDateUtcDataGridViewTextBoxColumn}); + this.dataGridViewRelated.DataSource = this.databaseEntryBindingSource; + this.dataGridViewRelated.Location = new System.Drawing.Point(16, 40); + this.dataGridViewRelated.Name = "dataGridViewRelated"; + this.dataGridViewRelated.ReadOnly = true; + this.dataGridViewRelated.Size = new System.Drawing.Size(772, 145); + this.dataGridViewRelated.TabIndex = 2; + this.dataGridViewRelated.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dataGridViewRelated_DataBindingComplete); + // + // idDataGridViewTextBoxColumn + // + this.idDataGridViewTextBoxColumn.DataPropertyName = "Id"; + this.idDataGridViewTextBoxColumn.HeaderText = "Id"; + this.idDataGridViewTextBoxColumn.Name = "idDataGridViewTextBoxColumn"; + this.idDataGridViewTextBoxColumn.ReadOnly = true; + this.idDataGridViewTextBoxColumn.Width = 41; + // + // TagsString + // + this.TagsString.DataPropertyName = "TagsString"; + this.TagsString.HeaderText = "TagsString"; + this.TagsString.Name = "TagsString"; + this.TagsString.ReadOnly = true; + this.TagsString.Visible = false; + // + // majorCategoryDataGridViewTextBoxColumn + // + this.majorCategoryDataGridViewTextBoxColumn.DataPropertyName = "MajorCategory"; + this.majorCategoryDataGridViewTextBoxColumn.HeaderText = "MajorCategory"; + this.majorCategoryDataGridViewTextBoxColumn.Name = "majorCategoryDataGridViewTextBoxColumn"; + this.majorCategoryDataGridViewTextBoxColumn.ReadOnly = true; + this.majorCategoryDataGridViewTextBoxColumn.Visible = false; + // + // urlDataGridViewTextBoxColumn + // + this.urlDataGridViewTextBoxColumn.DataPropertyName = "Url"; + this.urlDataGridViewTextBoxColumn.HeaderText = "Url"; + this.urlDataGridViewTextBoxColumn.Name = "urlDataGridViewTextBoxColumn"; + this.urlDataGridViewTextBoxColumn.ReadOnly = true; + this.urlDataGridViewTextBoxColumn.Width = 45; + // + // titleDataGridViewTextBoxColumn + // + this.titleDataGridViewTextBoxColumn.DataPropertyName = "Title"; + this.titleDataGridViewTextBoxColumn.HeaderText = "Title"; + this.titleDataGridViewTextBoxColumn.Name = "titleDataGridViewTextBoxColumn"; + this.titleDataGridViewTextBoxColumn.ReadOnly = true; + this.titleDataGridViewTextBoxColumn.Width = 52; + // + // fileNameDataGridViewTextBoxColumn + // + this.fileNameDataGridViewTextBoxColumn.DataPropertyName = "FileName"; + this.fileNameDataGridViewTextBoxColumn.HeaderText = "FileName"; + this.fileNameDataGridViewTextBoxColumn.Name = "fileNameDataGridViewTextBoxColumn"; + this.fileNameDataGridViewTextBoxColumn.ReadOnly = true; + this.fileNameDataGridViewTextBoxColumn.Visible = false; + // + // descriptionDataGridViewTextBoxColumn + // + this.descriptionDataGridViewTextBoxColumn.DataPropertyName = "Description"; + this.descriptionDataGridViewTextBoxColumn.HeaderText = "Description"; + this.descriptionDataGridViewTextBoxColumn.Name = "descriptionDataGridViewTextBoxColumn"; + this.descriptionDataGridViewTextBoxColumn.ReadOnly = true; + this.descriptionDataGridViewTextBoxColumn.Visible = false; + // + // changeLogDataGridViewTextBoxColumn + // + this.changeLogDataGridViewTextBoxColumn.DataPropertyName = "ChangeLog"; + this.changeLogDataGridViewTextBoxColumn.HeaderText = "ChangeLog"; + this.changeLogDataGridViewTextBoxColumn.Name = "changeLogDataGridViewTextBoxColumn"; + this.changeLogDataGridViewTextBoxColumn.ReadOnly = true; + this.changeLogDataGridViewTextBoxColumn.Visible = false; + // + // authorsDataGridViewTextBoxColumn + // + this.authorsDataGridViewTextBoxColumn.DataPropertyName = "Authors"; + this.authorsDataGridViewTextBoxColumn.HeaderText = "Authors"; + this.authorsDataGridViewTextBoxColumn.Name = "authorsDataGridViewTextBoxColumn"; + this.authorsDataGridViewTextBoxColumn.ReadOnly = true; + this.authorsDataGridViewTextBoxColumn.Visible = false; + // + // versionDataGridViewTextBoxColumn + // + this.versionDataGridViewTextBoxColumn.DataPropertyName = "Version"; + this.versionDataGridViewTextBoxColumn.HeaderText = "Version"; + this.versionDataGridViewTextBoxColumn.Name = "versionDataGridViewTextBoxColumn"; + this.versionDataGridViewTextBoxColumn.ReadOnly = true; + this.versionDataGridViewTextBoxColumn.Visible = false; + // + // featuresDataGridViewTextBoxColumn + // + this.featuresDataGridViewTextBoxColumn.DataPropertyName = "Features"; + this.featuresDataGridViewTextBoxColumn.HeaderText = "Features"; + this.featuresDataGridViewTextBoxColumn.Name = "featuresDataGridViewTextBoxColumn"; + this.featuresDataGridViewTextBoxColumn.ReadOnly = true; + this.featuresDataGridViewTextBoxColumn.Visible = false; + // + // manufacturerDataGridViewTextBoxColumn + // + this.manufacturerDataGridViewTextBoxColumn.DataPropertyName = "Manufacturer"; + this.manufacturerDataGridViewTextBoxColumn.HeaderText = "Manufacturer"; + this.manufacturerDataGridViewTextBoxColumn.Name = "manufacturerDataGridViewTextBoxColumn"; + this.manufacturerDataGridViewTextBoxColumn.ReadOnly = true; + this.manufacturerDataGridViewTextBoxColumn.Visible = false; + // + // yearDataGridViewTextBoxColumn + // + this.yearDataGridViewTextBoxColumn.DataPropertyName = "Year"; + this.yearDataGridViewTextBoxColumn.HeaderText = "Year"; + this.yearDataGridViewTextBoxColumn.Name = "yearDataGridViewTextBoxColumn"; + this.yearDataGridViewTextBoxColumn.ReadOnly = true; + this.yearDataGridViewTextBoxColumn.Visible = false; + // + // playersDataGridViewTextBoxColumn + // + this.playersDataGridViewTextBoxColumn.DataPropertyName = "Players"; + this.playersDataGridViewTextBoxColumn.HeaderText = "Players"; + this.playersDataGridViewTextBoxColumn.Name = "playersDataGridViewTextBoxColumn"; + this.playersDataGridViewTextBoxColumn.ReadOnly = true; + this.playersDataGridViewTextBoxColumn.Visible = false; + // + // themeDataGridViewTextBoxColumn + // + this.themeDataGridViewTextBoxColumn.DataPropertyName = "Theme"; + this.themeDataGridViewTextBoxColumn.HeaderText = "Theme"; + this.themeDataGridViewTextBoxColumn.Name = "themeDataGridViewTextBoxColumn"; + this.themeDataGridViewTextBoxColumn.ReadOnly = true; + this.themeDataGridViewTextBoxColumn.Visible = false; + // + // ipdbNumberDataGridViewTextBoxColumn + // + this.ipdbNumberDataGridViewTextBoxColumn.DataPropertyName = "IpdbNumber"; + this.ipdbNumberDataGridViewTextBoxColumn.HeaderText = "Ipdb #"; + this.ipdbNumberDataGridViewTextBoxColumn.Name = "ipdbNumberDataGridViewTextBoxColumn"; + this.ipdbNumberDataGridViewTextBoxColumn.ReadOnly = true; + this.ipdbNumberDataGridViewTextBoxColumn.Width = 63; + // + // fileSizeBytesDataGridViewTextBoxColumn + // + this.fileSizeBytesDataGridViewTextBoxColumn.DataPropertyName = "FileSizeBytes"; + this.fileSizeBytesDataGridViewTextBoxColumn.HeaderText = "FileSizeBytes"; + this.fileSizeBytesDataGridViewTextBoxColumn.Name = "fileSizeBytesDataGridViewTextBoxColumn"; + this.fileSizeBytesDataGridViewTextBoxColumn.ReadOnly = true; + this.fileSizeBytesDataGridViewTextBoxColumn.Visible = false; + // + // downloadCountDataGridViewTextBoxColumn + // + this.downloadCountDataGridViewTextBoxColumn.DataPropertyName = "DownloadCount"; + this.downloadCountDataGridViewTextBoxColumn.HeaderText = "DownloadCount"; + this.downloadCountDataGridViewTextBoxColumn.Name = "downloadCountDataGridViewTextBoxColumn"; + this.downloadCountDataGridViewTextBoxColumn.ReadOnly = true; + this.downloadCountDataGridViewTextBoxColumn.Visible = false; + // + // ratingDataGridViewTextBoxColumn + // + this.ratingDataGridViewTextBoxColumn.DataPropertyName = "Rating"; + this.ratingDataGridViewTextBoxColumn.HeaderText = "Rating"; + this.ratingDataGridViewTextBoxColumn.Name = "ratingDataGridViewTextBoxColumn"; + this.ratingDataGridViewTextBoxColumn.ReadOnly = true; + this.ratingDataGridViewTextBoxColumn.Visible = false; + // + // lastModifiedDateUtcDataGridViewTextBoxColumn + // + this.lastModifiedDateUtcDataGridViewTextBoxColumn.DataPropertyName = "LastModifiedDateUtc"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.HeaderText = "LastModifiedDateUtc"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.Name = "lastModifiedDateUtcDataGridViewTextBoxColumn"; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.ReadOnly = true; + this.lastModifiedDateUtcDataGridViewTextBoxColumn.Visible = false; + // + // databaseEntryBindingSource + // + this.databaseEntryBindingSource.DataSource = typeof(VirtualPinball.Database.Models.DatabaseEntry); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(122, 191); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 11; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnSave + // + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSave.Location = new System.Drawing.Point(16, 191); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(75, 23); + this.btnSave.TabIndex = 10; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // AddRelatedDatabaseEntryForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(793, 226); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.dataGridViewRelated); + this.Controls.Add(this.txtSearch); + this.Controls.Add(this.label1); + this.MinimumSize = new System.Drawing.Size(809, 265); + this.Name = "AddRelatedDatabaseEntryForm"; + this.Text = "Add Related Database Entry"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddRelatedDatabaseEntryForm_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelated)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtSearch; + private System.Windows.Forms.DataGridView dataGridViewRelated; + private System.Windows.Forms.BindingSource databaseEntryBindingSource; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.DataGridViewTextBoxColumn idDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn TagsString; + private System.Windows.Forms.DataGridViewTextBoxColumn majorCategoryDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn urlDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn titleDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn fileNameDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn descriptionDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn changeLogDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn authorsDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn versionDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn featuresDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn manufacturerDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn yearDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn playersDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn themeDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn ipdbNumberDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn fileSizeBytesDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn downloadCountDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn ratingDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn lastModifiedDateUtcDataGridViewTextBoxColumn; + } +} \ No newline at end of file diff --git a/PinCab.Configurator/AddRelatedDatabaseEntryForm.cs b/PinCab.Configurator/AddRelatedDatabaseEntryForm.cs new file mode 100644 index 0000000..d6ba0e7 --- /dev/null +++ b/PinCab.Configurator/AddRelatedDatabaseEntryForm.cs @@ -0,0 +1,133 @@ +using PinCab.Utils.Extensions; +using PinCab.Utils.Models; +using PinCab.Utils.Utils; +using PinCab.Utils.WinForms.TabOrder; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using VirtualPinball.Database.Models; + +namespace PinCab.Configurator +{ + public partial class AddRelatedDatabaseEntryForm : Form + { + private DatabaseManager _dbManager { get; set; } + private string _databaseName { get; set; } + private string _title { get; set; } + private int _currentId { get; set; } + private ProgramSettingsManager _settingsManager = new ProgramSettingsManager(); + private ProgramSettings _settings; + + public AddRelatedDatabaseEntryForm(int currentId, string databaseName, string title, DatabaseManager manager) + { + InitializeComponent(); + _dbManager = manager; + (new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); + DialogResult = DialogResult.None; + _databaseName = databaseName; + _title = title; + _currentId = currentId; + _settings = _settingsManager.LoadSettings(); + + if (_settings.DatabaseBrowserSettings?.AddRelatedWindowHeight > 0 && _settings.DatabaseBrowserSettings?.AddRelatedWindowWidth > 0) + { + this.Height = _settings.DatabaseBrowserSettings.AddRelatedWindowHeight; + this.Width = _settings.DatabaseBrowserSettings.AddRelatedWindowWidth; + } + + ConfigureGrid(); + LoadForm(); + } + + private void ConfigureGrid() + { + foreach (DataGridViewColumn column in dataGridViewRelated.Columns) + { + if (column.SortMode != DataGridViewColumnSortMode.NotSortable) + column.SortMode = DataGridViewColumnSortMode.Automatic; + column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; + column.Resizable = DataGridViewTriState.True; + } + dataGridViewRelated.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; + + int count = 1; + foreach (var setting in _settings.DatabaseBrowserSettings.AddRelatedDatabaseEntryColumnWidths) + { + if (count <= dataGridViewRelated.Columns.Count) + dataGridViewRelated.Columns[count - 1].Width = setting; + count++; + } + } + + private void LoadForm() + { + databaseEntryBindingSource.DataSource = _dbManager.Databases[_databaseName].Entries.ToSortableBindingList(); + txtSearch.Text = _title; + } + + public DatabaseEntry GetActiveRowEntry() + { + return databaseEntryBindingSource.Current as DatabaseEntry; + } + + private void btnSave_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + Close(); + } + + private void btnCancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void txtSearch_TextChanged(object sender, EventArgs e) + { + string searchTerm = txtSearch.Text.ToLower(); + //Exclude our self from the search of related entries + IEnumerable list = _dbManager.Databases[_databaseName].Entries.Where(c => c.Id != _currentId); + if (!string.IsNullOrWhiteSpace(searchTerm)) + { + list = list.Where(p => //(p.Title.FuzzyMatch(txtSearch.Text) > .1) + (p.Title != null && p.Title.ToLower().Contains(searchTerm)) + || (p.Description != null && p.Description.ToLower().Contains(searchTerm)) + || (p.TagsString != null && p.TagsString.ToLower().Contains(searchTerm)) + || (p.IpdbNumber != null && p.IpdbNumber.ToString() == searchTerm) + || (p.FileName != null && p.FileName.ToLower().Contains(searchTerm)) + ); //Search by text + } + + databaseEntryBindingSource.DataSource = list.ToSortableBindingList(); + } + + private void dataGridViewRelated_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) + { + if (e.ListChangedType != ListChangedType.Reset && _settings.DatabaseBrowserSettings.AddRelatedDatabaseEntryColumnWidths.Count == 0) + { + dataGridViewRelated.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); + } + } + + private void AddRelatedDatabaseEntryForm_FormClosing(object sender, FormClosingEventArgs e) + { + //Reload the settings, if another window updated them (such as the AddRelatedDatabaseEntryForm) + _settings = _settingsManager.LoadSettings(); + _settings.DatabaseBrowserSettings.AddRelatedDatabaseEntryColumnWidths = new List(); + foreach (DataGridViewColumn column in dataGridViewRelated.Columns) + { + _settings.DatabaseBrowserSettings.AddRelatedDatabaseEntryColumnWidths.Add(column.Width); + } + + _settings.DatabaseBrowserSettings.AddRelatedWindowHeight = this.Height; + _settings.DatabaseBrowserSettings.AddRelatedWindowWidth = this.Width; + + _settingsManager.SaveSettings(_settings); + } + } +} diff --git a/PinCab.Configurator/AddRelatedDatabaseEntryForm.resx b/PinCab.Configurator/AddRelatedDatabaseEntryForm.resx new file mode 100644 index 0000000..53f08be --- /dev/null +++ b/PinCab.Configurator/AddRelatedDatabaseEntryForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + 17, 17 + + \ No newline at end of file diff --git a/PinCab.Configurator/DatabaseBrowserForm.Designer.cs b/PinCab.Configurator/DatabaseBrowserForm.Designer.cs index 5634a11..d96133e 100644 --- a/PinCab.Configurator/DatabaseBrowserForm.Designer.cs +++ b/PinCab.Configurator/DatabaseBrowserForm.Designer.cs @@ -29,8 +29,8 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.menuStripMain = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -356,9 +356,10 @@ private void InitializeComponent() this.dataGridViewEntryList.Location = new System.Drawing.Point(0, 0); this.dataGridViewEntryList.Name = "dataGridViewEntryList"; this.dataGridViewEntryList.ReadOnly = true; - this.dataGridViewEntryList.Size = new System.Drawing.Size(1049, 187); + this.dataGridViewEntryList.Size = new System.Drawing.Size(1049, 236); this.dataGridViewEntryList.TabIndex = 2; this.dataGridViewEntryList.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewEntryList_CellDoubleClick); + this.dataGridViewEntryList.CurrentCellChanged += new System.EventHandler(this.dataGridViewEntryList_CurrentCellChanged); this.dataGridViewEntryList.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dataGridViewEntryList_DataBindingComplete); this.dataGridViewEntryList.RowContextMenuStripNeeded += new System.Windows.Forms.DataGridViewRowContextMenuStripNeededEventHandler(this.dataGridViewEntryList_RowContextMenuStripNeeded); this.dataGridViewEntryList.SelectionChanged += new System.EventHandler(this.dataGridViewEntryList_SelectionChanged); @@ -375,8 +376,8 @@ private void InitializeComponent() // DatabaseTagsString // this.DatabaseTagsString.DataPropertyName = "DatabaseTagsString"; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.DatabaseTagsString.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.DatabaseTagsString.DefaultCellStyle = dataGridViewCellStyle1; this.DatabaseTagsString.HeaderText = "Tags"; this.DatabaseTagsString.Name = "DatabaseTagsString"; this.DatabaseTagsString.ReadOnly = true; @@ -488,7 +489,7 @@ private void InitializeComponent() this.txtLog.Multiline = true; this.txtLog.Name = "txtLog"; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(1049, 87); + this.txtLog.Size = new System.Drawing.Size(1049, 82); this.txtLog.TabIndex = 4; // // splitContainerGridAndLog @@ -505,8 +506,8 @@ private void InitializeComponent() // splitContainerGridAndLog.Panel2 // this.splitContainerGridAndLog.Panel2.Controls.Add(this.txtLog); - this.splitContainerGridAndLog.Size = new System.Drawing.Size(1049, 425); - this.splitContainerGridAndLog.SplitterDistance = 334; + this.splitContainerGridAndLog.Size = new System.Drawing.Size(1049, 482); + this.splitContainerGridAndLog.SplitterDistance = 396; this.splitContainerGridAndLog.TabIndex = 5; // // splitContainerTopAndBottomGrids @@ -523,8 +524,8 @@ private void InitializeComponent() // splitContainerTopAndBottomGrids.Panel2 // this.splitContainerTopAndBottomGrids.Panel2.Controls.Add(this.dataGridViewChildEntries); - this.splitContainerTopAndBottomGrids.Size = new System.Drawing.Size(1049, 334); - this.splitContainerTopAndBottomGrids.SplitterDistance = 187; + this.splitContainerTopAndBottomGrids.Size = new System.Drawing.Size(1049, 396); + this.splitContainerTopAndBottomGrids.SplitterDistance = 236; this.splitContainerTopAndBottomGrids.TabIndex = 3; // // dataGridViewChildEntries @@ -549,7 +550,7 @@ private void InitializeComponent() this.dataGridViewChildEntries.Location = new System.Drawing.Point(0, 0); this.dataGridViewChildEntries.Name = "dataGridViewChildEntries"; this.dataGridViewChildEntries.ReadOnly = true; - this.dataGridViewChildEntries.Size = new System.Drawing.Size(1049, 143); + this.dataGridViewChildEntries.Size = new System.Drawing.Size(1049, 156); this.dataGridViewChildEntries.TabIndex = 3; this.dataGridViewChildEntries.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewChildEntries_CellDoubleClick); this.dataGridViewChildEntries.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dataGridViewChildEntries_DataBindingComplete); @@ -567,8 +568,8 @@ private void InitializeComponent() // dataGridViewTextBoxColumn2 // this.dataGridViewTextBoxColumn2.DataPropertyName = "DatabaseTagsString"; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle2; this.dataGridViewTextBoxColumn2.HeaderText = "Tags"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; @@ -680,7 +681,7 @@ private void InitializeComponent() this.toolStripStatusLabel, this.toolStripStatusLabelSpacer, this.toolStripProgressBar}); - this.statusStripBottom.Location = new System.Drawing.Point(0, 533); + this.statusStripBottom.Location = new System.Drawing.Point(0, 590); this.statusStripBottom.Name = "statusStripBottom"; this.statusStripBottom.Size = new System.Drawing.Size(1049, 22); this.statusStripBottom.TabIndex = 6; @@ -690,12 +691,13 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1049, 555); + this.ClientSize = new System.Drawing.Size(1049, 612); this.Controls.Add(this.splitContainerGridAndLog); this.Controls.Add(this.panelFilterCriteria); this.Controls.Add(this.menuStripMain); this.Controls.Add(this.statusStripBottom); this.MainMenuStrip = this.menuStripMain; + this.MinimumSize = new System.Drawing.Size(1065, 651); this.Name = "DatabaseBrowserForm"; this.Text = "Database Browser"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DatabaseBrowserForm_FormClosing); diff --git a/PinCab.Configurator/DatabaseBrowserForm.cs b/PinCab.Configurator/DatabaseBrowserForm.cs index 88a2502..a237b99 100644 --- a/PinCab.Configurator/DatabaseBrowserForm.cs +++ b/PinCab.Configurator/DatabaseBrowserForm.cs @@ -245,8 +245,10 @@ private List GetEntriesByFilterCriteria() if (!string.IsNullOrWhiteSpace(searchTerm)) { list = list.Where(p => //(p.Title.FuzzyMatch(txtSearch.Text) > .1) - p.Title.ToLower().Contains(searchTerm) - || p.Description.ToLower().Contains(searchTerm) + (p.Title != null && p.Title.ToLower().Contains(searchTerm)) + || (p.Description != null && p.Description.ToLower().Contains(searchTerm)) + || (p.IpdbId != null && p.IpdbId.ToString() == searchTerm) + || (p.DatabaseTagsString != null && p.DatabaseTagsString.ToLower().Contains(searchTerm)) ); //Search by text } @@ -696,30 +698,33 @@ private void dataGridViewEntryList_SelectionChanged(object sender, EventArgs e) private void DatabaseBrowserForm_FormClosing(object sender, FormClosingEventArgs e) { - var settings = new DatabaseBrowserSettings(); - settings.BeginDate = dateTimePickerBegin.Value; - settings.EndDate = dateTimePickerEnd.Value; - settings.SearchTerm = txtSearch.Text; - settings.TypeFilter = cmbType.SelectedItem.ToString(); - settings.DatabaseFilter = cmbDatabase.SelectedItem.ToString(); - settings.TagFilter = GetAllSelectedTags(); + //Reload the settings, if another window updated them (such as the AddRelatedDatabaseEntryForm) + _settings = _settingManager.LoadSettings(); + + if (_settings.DatabaseBrowserSettings == null) + _settings.DatabaseBrowserSettings = new DatabaseBrowserSettings(); - settings.DatabaseGridColumnWidths = new List(); + _settings.DatabaseBrowserSettings.BeginDate = dateTimePickerBegin.Value; + _settings.DatabaseBrowserSettings.EndDate = dateTimePickerEnd.Value; + _settings.DatabaseBrowserSettings.SearchTerm = txtSearch.Text; + _settings.DatabaseBrowserSettings.TypeFilter = cmbType.SelectedItem.ToString(); + _settings.DatabaseBrowserSettings.DatabaseFilter = cmbDatabase.SelectedItem.ToString(); + _settings.DatabaseBrowserSettings.TagFilter = GetAllSelectedTags(); + + _settings.DatabaseBrowserSettings.DatabaseGridColumnWidths = new List(); foreach (DataGridViewColumn column in dataGridViewEntryList.Columns) { - settings.DatabaseGridColumnWidths.Add(column.Width); + _settings.DatabaseBrowserSettings.DatabaseGridColumnWidths.Add(column.Width); } - settings.RelatedGridColumnWidths = new List(); + _settings.DatabaseBrowserSettings.RelatedGridColumnWidths = new List(); foreach (DataGridViewColumn column in dataGridViewChildEntries.Columns) { - settings.RelatedGridColumnWidths.Add(column.Width); + _settings.DatabaseBrowserSettings.RelatedGridColumnWidths.Add(column.Width); } - settings.WindowHeight = Height; - settings.WindowWidth = Width; - - _settings.DatabaseBrowserSettings = settings; + _settings.DatabaseBrowserSettings.WindowHeight = Height; + _settings.DatabaseBrowserSettings.WindowWidth = Width; _settingManager.SaveSettings(_settings); } @@ -741,6 +746,8 @@ private void editToolStripMenuItem_Click(object sender, EventArgs e) var row = GetActiveRow(); if (row != null) { + var data = dataGridViewEntryList.DataSource as BindingSource; + var rowIndex = data.IndexOf(data.Current); var entryForm = new EditDatabaseEntryForm(row.DatabaseName, row, _dbManager, _ipdbForm); var result = entryForm.ShowDialog(this); if (result == DialogResult.OK) @@ -759,21 +766,36 @@ private void editToolStripMenuItem_Click(object sender, EventArgs e) //var test = _dbManager.Databases[ row.DatabaseName].Entries.Where(c => c.Id == dbFile.Id); var databasePath = _dbManager.GetFilesystemWorkPath(contentDatabase); var databaseToSave = _dbManager.Databases[row.DatabaseName]; + databaseToSave.LastUpdateDateUtc = DateTime.UtcNow; _dbManager.SaveDatabaseCache(databaseToSave, databasePath); //Save the actual database .json file //Save the pre-processed database to the file system var existingEntry = _dbManager.Entries.FirstOrDefault(c => c.Id == dbFile.Id && c.DatabaseName == row.DatabaseName); _dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, existingEntry); + _dbManager.MapRelatedEntries(existingEntry, contentDatabase, dbFile); _dbManager.SaveDatabaseCache>(_dbManager.Entries, _dbManager.PreprocessedDatabasePath); //Refresh grid (will do that automatically) NotifyUserOfSaveWarning(); + UnselectAllRows(dataGridViewEntryList); + dataGridViewEntryList.CurrentCell = dataGridViewEntryList.Rows[rowIndex].Cells[0]; + dataGridViewEntryList.Rows[rowIndex].Selected = true; dataGridViewEntryList.Refresh(); dataGridViewChildEntries.Refresh(); } } } + private void UnselectAllRows(DataGridView gv) + { + foreach (DataGridViewRow row in gv.Rows) + { + row.Selected = false; + foreach (DataGridViewCell cell in row.Cells) + cell.Selected = false; + } + } + public void NotifyUserOfSaveWarning() { if (!notifiedOfSaveWarning) @@ -824,10 +846,10 @@ private void addNewToolStripMenuItem_Click(object sender, EventArgs e) if (databaseToSave == null) //Brand new database { databaseToSave = new PinballDatabase(); - databaseToSave.LastRefreshDateUtc = DateTime.UtcNow; databaseToSave.DatabaseFormatVersion = 1; _dbManager.Databases[database] = databaseToSave; } + databaseToSave.LastUpdateDateUtc = DateTime.UtcNow; databaseToSave.Entries.Add(dbFile); //Sync to the working path _dbManager.SaveDatabaseCache(databaseToSave, databasePath); //Save the actual database .json file @@ -835,6 +857,7 @@ private void addNewToolStripMenuItem_Click(object sender, EventArgs e) //Save the pre-processed database to the file system //var existingEntry = _dbManager.Entries.FirstOrDefault(c => c.Id == dbFile.Id); var updatedDatabaseEntry = _dbManager.GetDatabaseBrowserEntry(contentDatabase, entryForm.GetUpdatedDatabaseEntry()); + _dbManager.MapRelatedEntries(updatedDatabaseEntry, contentDatabase, dbFile); _dbManager.Entries.Add(updatedDatabaseEntry); //_dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, updatedDatabaseEntry); _dbManager.SaveDatabaseCache>(_dbManager.Entries, _dbManager.PreprocessedDatabasePath); @@ -843,6 +866,17 @@ private void addNewToolStripMenuItem_Click(object sender, EventArgs e) RebindGridUsingFilter(); NotifyUserOfSaveWarning(); + //Find row to select + //UnselectAllRows(dataGridViewEntryList); + foreach (DataGridViewRow row in dataGridViewEntryList.Rows) + { + var dbEntry = row.DataBoundItem as DatabaseBrowserEntry; + if (dbEntry.Id == dbFile.Id) + { + dataGridViewEntryList.CurrentCell = row.Cells[0]; + } + } + if (!notifiedOfNewRowMissing) { MessageBox.Show("Notice: If you do not see your new entry, check your filter criteria such as Dates, categorys, etc.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning); @@ -867,6 +901,7 @@ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) //Save the actual database .json //Save the pre-processed database to the file system + //databaseToSave.LastUpdateDateUtc = DateTime.UtcNow; NotifyUserOfSaveWarning(); } @@ -911,5 +946,12 @@ private void saveDatabasesToolStripMenuItem_Click(object sender, EventArgs e) //} } + + private void dataGridViewEntryList_CurrentCellChanged(object sender, EventArgs e) + { + var entry = GetActiveRowEntry(); + //Now bind the child grid + bindingSourceChildEntries.DataSource = entry?.RelatedEntries.ToSortableBindingList(); + } } } diff --git a/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs b/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs index 90d8e5c..d1c4e82 100644 --- a/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs +++ b/PinCab.Configurator/EditDatabaseEntryForm.Designer.cs @@ -33,10 +33,13 @@ private void InitializeComponent() this.btnCancel = new System.Windows.Forms.Button(); this.tabControlGeneral = new System.Windows.Forms.TabControl(); this.tabPageGeneral = new System.Windows.Forms.TabPage(); + this.lblReadableFileSize = new System.Windows.Forms.Label(); this.label23 = new System.Windows.Forms.Label(); this.lblLocalTime = new System.Windows.Forms.Label(); this.cmbDatabase = new System.Windows.Forms.ComboBox(); this.label22 = new System.Windows.Forms.Label(); + this.btnIpdbUrl = new System.Windows.Forms.Button(); + this.btnUrl = new System.Windows.Forms.Button(); this.btnAddTag = new System.Windows.Forms.Button(); this.txtTag = new System.Windows.Forms.TextBox(); this.lblTags = new System.Windows.Forms.Label(); @@ -86,16 +89,6 @@ private void InitializeComponent() this.label24 = new System.Windows.Forms.Label(); this.btnAddRelatedEntry = new System.Windows.Forms.Button(); this.dataGridViewRelatedEntries = new System.Windows.Forms.DataGridView(); - this.label21 = new System.Windows.Forms.Label(); - this.dataGridViewScreenshotUrls = new System.Windows.Forms.DataGridView(); - this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.label20 = new System.Windows.Forms.Label(); - this.label19 = new System.Windows.Forms.Label(); - this.dataGridViewAdditionalUrls = new System.Windows.Forms.DataGridView(); - this.Url = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.lblReadableFileSize = new System.Windows.Forms.Label(); - this.btnIpdbUrl = new System.Windows.Forms.Button(); - this.btnUrl = new System.Windows.Forms.Button(); this.idDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.majorCategoryDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.urlDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -116,6 +109,13 @@ private void InitializeComponent() this.ratingDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lastModifiedDateUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.databaseEntryBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.label21 = new System.Windows.Forms.Label(); + this.dataGridViewScreenshotUrls = new System.Windows.Forms.DataGridView(); + this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label20 = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.dataGridViewAdditionalUrls = new System.Windows.Forms.DataGridView(); + this.Url = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControlGeneral.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericRating)).BeginInit(); @@ -125,9 +125,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numericPlayers)).BeginInit(); this.tabPageAdditionalInfo.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelatedEntries)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewScreenshotUrls)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewAdditionalUrls)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).BeginInit(); this.SuspendLayout(); // // btnSave @@ -224,6 +224,15 @@ private void InitializeComponent() this.tabPageGeneral.Text = "General"; this.tabPageGeneral.UseVisualStyleBackColor = true; // + // lblReadableFileSize + // + this.lblReadableFileSize.AutoSize = true; + this.lblReadableFileSize.Location = new System.Drawing.Point(203, 480); + this.lblReadableFileSize.Name = "lblReadableFileSize"; + this.lblReadableFileSize.Size = new System.Drawing.Size(96, 13); + this.lblReadableFileSize.TabIndex = 178; + this.lblReadableFileSize.Text = "(Readable Filesize)"; + // // label23 // this.label23.AutoSize = true; @@ -259,6 +268,33 @@ private void InitializeComponent() this.label22.TabIndex = 174; this.label22.Text = "Database"; // + // btnIpdbUrl + // + this.btnIpdbUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; + this.btnIpdbUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnIpdbUrl.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnIpdbUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnIpdbUrl.ForeColor = System.Drawing.SystemColors.Control; + this.btnIpdbUrl.Location = new System.Drawing.Point(160, 453); + this.btnIpdbUrl.Name = "btnIpdbUrl"; + this.btnIpdbUrl.Size = new System.Drawing.Size(26, 23); + this.btnIpdbUrl.TabIndex = 173; + this.btnIpdbUrl.UseVisualStyleBackColor = true; + this.btnIpdbUrl.Click += new System.EventHandler(this.btnIpdbUrl_Click); + // + // btnUrl + // + this.btnUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; + this.btnUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnUrl.ForeColor = System.Drawing.SystemColors.Control; + this.btnUrl.Location = new System.Drawing.Point(499, 83); + this.btnUrl.Name = "btnUrl"; + this.btnUrl.Size = new System.Drawing.Size(26, 23); + this.btnUrl.TabIndex = 172; + this.btnUrl.UseVisualStyleBackColor = true; + this.btnUrl.Click += new System.EventHandler(this.btnUrl_Click); + // // btnAddTag // this.btnAddTag.Location = new System.Drawing.Point(279, 561); @@ -700,6 +736,7 @@ private void InitializeComponent() this.btnAddRelatedEntry.TabIndex = 137; this.btnAddRelatedEntry.Text = "Add Related Entry"; this.btnAddRelatedEntry.UseVisualStyleBackColor = true; + this.btnAddRelatedEntry.Click += new System.EventHandler(this.btnAddRelatedEntry_Click); // // dataGridViewRelatedEntries // @@ -736,112 +773,6 @@ private void InitializeComponent() this.dataGridViewRelatedEntries.Size = new System.Drawing.Size(576, 238); this.dataGridViewRelatedEntries.TabIndex = 136; // - // label21 - // - this.label21.AutoSize = true; - this.label21.Location = new System.Drawing.Point(11, 266); - this.label21.Name = "label21"; - this.label21.Size = new System.Drawing.Size(79, 13); - this.label21.TabIndex = 135; - this.label21.Text = "Related Entries"; - // - // dataGridViewScreenshotUrls - // - this.dataGridViewScreenshotUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.dataGridViewScreenshotUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; - this.dataGridViewScreenshotUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; - this.dataGridViewScreenshotUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridViewScreenshotUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.dataGridViewTextBoxColumn1}); - this.dataGridViewScreenshotUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this.dataGridViewScreenshotUrls.Location = new System.Drawing.Point(9, 152); - this.dataGridViewScreenshotUrls.Name = "dataGridViewScreenshotUrls"; - this.dataGridViewScreenshotUrls.Size = new System.Drawing.Size(575, 100); - this.dataGridViewScreenshotUrls.TabIndex = 134; - this.dataGridViewScreenshotUrls.DoubleClick += new System.EventHandler(this.dataGridViewScreenshotUrls_DoubleClick); - // - // dataGridViewTextBoxColumn1 - // - this.dataGridViewTextBoxColumn1.HeaderText = "Url"; - this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; - this.dataGridViewTextBoxColumn1.Width = 45; - // - // label20 - // - this.label20.AutoSize = true; - this.label20.Location = new System.Drawing.Point(8, 136); - this.label20.Name = "label20"; - this.label20.Size = new System.Drawing.Size(82, 13); - this.label20.TabIndex = 133; - this.label20.Text = "Screenshot Urls"; - // - // label19 - // - this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(8, 16); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(129, 13); - this.label19.TabIndex = 132; - this.label19.Text = "Additional Information Urls"; - // - // dataGridViewAdditionalUrls - // - this.dataGridViewAdditionalUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.dataGridViewAdditionalUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; - this.dataGridViewAdditionalUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; - this.dataGridViewAdditionalUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridViewAdditionalUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Url}); - this.dataGridViewAdditionalUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this.dataGridViewAdditionalUrls.Location = new System.Drawing.Point(11, 32); - this.dataGridViewAdditionalUrls.Name = "dataGridViewAdditionalUrls"; - this.dataGridViewAdditionalUrls.Size = new System.Drawing.Size(573, 100); - this.dataGridViewAdditionalUrls.TabIndex = 131; - // - // Url - // - this.Url.HeaderText = "Url"; - this.Url.Name = "Url"; - this.Url.Width = 45; - // - // lblReadableFileSize - // - this.lblReadableFileSize.AutoSize = true; - this.lblReadableFileSize.Location = new System.Drawing.Point(203, 480); - this.lblReadableFileSize.Name = "lblReadableFileSize"; - this.lblReadableFileSize.Size = new System.Drawing.Size(96, 13); - this.lblReadableFileSize.TabIndex = 178; - this.lblReadableFileSize.Text = "(Readable Filesize)"; - // - // btnIpdbUrl - // - this.btnIpdbUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; - this.btnIpdbUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnIpdbUrl.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnIpdbUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnIpdbUrl.ForeColor = System.Drawing.SystemColors.Control; - this.btnIpdbUrl.Location = new System.Drawing.Point(160, 453); - this.btnIpdbUrl.Name = "btnIpdbUrl"; - this.btnIpdbUrl.Size = new System.Drawing.Size(26, 23); - this.btnIpdbUrl.TabIndex = 173; - this.btnIpdbUrl.UseVisualStyleBackColor = true; - this.btnIpdbUrl.Click += new System.EventHandler(this.btnIpdbUrl_Click); - // - // btnUrl - // - this.btnUrl.BackgroundImage = global::PinCab.Configurator.Properties.Resources.BrowserLink_75x; - this.btnUrl.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnUrl.ForeColor = System.Drawing.SystemColors.Control; - this.btnUrl.Location = new System.Drawing.Point(499, 83); - this.btnUrl.Name = "btnUrl"; - this.btnUrl.Size = new System.Drawing.Size(26, 23); - this.btnUrl.TabIndex = 172; - this.btnUrl.UseVisualStyleBackColor = true; - this.btnUrl.Click += new System.EventHandler(this.btnUrl_Click); - // // idDataGridViewTextBoxColumn // this.idDataGridViewTextBoxColumn.DataPropertyName = "Id"; @@ -1014,6 +945,76 @@ private void InitializeComponent() // this.databaseEntryBindingSource.DataSource = typeof(VirtualPinball.Database.Models.DatabaseEntry); // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(11, 266); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(79, 13); + this.label21.TabIndex = 135; + this.label21.Text = "Related Entries"; + // + // dataGridViewScreenshotUrls + // + this.dataGridViewScreenshotUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewScreenshotUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridViewScreenshotUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; + this.dataGridViewScreenshotUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewScreenshotUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dataGridViewTextBoxColumn1}); + this.dataGridViewScreenshotUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dataGridViewScreenshotUrls.Location = new System.Drawing.Point(9, 152); + this.dataGridViewScreenshotUrls.Name = "dataGridViewScreenshotUrls"; + this.dataGridViewScreenshotUrls.Size = new System.Drawing.Size(575, 100); + this.dataGridViewScreenshotUrls.TabIndex = 134; + this.dataGridViewScreenshotUrls.DoubleClick += new System.EventHandler(this.dataGridViewScreenshotUrls_DoubleClick); + // + // dataGridViewTextBoxColumn1 + // + this.dataGridViewTextBoxColumn1.HeaderText = "Url"; + this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; + this.dataGridViewTextBoxColumn1.Width = 45; + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(8, 136); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(82, 13); + this.label20.TabIndex = 133; + this.label20.Text = "Screenshot Urls"; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(8, 16); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(129, 13); + this.label19.TabIndex = 132; + this.label19.Text = "Additional Information Urls"; + // + // dataGridViewAdditionalUrls + // + this.dataGridViewAdditionalUrls.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewAdditionalUrls.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; + this.dataGridViewAdditionalUrls.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; + this.dataGridViewAdditionalUrls.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewAdditionalUrls.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Url}); + this.dataGridViewAdditionalUrls.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dataGridViewAdditionalUrls.Location = new System.Drawing.Point(11, 32); + this.dataGridViewAdditionalUrls.Name = "dataGridViewAdditionalUrls"; + this.dataGridViewAdditionalUrls.Size = new System.Drawing.Size(573, 100); + this.dataGridViewAdditionalUrls.TabIndex = 131; + // + // Url + // + this.Url.HeaderText = "Url"; + this.Url.Name = "Url"; + this.Url.Width = 45; + // // EditDatabaseEntryForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1025,6 +1026,7 @@ private void InitializeComponent() this.MinimumSize = new System.Drawing.Size(616, 758); this.Name = "EditDatabaseEntryForm"; this.Text = "Edit Database Entry"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditDatabaseEntryForm_FormClosing); this.tabControlGeneral.ResumeLayout(false); this.tabPageGeneral.ResumeLayout(false); this.tabPageGeneral.PerformLayout(); @@ -1036,9 +1038,9 @@ private void InitializeComponent() this.tabPageAdditionalInfo.ResumeLayout(false); this.tabPageAdditionalInfo.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewRelatedEntries)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewScreenshotUrls)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewAdditionalUrls)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.databaseEntryBindingSource)).EndInit(); this.ResumeLayout(false); } diff --git a/PinCab.Configurator/EditDatabaseEntryForm.cs b/PinCab.Configurator/EditDatabaseEntryForm.cs index 1f89636..49d1768 100644 --- a/PinCab.Configurator/EditDatabaseEntryForm.cs +++ b/PinCab.Configurator/EditDatabaseEntryForm.cs @@ -27,15 +27,19 @@ public partial class EditDatabaseEntryForm : Form private IpdbBrowserForm _ipdbForm = null; private bool isNewEntry = false; private DatabaseEntry _dbEntry { get; set; } - private string _currentDatabase { get; set; } + private string _databaseName { get; set; } + private ProgramSettingsManager _settingsManager = new ProgramSettingsManager(); + private ProgramSettings _settings; + public EditDatabaseEntryForm(string databaseName, DatabaseBrowserEntry entry, DatabaseManager manager, IpdbBrowserForm ipdbForm) { InitializeComponent(); _manager = manager; _ipdbForm = ipdbForm; _entry = entry; - _currentDatabase = databaseName; + _databaseName = databaseName; DialogResult = DialogResult.None; + _settings = _settingsManager.LoadSettings(); if (entry == null) { isNewEntry = true; @@ -55,6 +59,12 @@ public EditDatabaseEntryForm(string databaseName, DatabaseBrowserEntry entry, Da private void LoadForm() { + if (_settings.DatabaseBrowserSettings?.AddEditWindowHeight > 0 && _settings.DatabaseBrowserSettings?.AddEditWindowWidth > 0) + { + this.Height = _settings.DatabaseBrowserSettings.AddEditWindowHeight; + this.Width = _settings.DatabaseBrowserSettings.AddEditWindowWidth; + } + //Load the database list var databaseNames = _manager.Databases .OrderBy(c => c.Key).Select(c => c.Key).ToList(); @@ -62,7 +72,7 @@ private void LoadForm() foreach (string databaseName in cmbDatabase.Items) { - if (databaseName == _currentDatabase) + if (databaseName == _databaseName) cmbDatabase.SelectedItem = databaseName; } @@ -101,6 +111,8 @@ private void LoadForm() numericRating.Value = _dbEntry.Rating.HasValue ? _dbEntry.Rating.Value : 0; dateTimeModified.Value = _dbEntry.LastModifiedDateUtc.HasValue ? _dbEntry.LastModifiedDateUtc.Value : DateTime.UtcNow; + lblReadableFileSize.Text = Convert.ToInt64(numericFileBytes.Value).FileSizeHumanReadable(); + if (_dbEntry.Tags != null) { foreach (var tag in _dbEntry.Tags) @@ -128,6 +140,11 @@ private void LoadForm() } } + RefreashRelatedDatabaseEntries(); + } + + private void RefreashRelatedDatabaseEntries() + { var relatedEntries = new List(); if (_dbEntry.RelatedEntries != null) { @@ -355,5 +372,36 @@ private void numericFileBytes_ValueChanged(object sender, EventArgs e) { lblReadableFileSize.Text = Convert.ToInt64(numericFileBytes.Value).FileSizeHumanReadable(); } + + private void btnAddRelatedEntry_Click(object sender, EventArgs e) + { + var form = new AddRelatedDatabaseEntryForm(_dbEntry.Id, _databaseName, txtTitle.Text, _manager); + var result = form.ShowDialog(); + if (result == DialogResult.OK) + { + var relatedEntry = form.GetActiveRowEntry(); + if (relatedEntry != null) + { + if (_dbEntry.RelatedEntries == null) + _dbEntry.RelatedEntries = new List(); + + if (!_dbEntry.RelatedEntries.Contains(relatedEntry.Id)) //Ensure it doesn't already exist + { + _dbEntry.RelatedEntries.Add(relatedEntry.Id); + RefreashRelatedDatabaseEntries(); + } + } + } + } + + private void EditDatabaseEntryForm_FormClosing(object sender, FormClosingEventArgs e) + { + //Reload the settings, if another window updated them (such as the AddRelatedDatabaseEntryForm) + _settings = _settingsManager.LoadSettings(); + _settings.DatabaseBrowserSettings.AddEditWindowHeight = this.Height; + _settings.DatabaseBrowserSettings.AddEditWindowWidth = this.Width; + + _settingsManager.SaveSettings(_settings); + } } } diff --git a/PinCab.Configurator/Pincab.Configurator.csproj b/PinCab.Configurator/Pincab.Configurator.csproj index 9913b5f..f92a2bd 100644 --- a/PinCab.Configurator/Pincab.Configurator.csproj +++ b/PinCab.Configurator/Pincab.Configurator.csproj @@ -145,8 +145,8 @@ - - ..\packages\VirtualPinball.Database.Models.1.0.14\lib\netstandard2.0\VirtualPinball.Database.Models.dll + + ..\packages\VirtualPinball.Database.Models.1.0.15\lib\netstandard2.0\VirtualPinball.Database.Models.dll ..\packages\WindowsDisplayAPI.1.3.0.13\lib\net45\WindowsDisplayAPI.dll @@ -165,6 +165,12 @@ AddDatabaseForm.cs + + Form + + + AddRelatedDatabaseEntryForm.cs + Form @@ -273,6 +279,9 @@ AddDatabaseForm.cs + + AddRelatedDatabaseEntryForm.cs + EditDatabaseEntryForm.cs diff --git a/PinCab.Configurator/SettingsForm.Designer.cs b/PinCab.Configurator/SettingsForm.Designer.cs index c3e5ece..f81aa2d 100644 --- a/PinCab.Configurator/SettingsForm.Designer.cs +++ b/PinCab.Configurator/SettingsForm.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.btnCancel = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button(); this.tabPageDatabases = new System.Windows.Forms.TabPage(); + this.btnFilePathDatabaseBrowser = new System.Windows.Forms.Button(); this.label19 = new System.Windows.Forms.Label(); this.gvContentDatabases = new System.Windows.Forms.DataGridView(); this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -103,7 +104,6 @@ private void InitializeComponent() this.btnB2SScreenresFilePath = new System.Windows.Forms.Button(); this.label8 = new System.Windows.Forms.Label(); this.tbSettings = new System.Windows.Forms.TabControl(); - this.btnFilePathDatabaseBrowser = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.tabPageDatabases.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gvContentDatabases)).BeginInit(); @@ -186,6 +186,19 @@ private void InitializeComponent() this.tabPageDatabases.Text = "Databases"; this.tabPageDatabases.UseVisualStyleBackColor = true; // + // btnFilePathDatabaseBrowser + // + this.btnFilePathDatabaseBrowser.BackgroundImage = global::PinCab.Configurator.Properties.Resources.FolderOpened_75x; + this.btnFilePathDatabaseBrowser.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.btnFilePathDatabaseBrowser.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnFilePathDatabaseBrowser.ForeColor = System.Drawing.SystemColors.Control; + this.btnFilePathDatabaseBrowser.Location = new System.Drawing.Point(532, 215); + this.btnFilePathDatabaseBrowser.Name = "btnFilePathDatabaseBrowser"; + this.btnFilePathDatabaseBrowser.Size = new System.Drawing.Size(38, 23); + this.btnFilePathDatabaseBrowser.TabIndex = 66; + this.btnFilePathDatabaseBrowser.UseVisualStyleBackColor = true; + this.btnFilePathDatabaseBrowser.Click += new System.EventHandler(this.btnFilePathDatabaseBrowser_Click); + // // label19 // this.label19.AutoSize = true; @@ -952,19 +965,6 @@ private void InitializeComponent() this.tbSettings.Size = new System.Drawing.Size(682, 363); this.tbSettings.TabIndex = 7; // - // btnFilePathDatabaseBrowser - // - this.btnFilePathDatabaseBrowser.BackgroundImage = global::PinCab.Configurator.Properties.Resources.FolderOpened_75x; - this.btnFilePathDatabaseBrowser.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.btnFilePathDatabaseBrowser.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnFilePathDatabaseBrowser.ForeColor = System.Drawing.SystemColors.Control; - this.btnFilePathDatabaseBrowser.Location = new System.Drawing.Point(532, 215); - this.btnFilePathDatabaseBrowser.Name = "btnFilePathDatabaseBrowser"; - this.btnFilePathDatabaseBrowser.Size = new System.Drawing.Size(38, 23); - this.btnFilePathDatabaseBrowser.TabIndex = 66; - this.btnFilePathDatabaseBrowser.UseVisualStyleBackColor = true; - this.btnFilePathDatabaseBrowser.Click += new System.EventHandler(this.btnFilePathDatabaseBrowser_Click); - // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -975,6 +975,7 @@ private void InitializeComponent() this.HelpButton = true; this.MaximizeBox = false; this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(698, 402); this.Name = "SettingsForm"; this.Text = "Settings"; this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.SettingsForm_HelpButtonClicked); diff --git a/PinCab.Configurator/packages.config b/PinCab.Configurator/packages.config index a16e35e..93df286 100644 --- a/PinCab.Configurator/packages.config +++ b/PinCab.Configurator/packages.config @@ -11,6 +11,6 @@ - + \ No newline at end of file diff --git a/PinCab.Utils/Models/DatabaseBrowserSettings.cs b/PinCab.Utils/Models/DatabaseBrowserSettings.cs index e585e8d..5d9a15d 100644 --- a/PinCab.Utils/Models/DatabaseBrowserSettings.cs +++ b/PinCab.Utils/Models/DatabaseBrowserSettings.cs @@ -23,6 +23,7 @@ public DatabaseBrowserSettings() TagFilter = new List(); DatabaseGridColumnWidths = new List(); RelatedGridColumnWidths = new List(); + AddRelatedDatabaseEntryColumnWidths = new List(); } public string SearchTerm { get; set; } @@ -31,10 +32,16 @@ public DatabaseBrowserSettings() public string TypeFilter { get; set; } public int WindowHeight { get; set; } public int WindowWidth { get; set; } + public int AddRelatedWindowHeight { get; set; } + public int AddRelatedWindowWidth { get; set; } + public int AddEditWindowHeight { get; set; } + public int AddEditWindowWidth { get; set; } public List TagFilter { get; set; } public string DatabaseFilter { get; set; } public List DatabaseGridColumnWidths { get; set; } public List RelatedGridColumnWidths { get; set; } + + public List AddRelatedDatabaseEntryColumnWidths { get; set; } } } diff --git a/PinCab.Utils/PinCab.Utils.csproj b/PinCab.Utils/PinCab.Utils.csproj index 44f11a1..6f3441d 100644 --- a/PinCab.Utils/PinCab.Utils.csproj +++ b/PinCab.Utils/PinCab.Utils.csproj @@ -120,8 +120,8 @@ - - ..\packages\VirtualPinball.Database.Models.1.0.14\lib\netstandard2.0\VirtualPinball.Database.Models.dll + + ..\packages\VirtualPinball.Database.Models.1.0.15\lib\netstandard2.0\VirtualPinball.Database.Models.dll ..\packages\WindowsDisplayAPI.1.3.0.13\lib\net45\WindowsDisplayAPI.dll diff --git a/PinCab.Utils/Utils/DatabaseManager.cs b/PinCab.Utils/Utils/DatabaseManager.cs index 9eb0107..c8d8536 100644 --- a/PinCab.Utils/Utils/DatabaseManager.cs +++ b/PinCab.Utils/Utils/DatabaseManager.cs @@ -326,7 +326,7 @@ public List GetDatabaseVersionMessages() entries.Add(new ValidationMessage() { Level = MessageLevel.Information, - Message = db.Key + " Database Last Updated (UTC): " + db.Value.LastRefreshDateUtc + " Local: " + db.Value.LastRefreshDateUtc.ToLocalTime() + Message = db.Key + " Database Last Updated (UTC): " + db.Value.LastUpdateDateUtc + " Local: " + db.Value.LastUpdateDateUtc.ToLocalTime() }); } } @@ -378,22 +378,7 @@ private HashSet GetDatabaseBrowserEntries(ContentDatabase else Log.Information("{tool}: Skipped adding {entry} because it didn't pass the data check.", ToolName, entry.Title); - //Add the related entries - if (databaseEntry.RelatedEntries != null) - { - foreach (var relatedEntry in databaseEntry.RelatedEntries) - { - var relatedContentEntry = Databases[database.Name].Entries.FirstOrDefault(c => c.Id == relatedEntry); - var newEntry = GetDatabaseBrowserEntry(database, relatedContentEntry); - if (IsValidBrowserEntry(newEntry)) - { - entry.RelatedEntries.Add(newEntry); - entry.Tags.UnionWith(newEntry.Tags); - } - else - Log.Information("{tool}: Skipped related entry adding {entry} because it didn't pass the data check.", ToolName, relatedContentEntry.Title); - } - } + MapRelatedEntries(entry, database, databaseEntry); } } @@ -403,6 +388,29 @@ private HashSet GetDatabaseBrowserEntries(ContentDatabase return entries; } + public void MapRelatedEntries(DatabaseBrowserEntry browserEntry, ContentDatabase database, DatabaseEntry databaseEntry) + { + //Add the related entries + if (databaseEntry.RelatedEntries != null) + { + if (browserEntry.RelatedEntries == null) + browserEntry.RelatedEntries = new HashSet(); + browserEntry.RelatedEntries.Clear(); + foreach (var relatedEntry in databaseEntry.RelatedEntries) + { + var relatedContentEntry = Databases[database.Name].Entries.FirstOrDefault(c => c.Id == relatedEntry); + var newEntry = GetDatabaseBrowserEntry(database, relatedContentEntry); + if (IsValidBrowserEntry(newEntry)) + { + browserEntry.RelatedEntries.Add(newEntry); + browserEntry.Tags.UnionWith(newEntry.Tags); + } + else + Log.Information("{tool}: Skipped related entry adding {entry} because it didn't pass the data check.", ToolName, relatedContentEntry.Title); + } + } + } + private bool IsValidBrowserEntry(DatabaseBrowserEntry entry) { if (string.IsNullOrWhiteSpace(entry.Url)) diff --git a/PinCab.Utils/packages.config b/PinCab.Utils/packages.config index dddb778..b75039d 100644 --- a/PinCab.Utils/packages.config +++ b/PinCab.Utils/packages.config @@ -12,6 +12,6 @@ - + \ No newline at end of file