144 lines
5.1 KiB
C#
144 lines
5.1 KiB
C#
using IGDB.Models;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace KurosWhatToPlay
|
|
{
|
|
partial class MainForm
|
|
{
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && (components != null))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent() {
|
|
gameList = new DataGridView();
|
|
Id = new DataGridViewTextBoxColumn();
|
|
gameName = new DataGridViewTextBoxColumn();
|
|
backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
|
panel1 = new Panel();
|
|
consoleCbx = new ComboBox();
|
|
((System.ComponentModel.ISupportInitialize)gameList).BeginInit();
|
|
panel1.SuspendLayout();
|
|
SuspendLayout();
|
|
//
|
|
// gameList
|
|
//
|
|
gameList.AllowUserToAddRows = false;
|
|
gameList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
gameList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader;
|
|
gameList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
gameList.Columns.AddRange(new DataGridViewColumn[] { Id, gameName });
|
|
gameList.Location = new Point(12, 16);
|
|
gameList.Name = "gameList";
|
|
gameList.RowHeadersWidth = 51;
|
|
gameList.Size = new Size(477, 422);
|
|
gameList.TabIndex = 4;
|
|
gameList.Scroll += GameListScroll;
|
|
//
|
|
// Id
|
|
//
|
|
Id.HeaderText = "Id";
|
|
Id.MinimumWidth = 6;
|
|
Id.Name = "Id";
|
|
Id.Width = 6;
|
|
//
|
|
// gameName
|
|
//
|
|
gameName.HeaderText = "gameName";
|
|
gameName.MinimumWidth = 6;
|
|
gameName.Name = "gameName";
|
|
gameName.Width = 6;
|
|
//
|
|
// panel1
|
|
//
|
|
panel1.AutoSize = true;
|
|
panel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
panel1.Controls.Add(consoleCbx);
|
|
panel1.Dock = DockStyle.Right;
|
|
panel1.Location = new Point(500, 0);
|
|
panel1.MaximumSize = new Size(300, 200);
|
|
panel1.MinimumSize = new Size(300, 200);
|
|
panel1.Name = "panel1";
|
|
panel1.Padding = new Padding(0, 16, 0, 0);
|
|
panel1.Size = new Size(300, 200);
|
|
panel1.TabIndex = 5;
|
|
//
|
|
// consoleCbx
|
|
//
|
|
consoleCbx.FormattingEnabled = true;
|
|
consoleCbx.Location = new Point(104, 41);
|
|
consoleCbx.Name = "consoleCbx";
|
|
consoleCbx.Size = new Size(151, 28);
|
|
consoleCbx.TabIndex = 0;
|
|
//
|
|
// MainForm
|
|
//
|
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
AutoScaleMode = AutoScaleMode.Font;
|
|
ClientSize = new Size(800, 450);
|
|
Controls.Add(panel1);
|
|
Controls.Add(gameList);
|
|
Name = "MainForm";
|
|
Text = "Kuro's What to Play";
|
|
((System.ComponentModel.ISupportInitialize)gameList).EndInit();
|
|
panel1.ResumeLayout(false);
|
|
ResumeLayout(false);
|
|
PerformLayout();
|
|
}
|
|
|
|
public void GameListScroll(object sender, System.EventArgs e) {
|
|
int totalHeight = 0;
|
|
foreach (DataGridViewRow row in gameList.Rows)
|
|
totalHeight += row.Height;
|
|
|
|
if (totalHeight - gameList.Height < gameList.VerticalScrollingOffset) {
|
|
if (gameList.Rows.Count > 0) {
|
|
var id = gameList.Rows[gameList.Rows.Count - 1].Cells[0].Value;
|
|
if (id != null && id.GetType() == typeof(long)) {
|
|
currentID = long.Parse(id.ToString());
|
|
}
|
|
}
|
|
Igdb.GetGameNames(currentID, 200, gameList);
|
|
}
|
|
}
|
|
|
|
public void initGameList() {
|
|
Igdb.GetGameNames(0, 199, gameList);
|
|
}
|
|
|
|
public void initConsoleCbx() {
|
|
Igdb.GetConsoleNames(consoleCbx);
|
|
}
|
|
|
|
#endregion
|
|
|
|
long currentID = 0;
|
|
private DataGridView gameList;
|
|
private DataGridViewTextBoxColumn Id;
|
|
private DataGridViewTextBoxColumn gameName;
|
|
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
|
private Panel panel1;
|
|
private ComboBox consoleCbx;
|
|
}
|
|
}
|