mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Nearly completed ilv game selector
This is almost working, but the icons aren't being grabbed from the game bitmaps and loaded into the ilb_games ImageListView
This commit is contained in:
parent
dcb55f0063
commit
b84eff07ad
@ -134,6 +134,7 @@
|
|||||||
<Compile Include="UIForms\ApplyingProfileForm.Designer.cs">
|
<Compile Include="UIForms\ApplyingProfileForm.Designer.cs">
|
||||||
<DependentUpon>ApplyingProfileForm.cs</DependentUpon>
|
<DependentUpon>ApplyingProfileForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="UIForms\GameAdaptor.cs" />
|
||||||
<Compile Include="UIForms\HotkeyForm.cs">
|
<Compile Include="UIForms\HotkeyForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace DisplayMagician.GameLibraries
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace DisplayMagician.GameLibraries
|
||||||
{
|
{
|
||||||
public class Game
|
public class Game
|
||||||
{
|
{
|
||||||
@ -33,6 +35,8 @@
|
|||||||
|
|
||||||
public virtual GameStartMode StartMode { get; set; }
|
public virtual GameStartMode StartMode { get; set; }
|
||||||
|
|
||||||
|
public Bitmap GameBitmap { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ namespace DisplayMagician.GameLibraries
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Class Properties
|
#region Class Properties
|
||||||
|
|
||||||
|
public static List<Game> AllInstalledGamesInAllLibraries { get; set; }
|
||||||
public virtual List<Game> AllInstalledGames { get; set; }
|
public virtual List<Game> AllInstalledGames { get; set; }
|
||||||
|
|
||||||
public virtual int InstalledGameCount { get; set; }
|
public virtual int InstalledGameCount { get; set; }
|
||||||
|
@ -867,6 +867,36 @@ namespace DisplayMagician {
|
|||||||
logger.Error(ae, $"Program/LoadGamesInBackground exception during loadGamesActions");
|
logger.Error(ae, $"Program/LoadGamesInBackground exception during loadGamesActions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Produce a single array of Games we can reference later
|
||||||
|
GameLibrary.AllInstalledGamesInAllLibraries = SteamLibrary.GetLibrary().AllInstalledGames;
|
||||||
|
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(UplayLibrary.GetLibrary().AllInstalledGames);
|
||||||
|
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(OriginLibrary.GetLibrary().AllInstalledGames);
|
||||||
|
|
||||||
|
// Create Game Bitmaps from the Games so the rest of the program is faster later
|
||||||
|
// Get the bitmap out of the IconPath
|
||||||
|
// IconPath can be an ICO, or an EXE
|
||||||
|
foreach (var game in GameLibrary.AllInstalledGamesInAllLibraries)
|
||||||
|
{
|
||||||
|
Bitmap bm = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bm = ShortcutItem.ToSmallBitmap(game.IconPath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Error(ex, $"Program/LoadGamesInBackground: Exception building game bitmaps during load");
|
||||||
|
if (game.GameLibrary.Equals(SupportedGameLibraryType.Steam))
|
||||||
|
bm = Properties.Resources.Steam.ToBitmap();
|
||||||
|
else if (game.GameLibrary.Equals(SupportedGameLibraryType.Uplay))
|
||||||
|
bm = Properties.Resources.Uplay.ToBitmap();
|
||||||
|
else if (game.GameLibrary.Equals(SupportedGameLibraryType.Origin))
|
||||||
|
bm = Properties.Resources.Origin.ToBitmap();
|
||||||
|
else
|
||||||
|
bm = Properties.Resources.DisplayMagician.ToBitmap();
|
||||||
|
}
|
||||||
|
game.GameBitmap = bm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO replicate this failed Task handling in Actions
|
// TODO replicate this failed Task handling in Actions
|
||||||
/*bool failedAction = false;
|
/*bool failedAction = false;
|
||||||
|
213
DisplayMagician/UIForms/GameAdaptor.cs
Normal file
213
DisplayMagician/UIForms/GameAdaptor.cs
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
using DisplayMagician.GameLibraries;
|
||||||
|
using Manina.Windows.Forms;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace DisplayMagician.UIForms
|
||||||
|
{
|
||||||
|
#region Game Adaptor
|
||||||
|
/// <summary>
|
||||||
|
/// A custom item adaptor for ImageListView that reads from a Profile.
|
||||||
|
/// </summary>
|
||||||
|
class GameAdaptor : ImageListView.ImageListViewItemAdaptor
|
||||||
|
{
|
||||||
|
|
||||||
|
private bool disposed;
|
||||||
|
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="GameAdaptor"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public GameAdaptor()
|
||||||
|
{
|
||||||
|
disposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the thumbnail image for the given item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Item key.</param>
|
||||||
|
/// <param name="size">Requested image size.</param>
|
||||||
|
/// <param name="useEmbeddedThumbnails">Embedded thumbnail usage.</param>
|
||||||
|
/// <param name="useExifOrientation">true to automatically rotate images based on Exif orientation; otherwise false.</param>
|
||||||
|
/// <returns>The thumbnail image from the given item or null if an error occurs.</returns>
|
||||||
|
public override Image GetThumbnail(object key, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool useExifOrientation)
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Game game = (Game)key;
|
||||||
|
|
||||||
|
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; });
|
||||||
|
return game.GameBitmap.GetThumbnailImage(256, 256, myCallback, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Warn(ex, "GameAdapter/GetThumbnail: Exception caused while trying to get the Game Bitmap.");
|
||||||
|
|
||||||
|
// If we have a problem with converting the submitted key to a profile
|
||||||
|
// Then we return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a unique identifier for this thumbnail to be used in persistent
|
||||||
|
/// caching.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Item key.</param>
|
||||||
|
/// <param name="size">Requested image size.</param>
|
||||||
|
/// <param name="useEmbeddedThumbnails">Embedded thumbnail usage.</param>
|
||||||
|
/// <param name="useExifOrientation">true to automatically rotate images based on Exif orientation; otherwise false.</param>
|
||||||
|
/// <returns>A unique identifier string for the thumnail.</returns>
|
||||||
|
public override string GetUniqueIdentifier(object key, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool useExifOrientation)
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Game game = (Game)key;
|
||||||
|
|
||||||
|
return game.Name;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Warn(ex, "GameAdapter/GetUniqueIdentifier: Exception caused while trying to get the Game Unique Identifier.");
|
||||||
|
// If we have a problem with converting the submitted key to a Shortcut
|
||||||
|
// Then we return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the path to the source image for use in drag operations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Item key.</param>
|
||||||
|
/// <returns>The path to the source image.</returns>
|
||||||
|
public override string GetSourceImage(object key)
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string gameName = (string)key;
|
||||||
|
return gameName;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Warn(ex, "GameAdaptor/GetSourceImage : Exception caused while trying to get the Game source name.");
|
||||||
|
|
||||||
|
// If we have a problem with converting the submitted key to a profile
|
||||||
|
// Then we return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the details for the given item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Item key.</param>
|
||||||
|
/// <returns>An array of tuples containing item details or null if an error occurs.</returns>
|
||||||
|
public override Utility.Tuple<ColumnType, string, object>[] GetDetails(object key)
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<Utility.Tuple<ColumnType, string, object>> details = new List<Utility.Tuple<ColumnType, string, object>>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShortcutItem shortcut = (ShortcutItem)key;
|
||||||
|
|
||||||
|
// Get file info
|
||||||
|
if (shortcut.ShortcutBitmap is Bitmap)
|
||||||
|
{
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the Size
|
||||||
|
bool gotSize = false;
|
||||||
|
Size mySize = new Size(256, 256);
|
||||||
|
while (!gotSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySize = shortcut.ShortcutBitmap.Size;
|
||||||
|
gotSize = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
logger.Warn(ex, "ShortcutAdaptor/GetDetails: System.Drawing.Image exception caused while trying to get the ProfileBitmap Size as an Integer.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Have to do some gymnastics to get rid of the
|
||||||
|
// System.Drawing.Image exception created while accessing the SizeF
|
||||||
|
bool gotSizeF = false;
|
||||||
|
SizeF mySizeF = new SizeF(256, 256);
|
||||||
|
while (!gotSizeF)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mySizeF = shortcut.ShortcutBitmap.PhysicalDimension;
|
||||||
|
gotSizeF = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// catch the System.Drawing.Image exception created while accessing the Size
|
||||||
|
logger.Warn(ex, "ShortcutAdaptor/GetDetails: System.Drawing.Image exception caused while trying to get the ProfileBitmap Size as a Float.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = shortcut.Name;
|
||||||
|
string filepath = Path.GetDirectoryName(shortcut.SavedShortcutIconCacheFilename);
|
||||||
|
string filename = Path.GetFileName(shortcut.SavedShortcutIconCacheFilename);
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateCreated, string.Empty, now));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateAccessed, string.Empty, now));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateModified, string.Empty, now));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FileSize, string.Empty, (long)0));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FilePath, string.Empty, filepath ?? ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FolderName, string.Empty, filepath ?? ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Dimensions, string.Empty, mySize));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Resolution, string.Empty, mySizeF));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ImageDescription, string.Empty, name ?? ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.EquipmentModel, string.Empty, shortcut.UUID));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.DateTaken, string.Empty, now));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Artist, string.Empty, ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Copyright, string.Empty, ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ExposureTime, string.Empty, (float)0));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FNumber, string.Empty, (float)0));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.ISOSpeed, string.Empty, (ushort)0));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.UserComment, string.Empty, ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Rating, string.Empty, (ushort)0));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.Software, string.Empty, ""));
|
||||||
|
details.Add(new Utility.Tuple<ColumnType, string, object>(ColumnType.FocalLength, string.Empty, (float)0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return details.ToArray();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Warn(ex, "ShortcutAdapter/Utility.Tuple: Exception caused while trying to add details to the Game ImageListViewItem.");
|
||||||
|
// If we have a problem with converting the submitted key to a profile
|
||||||
|
// Then we return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using DisplayMagician.GameLibraries;
|
||||||
using DisplayMagicianShared;
|
using DisplayMagicianShared;
|
||||||
using Manina.Windows.Forms;
|
using Manina.Windows.Forms;
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ namespace DisplayMagician.UIForms
|
|||||||
|
|
||||||
Size itemPadding = new Size(4, 4);
|
Size itemPadding = new Size(4, 4);
|
||||||
bool alternate = (item.Index % 2 == 1);
|
bool alternate = (item.Index % 2 == 1);
|
||||||
Point imagePoint = new Point(bounds.X+3, bounds.Y+3);
|
Point imagePoint = new Point(bounds.X + 3, bounds.Y + 3);
|
||||||
Size imageSize = new Size();
|
Size imageSize = new Size();
|
||||||
imageSize.Height = ImageListView.ThumbnailSize.Height;
|
imageSize.Height = ImageListView.ThumbnailSize.Height;
|
||||||
imageSize.Width = ImageListView.ThumbnailSize.Width;
|
imageSize.Width = ImageListView.ThumbnailSize.Width;
|
||||||
@ -91,7 +92,7 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw the image
|
// Draw the image
|
||||||
Image img = ImageUtils.RoundCorners(item.GetCachedImage(CachedImageType.Thumbnail),20);
|
Image img = ImageUtils.RoundCorners(item.GetCachedImage(CachedImageType.Thumbnail), 20);
|
||||||
if (img != null)
|
if (img != null)
|
||||||
{
|
{
|
||||||
Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize));
|
Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize));
|
||||||
@ -132,7 +133,7 @@ namespace DisplayMagician.UIForms
|
|||||||
using (Pen pOuterBorder = new Pen(ImageListView.Colors.ImageOuterBorderColor))
|
using (Pen pOuterBorder = new Pen(ImageListView.Colors.ImageOuterBorderColor))
|
||||||
{
|
{
|
||||||
//g.DrawRectangle(pOuterBorder, pos);
|
//g.DrawRectangle(pOuterBorder, pos);
|
||||||
ImageUtils.DrawRoundedRectangle(g, pOuterBorder, pos,9);
|
ImageUtils.DrawRoundedRectangle(g, pOuterBorder, pos, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ namespace DisplayMagician.UIForms
|
|||||||
|
|
||||||
if ((state & ItemState.Selected) != ItemState.None)
|
if ((state & ItemState.Selected) != ItemState.None)
|
||||||
{
|
{
|
||||||
using (Pen pSelectedBorder = new Pen(Color.Brown,4))
|
using (Pen pSelectedBorder = new Pen(Color.Brown, 4))
|
||||||
{
|
{
|
||||||
//DrawRoundedRectangle(g, pSelectedBorder, bounds, 9);
|
//DrawRoundedRectangle(g, pSelectedBorder, bounds, 9);
|
||||||
//Utility.DrawRoundedRectangle(g, pSelectedBorder, bounds.Left+3, bounds.Top+3, bounds.Width - 5, bounds.Height - 5, 10);
|
//Utility.DrawRoundedRectangle(g, pSelectedBorder, bounds.Left+3, bounds.Top+3, bounds.Width - 5, bounds.Height - 5, 10);
|
||||||
@ -342,5 +343,134 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#pragma warning disable CS3009 // Base type is not CLS-compliant
|
||||||
|
public class GameILVRenderer : ImageListView.ImageListViewRenderer
|
||||||
|
#pragma warning restore CS3009 // Base type is not CLS-compliant
|
||||||
|
{
|
||||||
|
// Returns item size for the given view mode.
|
||||||
|
#pragma warning disable CS3001 // Argument type is not CLS-compliant
|
||||||
|
public override Size MeasureItem(Manina.Windows.Forms.View view)
|
||||||
|
#pragma warning restore CS3001 // Argument type is not CLS-compliant
|
||||||
|
{
|
||||||
|
// Reference text height
|
||||||
|
int textHeight = ImageListView.Font.Height;
|
||||||
|
|
||||||
|
Size itemSize = new Size();
|
||||||
|
|
||||||
|
itemSize.Height = ImageListView.ThumbnailSize.Height + 2 * textHeight + 4 * 3;
|
||||||
|
itemSize.Width = ImageListView.ThumbnailSize.Width + 4 * 3;
|
||||||
|
return itemSize;
|
||||||
|
}
|
||||||
|
// Draws the background of the control.
|
||||||
|
public override void DrawBackground(Graphics g, Rectangle bounds)
|
||||||
|
{
|
||||||
|
if (ImageListView.View == Manina.Windows.Forms.View.Thumbnails)
|
||||||
|
g.Clear(Color.FromArgb(255, 255, 255));
|
||||||
|
else
|
||||||
|
base.DrawBackground(g, bounds);
|
||||||
|
}
|
||||||
|
// Draws the specified item on the given graphics.
|
||||||
|
#pragma warning disable CS3001 // Argument type is not CLS-compliant
|
||||||
|
public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds)
|
||||||
|
#pragma warning restore CS3001 // Argument type is not CLS-compliant
|
||||||
|
{
|
||||||
|
if (g is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(g));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
Size itemPadding = new Size(4, 4);
|
||||||
|
bool alternate = (item.Index % 2 == 1);
|
||||||
|
Point imagePoint = new Point(bounds.X + 3, bounds.Y + 3);
|
||||||
|
Size imageSize = new Size();
|
||||||
|
imageSize.Height = ImageListView.ThumbnailSize.Height;
|
||||||
|
imageSize.Width = ImageListView.ThumbnailSize.Width;
|
||||||
|
Rectangle imageBounds = new Rectangle(imagePoint, imageSize);
|
||||||
|
|
||||||
|
// Paint background
|
||||||
|
if (ImageListView.Enabled)
|
||||||
|
{
|
||||||
|
using (Brush bItemBack = new SolidBrush(alternate && ImageListView.View == Manina.Windows.Forms.View.Details ?
|
||||||
|
ImageListView.Colors.AlternateBackColor : ImageListView.Colors.BackColor))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bItemBack, bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (Brush bItemBack = new SolidBrush(ImageListView.Colors.DisabledBackColor))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bItemBack, bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((state & ItemState.Selected) != ItemState.None)
|
||||||
|
{
|
||||||
|
//using (Brush bSelected = new LinearGradientBrush(bounds, ImageListView.Colors.SelectedColor1, ImageListView.Colors.SelectedColor2, LinearGradientMode.Vertical))
|
||||||
|
using (Brush bSelected = new LinearGradientBrush(bounds, Color.WhiteSmoke, Color.LightGray, LinearGradientMode.Vertical))
|
||||||
|
{
|
||||||
|
Utility.FillRoundedRectangle(g, bSelected, imageBounds, 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the image
|
||||||
|
Image img = ImageUtils.RoundCorners(item.GetCachedImage(CachedImageType.Thumbnail), 20);
|
||||||
|
if (img != null)
|
||||||
|
{
|
||||||
|
Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize));
|
||||||
|
|
||||||
|
foreach (Game gameToTest in GameLibrary.AllInstalledGamesInAllLibraries)
|
||||||
|
{
|
||||||
|
if (gameToTest.Name.Equals(item.Text))
|
||||||
|
{
|
||||||
|
// Draw the full color image as the shortcuts is not invalid
|
||||||
|
g.DrawImage(img, pos);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw image border
|
||||||
|
if (Math.Min(pos.Width, pos.Height) > 32)
|
||||||
|
{
|
||||||
|
using (Pen pOuterBorder = new Pen(ImageListView.Colors.ImageOuterBorderColor))
|
||||||
|
{
|
||||||
|
//g.DrawRectangle(pOuterBorder, pos);
|
||||||
|
ImageUtils.DrawRoundedRectangle(g, pOuterBorder, pos, 9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw item text
|
||||||
|
Color foreColor = ImageListView.Colors.ForeColor;
|
||||||
|
if ((state & ItemState.Disabled) != ItemState.None)
|
||||||
|
{
|
||||||
|
foreColor = ImageListView.Colors.DisabledForeColor;
|
||||||
|
}
|
||||||
|
else if ((state & ItemState.Selected) != ItemState.None)
|
||||||
|
{
|
||||||
|
if (ImageListView.Focused)
|
||||||
|
foreColor = ImageListView.Colors.SelectedForeColor;
|
||||||
|
else
|
||||||
|
foreColor = ImageListView.Colors.UnFocusedForeColor;
|
||||||
|
}
|
||||||
|
Size szt = TextRenderer.MeasureText(item.Text, ImageListView.Font);
|
||||||
|
Rectangle rt = new Rectangle(bounds.Left + itemPadding.Width, bounds.Top + itemPadding.Height + ImageListView.ThumbnailSize.Height + 4, ImageListView.ThumbnailSize.Width, 3 * szt.Height);
|
||||||
|
TextFormatFlags flags = TextFormatFlags.EndEllipsis | TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.WordBreak;
|
||||||
|
TextRenderer.DrawText(g, item.Text, ImageListView.Font, rt, foreColor, flags);
|
||||||
|
|
||||||
|
if ((state & ItemState.Selected) != ItemState.None)
|
||||||
|
{
|
||||||
|
using (Pen pSelectedBorder = new Pen(Color.Brown, 4))
|
||||||
|
{
|
||||||
|
//DrawRoundedRectangle(g, pSelectedBorder, bounds, 9);
|
||||||
|
Utility.DrawRoundedRectangle(g, pSelectedBorder, imageBounds.Left + 1, imageBounds.Top + 1, imageBounds.Width, imageBounds.Height, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
168
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
168
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
@ -68,6 +68,8 @@ namespace DisplayMagician.UIForms
|
|||||||
this.rb_change_audio = new System.Windows.Forms.RadioButton();
|
this.rb_change_audio = new System.Windows.Forms.RadioButton();
|
||||||
this.rb_no_change_audio = new System.Windows.Forms.RadioButton();
|
this.rb_no_change_audio = new System.Windows.Forms.RadioButton();
|
||||||
this.tabp_before = new System.Windows.Forms.TabPage();
|
this.tabp_before = new System.Windows.Forms.TabPage();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.btn_add_new_start_program = new System.Windows.Forms.Button();
|
||||||
this.flp_start_programs = new System.Windows.Forms.FlowLayoutPanel();
|
this.flp_start_programs = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.tabp_game = new System.Windows.Forms.TabPage();
|
this.tabp_game = new System.Windows.Forms.TabPage();
|
||||||
this.lbl_no_game_libraries = new System.Windows.Forms.Label();
|
this.lbl_no_game_libraries = new System.Windows.Forms.Label();
|
||||||
@ -93,15 +95,10 @@ namespace DisplayMagician.UIForms
|
|||||||
this.txt_game_name = new System.Windows.Forms.TextBox();
|
this.txt_game_name = new System.Windows.Forms.TextBox();
|
||||||
this.lbl_game_library = new System.Windows.Forms.Label();
|
this.lbl_game_library = new System.Windows.Forms.Label();
|
||||||
this.lbl_game_name = new System.Windows.Forms.Label();
|
this.lbl_game_name = new System.Windows.Forms.Label();
|
||||||
this.btn_choose_game = new System.Windows.Forms.Button();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.txt_args_game = new System.Windows.Forms.TextBox();
|
this.txt_args_game = new System.Windows.Forms.TextBox();
|
||||||
this.cb_args_game = new System.Windows.Forms.CheckBox();
|
this.cb_args_game = new System.Windows.Forms.CheckBox();
|
||||||
this.lbl_game_timeout = new System.Windows.Forms.Label();
|
this.lbl_game_timeout = new System.Windows.Forms.Label();
|
||||||
this.nud_timeout_game = new System.Windows.Forms.NumericUpDown();
|
this.nud_timeout_game = new System.Windows.Forms.NumericUpDown();
|
||||||
this.lv_games = new System.Windows.Forms.ListView();
|
|
||||||
this.clm_images = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
|
||||||
this.clm_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
|
||||||
this.rb_launcher = new System.Windows.Forms.RadioButton();
|
this.rb_launcher = new System.Windows.Forms.RadioButton();
|
||||||
this.tabp_after = new System.Windows.Forms.TabPage();
|
this.tabp_after = new System.Windows.Forms.TabPage();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
@ -119,8 +116,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.cb_autosuggest = new System.Windows.Forms.CheckBox();
|
this.cb_autosuggest = new System.Windows.Forms.CheckBox();
|
||||||
this.btn_hotkey = new System.Windows.Forms.Button();
|
this.btn_hotkey = new System.Windows.Forms.Button();
|
||||||
this.lbl_hotkey_assigned = new System.Windows.Forms.Label();
|
this.lbl_hotkey_assigned = new System.Windows.Forms.Label();
|
||||||
this.btn_add_new_start_program = new System.Windows.Forms.Button();
|
this.ilv_games = new Manina.Windows.Forms.ImageListView();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.tabc_shortcut.SuspendLayout();
|
this.tabc_shortcut.SuspendLayout();
|
||||||
this.tabp_display.SuspendLayout();
|
this.tabp_display.SuspendLayout();
|
||||||
this.tabp_audio.SuspendLayout();
|
this.tabp_audio.SuspendLayout();
|
||||||
@ -630,6 +626,33 @@ namespace DisplayMagician.UIForms
|
|||||||
this.tabp_before.TabIndex = 1;
|
this.tabp_before.TabIndex = 1;
|
||||||
this.tabp_before.Text = "3. Choose what happens before";
|
this.tabp_before.Text = "3. Choose what happens before";
|
||||||
//
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(138, 24);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(807, 20);
|
||||||
|
this.label3.TabIndex = 39;
|
||||||
|
this.label3.Text = "Add one or more additional programs to start before the main Game starts. They wi" +
|
||||||
|
"ll start in the order listed below.";
|
||||||
|
//
|
||||||
|
// btn_add_new_start_program
|
||||||
|
//
|
||||||
|
this.btn_add_new_start_program.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btn_add_new_start_program.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed;
|
||||||
|
this.btn_add_new_start_program.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
|
||||||
|
this.btn_add_new_start_program.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.btn_add_new_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.btn_add_new_start_program.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.btn_add_new_start_program.Location = new System.Drawing.Point(424, 61);
|
||||||
|
this.btn_add_new_start_program.Name = "btn_add_new_start_program";
|
||||||
|
this.btn_add_new_start_program.Size = new System.Drawing.Size(235, 40);
|
||||||
|
this.btn_add_new_start_program.TabIndex = 38;
|
||||||
|
this.btn_add_new_start_program.Text = "&Add Start Program";
|
||||||
|
this.btn_add_new_start_program.UseVisualStyleBackColor = true;
|
||||||
|
this.btn_add_new_start_program.Click += new System.EventHandler(this.btn_add_new_start_program_Click);
|
||||||
|
//
|
||||||
// flp_start_programs
|
// flp_start_programs
|
||||||
//
|
//
|
||||||
this.flp_start_programs.AllowDrop = true;
|
this.flp_start_programs.AllowDrop = true;
|
||||||
@ -670,7 +693,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.lbl_no_game_libraries.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
|
this.lbl_no_game_libraries.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
|
||||||
this.lbl_no_game_libraries.ForeColor = System.Drawing.Color.White;
|
this.lbl_no_game_libraries.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_no_game_libraries.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
this.lbl_no_game_libraries.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||||
this.lbl_no_game_libraries.Location = new System.Drawing.Point(401, 307);
|
this.lbl_no_game_libraries.Location = new System.Drawing.Point(375, 262);
|
||||||
this.lbl_no_game_libraries.Name = "lbl_no_game_libraries";
|
this.lbl_no_game_libraries.Name = "lbl_no_game_libraries";
|
||||||
this.lbl_no_game_libraries.Size = new System.Drawing.Size(280, 22);
|
this.lbl_no_game_libraries.Size = new System.Drawing.Size(280, 22);
|
||||||
this.lbl_no_game_libraries.TabIndex = 34;
|
this.lbl_no_game_libraries.TabIndex = 34;
|
||||||
@ -853,6 +876,7 @@ namespace DisplayMagician.UIForms
|
|||||||
//
|
//
|
||||||
// p_game
|
// p_game
|
||||||
//
|
//
|
||||||
|
this.p_game.Controls.Add(this.ilv_games);
|
||||||
this.p_game.Controls.Add(this.cb_wait_alternative_game);
|
this.p_game.Controls.Add(this.cb_wait_alternative_game);
|
||||||
this.p_game.Controls.Add(this.btn_choose_alternative_game);
|
this.p_game.Controls.Add(this.btn_choose_alternative_game);
|
||||||
this.p_game.Controls.Add(this.txt_alternative_game);
|
this.p_game.Controls.Add(this.txt_alternative_game);
|
||||||
@ -860,26 +884,24 @@ namespace DisplayMagician.UIForms
|
|||||||
this.p_game.Controls.Add(this.txt_game_name);
|
this.p_game.Controls.Add(this.txt_game_name);
|
||||||
this.p_game.Controls.Add(this.lbl_game_library);
|
this.p_game.Controls.Add(this.lbl_game_library);
|
||||||
this.p_game.Controls.Add(this.lbl_game_name);
|
this.p_game.Controls.Add(this.lbl_game_name);
|
||||||
this.p_game.Controls.Add(this.btn_choose_game);
|
|
||||||
this.p_game.Controls.Add(this.label1);
|
|
||||||
this.p_game.Controls.Add(this.txt_args_game);
|
this.p_game.Controls.Add(this.txt_args_game);
|
||||||
this.p_game.Controls.Add(this.cb_args_game);
|
this.p_game.Controls.Add(this.cb_args_game);
|
||||||
this.p_game.Controls.Add(this.lbl_game_timeout);
|
this.p_game.Controls.Add(this.lbl_game_timeout);
|
||||||
this.p_game.Controls.Add(this.nud_timeout_game);
|
this.p_game.Controls.Add(this.nud_timeout_game);
|
||||||
this.p_game.Controls.Add(this.lv_games);
|
this.p_game.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.p_game.Location = new System.Drawing.Point(34, 292);
|
this.p_game.Location = new System.Drawing.Point(3, 292);
|
||||||
this.p_game.Name = "p_game";
|
this.p_game.Name = "p_game";
|
||||||
this.p_game.Size = new System.Drawing.Size(1006, 278);
|
this.p_game.Size = new System.Drawing.Size(1076, 323);
|
||||||
this.p_game.TabIndex = 7;
|
this.p_game.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// cb_wait_alternative_game
|
// cb_wait_alternative_game
|
||||||
//
|
//
|
||||||
this.cb_wait_alternative_game.AutoSize = true;
|
this.cb_wait_alternative_game.AutoSize = true;
|
||||||
this.cb_wait_alternative_game.Location = new System.Drawing.Point(451, 214);
|
this.cb_wait_alternative_game.Location = new System.Drawing.Point(555, 45);
|
||||||
this.cb_wait_alternative_game.Name = "cb_wait_alternative_game";
|
this.cb_wait_alternative_game.Name = "cb_wait_alternative_game";
|
||||||
this.cb_wait_alternative_game.Size = new System.Drawing.Size(220, 44);
|
this.cb_wait_alternative_game.Size = new System.Drawing.Size(229, 24);
|
||||||
this.cb_wait_alternative_game.TabIndex = 27;
|
this.cb_wait_alternative_game.TabIndex = 27;
|
||||||
this.cb_wait_alternative_game.Text = "Wait until this executable \r\nis closed before continuing:";
|
this.cb_wait_alternative_game.Text = "Monitor different executable:";
|
||||||
this.cb_wait_alternative_game.UseVisualStyleBackColor = true;
|
this.cb_wait_alternative_game.UseVisualStyleBackColor = true;
|
||||||
this.cb_wait_alternative_game.CheckedChanged += new System.EventHandler(this.cb_wait_alternative_game_CheckedChanged);
|
this.cb_wait_alternative_game.CheckedChanged += new System.EventHandler(this.cb_wait_alternative_game_CheckedChanged);
|
||||||
//
|
//
|
||||||
@ -888,7 +910,7 @@ namespace DisplayMagician.UIForms
|
|||||||
this.btn_choose_alternative_game.Enabled = false;
|
this.btn_choose_alternative_game.Enabled = false;
|
||||||
this.btn_choose_alternative_game.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.btn_choose_alternative_game.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.btn_choose_alternative_game.ForeColor = System.Drawing.Color.White;
|
this.btn_choose_alternative_game.ForeColor = System.Drawing.Color.White;
|
||||||
this.btn_choose_alternative_game.Location = new System.Drawing.Point(878, 224);
|
this.btn_choose_alternative_game.Location = new System.Drawing.Point(983, 42);
|
||||||
this.btn_choose_alternative_game.Name = "btn_choose_alternative_game";
|
this.btn_choose_alternative_game.Name = "btn_choose_alternative_game";
|
||||||
this.btn_choose_alternative_game.Size = new System.Drawing.Size(85, 27);
|
this.btn_choose_alternative_game.Size = new System.Drawing.Size(85, 27);
|
||||||
this.btn_choose_alternative_game.TabIndex = 26;
|
this.btn_choose_alternative_game.TabIndex = 26;
|
||||||
@ -899,14 +921,14 @@ namespace DisplayMagician.UIForms
|
|||||||
// txt_alternative_game
|
// txt_alternative_game
|
||||||
//
|
//
|
||||||
this.txt_alternative_game.Enabled = false;
|
this.txt_alternative_game.Enabled = false;
|
||||||
this.txt_alternative_game.Location = new System.Drawing.Point(667, 225);
|
this.txt_alternative_game.Location = new System.Drawing.Point(788, 43);
|
||||||
this.txt_alternative_game.Name = "txt_alternative_game";
|
this.txt_alternative_game.Name = "txt_alternative_game";
|
||||||
this.txt_alternative_game.Size = new System.Drawing.Size(205, 26);
|
this.txt_alternative_game.Size = new System.Drawing.Size(193, 26);
|
||||||
this.txt_alternative_game.TabIndex = 24;
|
this.txt_alternative_game.TabIndex = 24;
|
||||||
//
|
//
|
||||||
// txt_game_launcher
|
// txt_game_launcher
|
||||||
//
|
//
|
||||||
this.txt_game_launcher.Location = new System.Drawing.Point(605, 76);
|
this.txt_game_launcher.Location = new System.Drawing.Point(150, 43);
|
||||||
this.txt_game_launcher.Name = "txt_game_launcher";
|
this.txt_game_launcher.Name = "txt_game_launcher";
|
||||||
this.txt_game_launcher.ReadOnly = true;
|
this.txt_game_launcher.ReadOnly = true;
|
||||||
this.txt_game_launcher.Size = new System.Drawing.Size(149, 26);
|
this.txt_game_launcher.Size = new System.Drawing.Size(149, 26);
|
||||||
@ -914,17 +936,17 @@ namespace DisplayMagician.UIForms
|
|||||||
//
|
//
|
||||||
// txt_game_name
|
// txt_game_name
|
||||||
//
|
//
|
||||||
this.txt_game_name.Location = new System.Drawing.Point(605, 117);
|
this.txt_game_name.Location = new System.Drawing.Point(150, 11);
|
||||||
this.txt_game_name.Name = "txt_game_name";
|
this.txt_game_name.Name = "txt_game_name";
|
||||||
this.txt_game_name.ReadOnly = true;
|
this.txt_game_name.ReadOnly = true;
|
||||||
this.txt_game_name.Size = new System.Drawing.Size(360, 26);
|
this.txt_game_name.Size = new System.Drawing.Size(385, 26);
|
||||||
this.txt_game_name.TabIndex = 21;
|
this.txt_game_name.TabIndex = 21;
|
||||||
//
|
//
|
||||||
// lbl_game_library
|
// lbl_game_library
|
||||||
//
|
//
|
||||||
this.lbl_game_library.AutoSize = true;
|
this.lbl_game_library.AutoSize = true;
|
||||||
this.lbl_game_library.ForeColor = System.Drawing.Color.White;
|
this.lbl_game_library.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_game_library.Location = new System.Drawing.Point(490, 79);
|
this.lbl_game_library.Location = new System.Drawing.Point(36, 46);
|
||||||
this.lbl_game_library.Name = "lbl_game_library";
|
this.lbl_game_library.Name = "lbl_game_library";
|
||||||
this.lbl_game_library.Size = new System.Drawing.Size(108, 20);
|
this.lbl_game_library.Size = new System.Drawing.Size(108, 20);
|
||||||
this.lbl_game_library.TabIndex = 18;
|
this.lbl_game_library.TabIndex = 18;
|
||||||
@ -935,55 +957,27 @@ namespace DisplayMagician.UIForms
|
|||||||
//
|
//
|
||||||
this.lbl_game_name.AutoSize = true;
|
this.lbl_game_name.AutoSize = true;
|
||||||
this.lbl_game_name.ForeColor = System.Drawing.Color.White;
|
this.lbl_game_name.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_game_name.Location = new System.Drawing.Point(496, 120);
|
this.lbl_game_name.Location = new System.Drawing.Point(25, 14);
|
||||||
this.lbl_game_name.Name = "lbl_game_name";
|
this.lbl_game_name.Name = "lbl_game_name";
|
||||||
this.lbl_game_name.Size = new System.Drawing.Size(103, 20);
|
this.lbl_game_name.Size = new System.Drawing.Size(124, 20);
|
||||||
this.lbl_game_name.TabIndex = 17;
|
this.lbl_game_name.TabIndex = 17;
|
||||||
this.lbl_game_name.Text = "Game Name:";
|
this.lbl_game_name.Text = "Selected Game:";
|
||||||
this.lbl_game_name.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.lbl_game_name.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
this.lbl_game_name.Paint += new System.Windows.Forms.PaintEventHandler(this.label_Paint);
|
this.lbl_game_name.Paint += new System.Windows.Forms.PaintEventHandler(this.label_Paint);
|
||||||
//
|
//
|
||||||
// btn_choose_game
|
|
||||||
//
|
|
||||||
this.btn_choose_game.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed;
|
|
||||||
this.btn_choose_game.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
|
|
||||||
this.btn_choose_game.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.btn_choose_game.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.btn_choose_game.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.btn_choose_game.Location = new System.Drawing.Point(408, 117);
|
|
||||||
this.btn_choose_game.Name = "btn_choose_game";
|
|
||||||
this.btn_choose_game.Size = new System.Drawing.Size(40, 46);
|
|
||||||
this.btn_choose_game.TabIndex = 16;
|
|
||||||
this.btn_choose_game.Text = ">>";
|
|
||||||
this.btn_choose_game.UseVisualStyleBackColor = true;
|
|
||||||
this.btn_choose_game.Click += new System.EventHandler(this.btn_choose_game_Click);
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label1.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label1.Location = new System.Drawing.Point(19, 7);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(132, 20);
|
|
||||||
this.label1.TabIndex = 15;
|
|
||||||
this.label1.Text = "Games detected:";
|
|
||||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
|
||||||
this.label1.Paint += new System.Windows.Forms.PaintEventHandler(this.label_Paint);
|
|
||||||
//
|
|
||||||
// txt_args_game
|
// txt_args_game
|
||||||
//
|
//
|
||||||
this.txt_args_game.Enabled = false;
|
this.txt_args_game.Enabled = false;
|
||||||
this.txt_args_game.Location = new System.Drawing.Point(605, 179);
|
this.txt_args_game.Location = new System.Drawing.Point(788, 11);
|
||||||
this.txt_args_game.Name = "txt_args_game";
|
this.txt_args_game.Name = "txt_args_game";
|
||||||
this.txt_args_game.Size = new System.Drawing.Size(360, 26);
|
this.txt_args_game.Size = new System.Drawing.Size(279, 26);
|
||||||
this.txt_args_game.TabIndex = 13;
|
this.txt_args_game.TabIndex = 13;
|
||||||
//
|
//
|
||||||
// cb_args_game
|
// cb_args_game
|
||||||
//
|
//
|
||||||
this.cb_args_game.AutoSize = true;
|
this.cb_args_game.AutoSize = true;
|
||||||
this.cb_args_game.ForeColor = System.Drawing.Color.White;
|
this.cb_args_game.ForeColor = System.Drawing.Color.White;
|
||||||
this.cb_args_game.Location = new System.Drawing.Point(605, 149);
|
this.cb_args_game.Location = new System.Drawing.Point(555, 13);
|
||||||
this.cb_args_game.Name = "cb_args_game";
|
this.cb_args_game.Name = "cb_args_game";
|
||||||
this.cb_args_game.Size = new System.Drawing.Size(213, 24);
|
this.cb_args_game.Size = new System.Drawing.Size(213, 24);
|
||||||
this.cb_args_game.TabIndex = 12;
|
this.cb_args_game.TabIndex = 12;
|
||||||
@ -997,7 +991,7 @@ namespace DisplayMagician.UIForms
|
|||||||
//
|
//
|
||||||
this.lbl_game_timeout.AutoSize = true;
|
this.lbl_game_timeout.AutoSize = true;
|
||||||
this.lbl_game_timeout.ForeColor = System.Drawing.Color.White;
|
this.lbl_game_timeout.ForeColor = System.Drawing.Color.White;
|
||||||
this.lbl_game_timeout.Location = new System.Drawing.Point(783, 79);
|
this.lbl_game_timeout.Location = new System.Drawing.Point(349, 45);
|
||||||
this.lbl_game_timeout.Name = "lbl_game_timeout";
|
this.lbl_game_timeout.Name = "lbl_game_timeout";
|
||||||
this.lbl_game_timeout.Size = new System.Drawing.Size(125, 20);
|
this.lbl_game_timeout.Size = new System.Drawing.Size(125, 20);
|
||||||
this.lbl_game_timeout.TabIndex = 4;
|
this.lbl_game_timeout.TabIndex = 4;
|
||||||
@ -1006,7 +1000,7 @@ namespace DisplayMagician.UIForms
|
|||||||
//
|
//
|
||||||
// nud_timeout_game
|
// nud_timeout_game
|
||||||
//
|
//
|
||||||
this.nud_timeout_game.Location = new System.Drawing.Point(911, 77);
|
this.nud_timeout_game.Location = new System.Drawing.Point(480, 43);
|
||||||
this.nud_timeout_game.Maximum = new decimal(new int[] {
|
this.nud_timeout_game.Maximum = new decimal(new int[] {
|
||||||
240,
|
240,
|
||||||
0,
|
0,
|
||||||
@ -1021,21 +1015,6 @@ namespace DisplayMagician.UIForms
|
|||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
//
|
//
|
||||||
// lv_games
|
|
||||||
//
|
|
||||||
this.lv_games.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
|
||||||
this.clm_images,
|
|
||||||
this.clm_name});
|
|
||||||
this.lv_games.HideSelection = false;
|
|
||||||
this.lv_games.LargeImageList = this.il_games;
|
|
||||||
this.lv_games.Location = new System.Drawing.Point(23, 30);
|
|
||||||
this.lv_games.Name = "lv_games";
|
|
||||||
this.lv_games.Size = new System.Drawing.Size(338, 221);
|
|
||||||
this.lv_games.SmallImageList = this.il_games;
|
|
||||||
this.lv_games.TabIndex = 22;
|
|
||||||
this.lv_games.UseCompatibleStateImageBehavior = false;
|
|
||||||
this.lv_games.DoubleClick += new System.EventHandler(this.btn_choose_game_Click);
|
|
||||||
//
|
|
||||||
// rb_launcher
|
// rb_launcher
|
||||||
//
|
//
|
||||||
this.rb_launcher.AutoSize = true;
|
this.rb_launcher.AutoSize = true;
|
||||||
@ -1265,32 +1244,17 @@ namespace DisplayMagician.UIForms
|
|||||||
this.lbl_hotkey_assigned.Visible = false;
|
this.lbl_hotkey_assigned.Visible = false;
|
||||||
this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click);
|
this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click);
|
||||||
//
|
//
|
||||||
// btn_add_new_start_program
|
// ilv_games
|
||||||
//
|
//
|
||||||
this.btn_add_new_start_program.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.ilv_games.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
this.ilv_games.Location = new System.Drawing.Point(0, 97);
|
||||||
this.btn_add_new_start_program.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed;
|
this.ilv_games.Name = "ilv_games";
|
||||||
this.btn_add_new_start_program.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
|
this.ilv_games.PersistentCacheDirectory = "";
|
||||||
this.btn_add_new_start_program.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.ilv_games.PersistentCacheSize = ((long)(100));
|
||||||
this.btn_add_new_start_program.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.ilv_games.Size = new System.Drawing.Size(1076, 226);
|
||||||
this.btn_add_new_start_program.ForeColor = System.Drawing.Color.White;
|
this.ilv_games.TabIndex = 28;
|
||||||
this.btn_add_new_start_program.Location = new System.Drawing.Point(424, 61);
|
this.ilv_games.UseWIC = true;
|
||||||
this.btn_add_new_start_program.Name = "btn_add_new_start_program";
|
this.ilv_games.ItemClick += new Manina.Windows.Forms.ItemClickEventHandler(this.ilv_games_ItemClick);
|
||||||
this.btn_add_new_start_program.Size = new System.Drawing.Size(235, 40);
|
|
||||||
this.btn_add_new_start_program.TabIndex = 38;
|
|
||||||
this.btn_add_new_start_program.Text = "&Add Start Program";
|
|
||||||
this.btn_add_new_start_program.UseVisualStyleBackColor = true;
|
|
||||||
this.btn_add_new_start_program.Click += new System.EventHandler(this.btn_add_new_start_program_Click);
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(138, 24);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(807, 20);
|
|
||||||
this.label3.TabIndex = 39;
|
|
||||||
this.label3.Text = "Add one or more additional programs to start before the main Game starts. They wi" +
|
|
||||||
"ll start in the order listed below.";
|
|
||||||
//
|
//
|
||||||
// ShortcutForm
|
// ShortcutForm
|
||||||
//
|
//
|
||||||
@ -1376,15 +1340,10 @@ namespace DisplayMagician.UIForms
|
|||||||
private System.Windows.Forms.TextBox txt_game_name;
|
private System.Windows.Forms.TextBox txt_game_name;
|
||||||
private System.Windows.Forms.Label lbl_game_library;
|
private System.Windows.Forms.Label lbl_game_library;
|
||||||
private System.Windows.Forms.Label lbl_game_name;
|
private System.Windows.Forms.Label lbl_game_name;
|
||||||
private System.Windows.Forms.Button btn_choose_game;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.TextBox txt_args_game;
|
private System.Windows.Forms.TextBox txt_args_game;
|
||||||
private System.Windows.Forms.CheckBox cb_args_game;
|
private System.Windows.Forms.CheckBox cb_args_game;
|
||||||
private System.Windows.Forms.Label lbl_game_timeout;
|
private System.Windows.Forms.Label lbl_game_timeout;
|
||||||
private System.Windows.Forms.NumericUpDown nud_timeout_game;
|
private System.Windows.Forms.NumericUpDown nud_timeout_game;
|
||||||
private System.Windows.Forms.ListView lv_games;
|
|
||||||
private System.Windows.Forms.ColumnHeader clm_images;
|
|
||||||
private System.Windows.Forms.ColumnHeader clm_name;
|
|
||||||
private System.Windows.Forms.RadioButton rb_launcher;
|
private System.Windows.Forms.RadioButton rb_launcher;
|
||||||
private System.Windows.Forms.RadioButton rb_no_game;
|
private System.Windows.Forms.RadioButton rb_no_game;
|
||||||
private System.Windows.Forms.Panel p_standalone;
|
private System.Windows.Forms.Panel p_standalone;
|
||||||
@ -1445,5 +1404,6 @@ namespace DisplayMagician.UIForms
|
|||||||
private System.Windows.Forms.FlowLayoutPanel flp_start_programs;
|
private System.Windows.Forms.FlowLayoutPanel flp_start_programs;
|
||||||
private System.Windows.Forms.Button btn_add_new_start_program;
|
private System.Windows.Forms.Button btn_add_new_start_program;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
|
private Manina.Windows.Forms.ImageListView ilv_games;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,6 +25,7 @@ namespace DisplayMagician.UIForms
|
|||||||
{
|
{
|
||||||
|
|
||||||
private ProfileAdaptor _profileAdaptor;
|
private ProfileAdaptor _profileAdaptor;
|
||||||
|
private GameAdaptor _gameAdaptor;
|
||||||
//private List<ProfileItem> _loadedProfiles = new List<ProfileItem>();
|
//private List<ProfileItem> _loadedProfiles = new List<ProfileItem>();
|
||||||
private ProfileItem _profileToUse = null;
|
private ProfileItem _profileToUse = null;
|
||||||
private GameStruct _gameToUse;
|
private GameStruct _gameToUse;
|
||||||
@ -65,6 +66,7 @@ namespace DisplayMagician.UIForms
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_profileAdaptor = new ProfileAdaptor();
|
_profileAdaptor = new ProfileAdaptor();
|
||||||
|
_gameAdaptor = new GameAdaptor();
|
||||||
|
|
||||||
_shortcutToEdit = shortcutToEdit;
|
_shortcutToEdit = shortcutToEdit;
|
||||||
|
|
||||||
@ -75,6 +77,13 @@ namespace DisplayMagician.UIForms
|
|||||||
ilv_saved_profiles.AllowDrop = false;
|
ilv_saved_profiles.AllowDrop = false;
|
||||||
ilv_saved_profiles.SetRenderer(new ProfileILVRenderer());
|
ilv_saved_profiles.SetRenderer(new ProfileILVRenderer());
|
||||||
|
|
||||||
|
|
||||||
|
ilv_games.MultiSelect = false;
|
||||||
|
ilv_games.ThumbnailSize = new Size(100, 100);
|
||||||
|
ilv_games.AllowDrag = false;
|
||||||
|
ilv_games.AllowDrop = false;
|
||||||
|
ilv_games.SetRenderer(new GameILVRenderer());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -293,7 +302,7 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool gameStillInstalled = false;
|
bool gameStillInstalled = false;
|
||||||
foreach (ListViewItem gameItem in lv_games.Items)
|
foreach (ImageListViewItem gameItem in ilv_games.Items)
|
||||||
{
|
{
|
||||||
if (gameItem.Text.Equals(txt_game_name.Text))
|
if (gameItem.Text.Equals(txt_game_name.Text))
|
||||||
{
|
{
|
||||||
@ -716,7 +725,7 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RefreshImageListView(ProfileItem profile)
|
private void RefreshProfileImageListView(ProfileItem profile)
|
||||||
{
|
{
|
||||||
ilv_saved_profiles.ClearSelection();
|
ilv_saved_profiles.ClearSelection();
|
||||||
IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_saved_profiles.Items where item.Text == profile.Name select item);
|
IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_saved_profiles.Items where item.Text == profile.Name select item);
|
||||||
@ -728,6 +737,18 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RefreshGameImageListView(Game game)
|
||||||
|
{
|
||||||
|
ilv_games.ClearSelection();
|
||||||
|
IEnumerable<ImageListViewItem> matchingImageListViewItems = (from item in ilv_games.Items where item.Text == game.Name select item);
|
||||||
|
if (matchingImageListViewItems.Any())
|
||||||
|
{
|
||||||
|
matchingImageListViewItems.First().Selected = true;
|
||||||
|
matchingImageListViewItems.First().Focused = true;
|
||||||
|
matchingImageListViewItems.First().Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ShortcutForm_Load(object sender, EventArgs e)
|
private void ShortcutForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -975,11 +996,10 @@ namespace DisplayMagician.UIForms
|
|||||||
il_games.Images.Add(bm);
|
il_games.Images.Add(bm);
|
||||||
|
|
||||||
// ADd the game to the game array
|
// ADd the game to the game array
|
||||||
lv_games.Items.Add(new ListViewItem
|
ilv_games.Items.Add(new ImageListViewItem
|
||||||
{
|
{
|
||||||
Text = game.Name,
|
Text = game.Name,
|
||||||
Tag = game,
|
Tag = game
|
||||||
ImageIndex = il_games.Images.Count - 1
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,7 +1142,7 @@ namespace DisplayMagician.UIForms
|
|||||||
cb_args_game.Checked = true;
|
cb_args_game.Checked = true;
|
||||||
}
|
}
|
||||||
//select the loaded Game item if it is there
|
//select the loaded Game item if it is there
|
||||||
foreach (ListViewItem gameItem in lv_games.Items)
|
foreach (ImageListViewItem gameItem in ilv_games.Items)
|
||||||
{
|
{
|
||||||
if (gameItem.Text.Equals(_shortcutToEdit.GameName))
|
if (gameItem.Text.Equals(_shortcutToEdit.GameName))
|
||||||
{
|
{
|
||||||
@ -1354,9 +1374,9 @@ namespace DisplayMagician.UIForms
|
|||||||
|
|
||||||
private void btn_choose_game_Click(object sender, EventArgs e)
|
private void btn_choose_game_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (lv_games.SelectedItems.Count > 0)
|
if (ilv_games.SelectedItems.Count > 0)
|
||||||
{
|
{
|
||||||
txt_game_name.Text = lv_games.SelectedItems[0].Text;
|
txt_game_name.Text = ilv_games.SelectedItems[0].Text;
|
||||||
foreach (Game game in allGames)
|
foreach (Game game in allGames)
|
||||||
{
|
{
|
||||||
if (game.Name == txt_game_name.Text)
|
if (game.Name == txt_game_name.Text)
|
||||||
@ -1409,7 +1429,7 @@ namespace DisplayMagician.UIForms
|
|||||||
lbl_profile_shown_subtitle.Text = "";
|
lbl_profile_shown_subtitle.Text = "";
|
||||||
|
|
||||||
// Refresh the image list view
|
// Refresh the image list view
|
||||||
RefreshImageListView(profile);
|
RefreshProfileImageListView(profile);
|
||||||
|
|
||||||
// And finally show the profile in the display view
|
// And finally show the profile in the display view
|
||||||
dv_profile.Profile = profile;
|
dv_profile.Profile = profile;
|
||||||
@ -1447,6 +1467,29 @@ namespace DisplayMagician.UIForms
|
|||||||
ilv_saved_profiles.ResumeLayout();
|
ilv_saved_profiles.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Temporarily stop updating the saved_profiles listview
|
||||||
|
ilv_games.SuspendLayout();
|
||||||
|
|
||||||
|
ImageListViewItem newItem = null;
|
||||||
|
foreach (Game loadedGame in DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries)
|
||||||
|
{
|
||||||
|
bool thisLoadedProfileIsAlreadyHere = (from item in ilv_games.Items where item.Text == loadedGame.Name orderby item.Text select item.Text).Any();
|
||||||
|
if (!thisLoadedProfileIsAlreadyHere)
|
||||||
|
{
|
||||||
|
newItem = new ImageListViewItem(loadedGame, loadedGame.Name);
|
||||||
|
//ilv_saved_profiles.Items.Add(newItem);
|
||||||
|
ilv_saved_profiles.Items.Add(newItem, _gameAdaptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restart updating the saved_profiles listview
|
||||||
|
ilv_games.ResumeLayout();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateHotkeyLabel(_shortcutToEdit.Hotkey);
|
UpdateHotkeyLabel(_shortcutToEdit.Hotkey);
|
||||||
EnableSaveButtonIfValid();
|
EnableSaveButtonIfValid();
|
||||||
}
|
}
|
||||||
@ -2211,5 +2254,26 @@ namespace DisplayMagician.UIForms
|
|||||||
flp_start_programs.ResumeLayout();
|
flp_start_programs.ResumeLayout();
|
||||||
flp_start_programs.Invalidate();
|
flp_start_programs.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ilv_games_ItemClick(object sender, ItemClickEventArgs e)
|
||||||
|
{
|
||||||
|
if (ilv_games.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
txt_game_name.Text = e.Item.Text;
|
||||||
|
foreach (Game game in allGames)
|
||||||
|
{
|
||||||
|
if (game.Name == txt_game_name.Text)
|
||||||
|
{
|
||||||
|
if (_loadedShortcut)
|
||||||
|
_isUnsaved = true;
|
||||||
|
txt_game_launcher.Text = game.GameLibrary.ToString();
|
||||||
|
_gameId = game.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SuggestShortcutName();
|
||||||
|
EnableSaveButtonIfValid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user