diff --git a/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs b/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs index 3144ead..888e2c0 100644 --- a/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs +++ b/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -60,6 +61,8 @@ namespace EveOPreview.Configuration.Implementation this.DisableThumbnail = new Dictionary(); this.PriorityClients = new List(); + this.ExecutablesToPreview = new List { "exefile" }; + this.MinimizeToTray = false; this.ThumbnailRefreshPeriod = 500; this.ThumbnailResizeTimeoutPeriod = 500; @@ -224,6 +227,8 @@ namespace EveOPreview.Configuration.Implementation private Dictionary DisableThumbnail { get; set; } [JsonProperty] private List PriorityClients { get; set; } + [JsonProperty] + private List ExecutablesToPreview { get; set; } public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation) { @@ -326,6 +331,10 @@ namespace EveOPreview.Configuration.Implementation { return this.PriorityClients.Contains(currentClient); } + public bool IsExecutableToPreview(string processName) + { + return this.ExecutablesToPreview.Any(s => s.Equals(processName, StringComparison.OrdinalIgnoreCase)); + } public bool IsThumbnailDisabled(string currentClient) { diff --git a/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs b/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs index e95d1cd..4cb3653 100644 --- a/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs +++ b/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs @@ -73,6 +73,7 @@ namespace EveOPreview.Configuration Keys StringToKey(string hotkey); bool IsPriorityClient(string currentClient); + bool IsExecutableToPreview(string processName); bool IsThumbnailDisabled(string currentClient); void ToggleThumbnail(string currentClient, bool isDisabled); diff --git a/src/Eve-O-Preview/Properties/AssemblyInfo.cs b/src/Eve-O-Preview/Properties/AssemblyInfo.cs index f3bb6e1..166b385 100644 --- a/src/Eve-O-Preview/Properties/AssemblyInfo.cs +++ b/src/Eve-O-Preview/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")] -[assembly: AssemblyVersion("8.0.1.6")] -[assembly: AssemblyFileVersion("8.0.1.6")] +[assembly: AssemblyVersion("8.0.1.7")] +[assembly: AssemblyFileVersion("8.0.1.7")] [assembly: CLSCompliant(false)] \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs b/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs index 2bf9008..2de2e7f 100644 --- a/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs +++ b/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs @@ -1,4 +1,5 @@ -using System; +using EveOPreview.Configuration; +using System; using System.Collections.Generic; using System.Diagnostics; @@ -14,12 +15,14 @@ namespace EveOPreview.Services.Implementation #region Private fields private readonly IDictionary _processCache; private IProcessInfo _currentProcessInfo; + private readonly IThumbnailConfiguration _configuration; #endregion - public ProcessMonitor() + public ProcessMonitor(IThumbnailConfiguration configuration) { this._processCache = new Dictionary(512); - + this._configuration = configuration; + // This field cannot be initialized properly in constructor // At the moment this code is executed the main application window is not yet initialized this._currentProcessInfo = new ProcessInfo(IntPtr.Zero, ""); @@ -28,7 +31,7 @@ namespace EveOPreview.Services.Implementation private bool IsMonitoredProcess(string processName) { // This is a possible extension point - return String.Equals(processName, ProcessMonitor.DEFAULT_PROCESS_NAME, StringComparison.OrdinalIgnoreCase); + return _configuration.IsExecutableToPreview(processName); } private IProcessInfo GetCurrentProcessInfo() diff --git a/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs b/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs index 346f39f..f14077a 100644 --- a/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs +++ b/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs @@ -126,13 +126,46 @@ namespace EveOPreview.Services foreach (var t in clientOrder) { - if (t.Key == _activeClient.Title) + if (t.Key == _activeClient.Title && t.Key != "EVE") { setNextClient = true; lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key).Value; continue; } + // cycle through login screens ? + if (t.Key == _activeClient.Title && t.Key == "EVE") + { + lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key && x.Value.Id == _activeClient.Handle).Value; + if (lastClient == null) + { + setNextClient = true; + continue; + } + var possibleClients = (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).Where(x => x.Value.Title == t.Key); + foreach (var pc in possibleClients) + { + if ( pc.Value.Id.Equals(lastClient.Id) ) + { + setNextClient = true; + continue; + } + + if (!setNextClient) + { + continue; + } + + // this is the next client (at login screen) + SetActive(pc); + return; + } + + // rolled off top of list - back to first (if any there!) + // set next client ? + continue; + } + if (!setNextClient) { continue; @@ -140,7 +173,9 @@ namespace EveOPreview.Services if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) { - var ptr = _thumbnailViews.First(x => x.Value.Title == t.Key); + var ptr = t.Key.Equals("EVE") ? + (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key) + : _thumbnailViews.First(x => x.Value.Title == t.Key); SetActive(ptr); return; } @@ -151,7 +186,9 @@ namespace EveOPreview.Services { if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) { - var ptr = _thumbnailViews.First(x => x.Value.Title == t.Key); + var ptr = t.Key.Equals("EVE") ? + (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key) + : _thumbnailViews.First(x => x.Value.Title == t.Key); SetActive(ptr); _activeClient = (ptr.Key, t.Key); return;