#49 cycle through eve clients at toon selection page
#9 Allow EveO to preview other executables
This commit is contained in:
@@ -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<IntPtr, string> _processCache;
|
||||
private IProcessInfo _currentProcessInfo;
|
||||
private readonly IThumbnailConfiguration _configuration;
|
||||
#endregion
|
||||
|
||||
public ProcessMonitor()
|
||||
public ProcessMonitor(IThumbnailConfiguration configuration)
|
||||
{
|
||||
this._processCache = new Dictionary<IntPtr, string>(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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user