public void SetModel(InstalledGame game) { UnbindEvents(); SetDataBindings(game); BindEvents(); }
public static PlaySession Create(InstalledGame game, int processId) { return new PlaySession() { Game = game, Version = game.Version, ProcessId = processId, StartDateTime = DateTime.UtcNow }; }
public InstalledGameListViewItem( InstalledGame installedGame ) { Game = installedGame; ImageKey = installedGame.InstanceId.ToString(); Text = installedGame.Name; SubItems.Add( Game.Version ); SubItems.Add( Game.ExecutableDirectory ); SubItems.Add( "" ); }
public void StartSession(InstalledGame game, DateTime startDateTime) { Icon = game.Icon; TabText = game.Name; CloseButton = false; CloseButtonVisible = false; this.pictureBoxArt.Image = game.Image; this.labelGameName.Text = game.Name; this.labelStartedPlaying.Text = string.Format ("Started playing on {0} at {1}", startDateTime.ToLocalTime().ToShortDateString (), startDateTime.ToLocalTime().ToShortTimeString ()); this.labelIdle.Text = ""; }
public void AddGameToListView(InstalledGame game, bool isInTopFive) { if (!imageList.Images.ContainsKey(game.InstanceId.ToString())) { imageList.Images.Add(game.InstanceId.ToString(), game.Image); } var listViewItem = new InstalledGameListViewItem(game) { Group = isInTopFive ? mostPlayedGroup : everythingElseGroup }; ListView.Items.Add(listViewItem); ListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); ListView.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.HeaderSize); }
public IgnoredGameEventArgs(bool isIgnored, InstalledGame game) { IsIgnored = isIgnored; Game = game; }
public void SetSelectedGame(InstalledGame game) { listViewGames.ListView.ItemSelectionChanged -= OnListViewItemSelected; // Iterate over the list view, find the matching item and select it listViewGames.ListView.Items.OfType<InstalledGameListViewItem>() .Where(x => x.Game == game) .ForEach(y => y.Selected = true); listViewGames.ListView.ItemSelectionChanged += OnListViewItemSelected; }
public void GameUpdated(InstalledGame game) { var listViewItem = listViewGames.ListView.Items.FirstOrDefault<InstalledGameListViewItem>((item) => item.Game.InstanceId == game.InstanceId ); if( listViewItem == null ) { GameLocated( game ); } else { listViewItem.Refresh(); } }
public void GameMissing( InstalledGame game ) { var listViewItem = listViewGames.ListView.Items.FirstOrDefault<InstalledGameListViewItem>((item) => item.Game.InstanceId == game.InstanceId ); if (listViewItem != null) { listViewItem.Text = string.Format( "{0} (Missing)", game.Name); } }
public void GameLocated(InstalledGame game) { listViewGames.AddGameToListView (game, _topFive.ContainsKey(game.Id)); }
public PlaySession StartSession( InstalledGame game, int processId ) { var playSession = new PlaySession { Game = game, Version = game.Version, ProcessId = processId, StartDateTime = DateTime.UtcNow, }; if( !sessions.ContainsKey( game.InstanceId ) ) { sessions.Add( game.InstanceId, new List<PlaySession>() ); } sessions[game.InstanceId].Add( playSession ); // Stop watching for file changes while the game is running game.StopWatchingForFileChanges(); return playSession; }
public bool HasOpenSession( InstalledGame game ) { return GetOpenSession( game.InstanceId ) != null; }
public InstalledGameEventArgs(InstalledGame installedGame, InstalledGameActions action) { InstalledGame = installedGame; Action = action; }
void SetDataBindings(InstalledGame game) { // Clear the data bindings foreach (var control in Controls[0].Controls.OfType<Control>()) { control.DataBindings.Clear(); } if (game == null) game = new InstalledGame(); Icon = game.Icon; TabText = game.Name; textBoxFolder.DataBindings.Add("Text", game, "ExecutableDirectory"); checkBoxIgnored.DataBindings.Add("Checked", game, "IsIgnored"); textBoxScreenshotPath.DataBindings.Add ("Text", game, "ScreenshotDirectory"); }