public MainWin(bool debug)
{
LogInstance = new Logger(debug);
DBConnection = new DatabaseConnector(LogInstance);
SearchInstance = new Searcher(LogInstance);
LogInstance.WriteToFile(1, "Starting Application", LogSource);
LogInstance.WriteToFile(1, "Initializing Cache", LogSource);
DBConnection.InitializeCache();
LogInstance.WriteToFile(1, "Fetching all PC-games from the DB", LogSource);
CurGameList = DBConnection.AllGamesByPlatform("PC");
//Start the searcher in it's own thread, it shouldn't interfere with anything
LogInstance.WriteToFile(1, "Starting Searcher-Thread", LogSource);
SearchThread = new Thread(() => { SearchInstance.IntervallSearchFromDB(30); });
SearchThread.Start();
LogInstance.WriteToFile(1, "Loading Form", LogSource);
InitializeComponent();
LogInstance.WriteToFile(1, "Welcome To FreakOut!", LogSource);
btAddGame.Enabled = false;
btAddGame.Visible = false;
cBSearchResultPicker.Enabled = false;
cBSearchResultPicker.Visible = false;
bs_games.DataSource = DBConnection.FillDataTable();
dataGridView1.DataSource = bs_games;
dataGridView1.Refresh();
if (CurGameList != null)
{
for (int x = 0; x < CurGameList.Count; x++)
{
if (CurGameList[x] != null)
lboxGameList.Items.Add((x+1) + ". " + CurGameList[x].Name.Replace(":", "-") + " (ID: " + CurGameList[x].ID + ")");
}
}
else
{
lblNameOfGame.Visible = false;
lblPublisher.Visible = false;
lblPlayers.Visible = false;
lblCoOp.Visible = false;
lblRelease.Visible = false;
lblContent.Visible = false;
lblYoutube.Visible = false;
lblGenres.Visible = false;
pbGamePic.Hide();
lboxGameList.Items.Add("No games currently to display.");
}
this.FillPlatformBox();
lboxGameList.SelectedIndex = 0;
}