DisplayMagician/HeliosDisplayManagement/UIForms/SteamGamesForm.cs

61 lines
1.5 KiB
C#
Raw Normal View History

2017-02-26 19:23:31 +00:00
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using HeliosPlus.GameLibraries;
2017-02-26 19:23:31 +00:00
namespace HeliosPlus.UIForms
2017-02-26 19:23:31 +00:00
{
public partial class SteamGamesForm : Form
{
public SteamGamesForm()
{
InitializeComponent();
}
public SteamGame SteamGame { get; private set; }
2017-08-10 14:21:45 +00:00
private void lv_games_DoubleClick(object sender, EventArgs e)
{
if (btn_ok.Enabled)
2018-10-20 00:27:25 +00:00
{
2017-08-10 14:21:45 +00:00
btn_ok.PerformClick();
2018-10-20 00:27:25 +00:00
}
2017-08-10 14:21:45 +00:00
}
private void lv_games_SelectedIndexChanged(object sender, EventArgs e)
{
if (lv_games.SelectedItems.Count > 0)
2018-10-20 00:27:25 +00:00
{
2017-08-10 14:21:45 +00:00
SteamGame = lv_games.SelectedItems[0].Tag as SteamGame;
2018-10-20 00:27:25 +00:00
}
2017-08-10 14:21:45 +00:00
else
2018-10-20 00:27:25 +00:00
{
2017-08-10 14:21:45 +00:00
SteamGame = null;
2018-10-20 00:27:25 +00:00
}
2017-08-10 14:21:45 +00:00
btn_ok.Enabled = SteamGame != null;
}
2017-02-26 19:23:31 +00:00
private async void SteamGamesForm_Load(object sender, EventArgs e)
{
foreach (var game in SteamGame.GetAllInstalledGames().OrderByDescending(game => game.GameName))
2017-02-26 19:23:31 +00:00
{
il_games.Images.Add(game.GameIcon);
2018-10-20 00:27:25 +00:00
2017-02-26 19:23:31 +00:00
if (!Visible)
2018-10-20 00:27:25 +00:00
{
2017-02-26 19:23:31 +00:00
return;
2018-10-20 00:27:25 +00:00
}
2017-08-10 14:21:45 +00:00
lv_games.Items.Add(new ListViewItem
2017-02-26 19:23:31 +00:00
{
Text = game.GameName,
2017-02-26 19:23:31 +00:00
Tag = game,
ImageIndex = il_games.Images.Count - 1
});
}
}
}
}