Use thumbnail position from FLAT layout if there is no corresponding entry in the PER CLIENT layouts

This commit is contained in:
Anton Kasyanov
2016-10-15 22:31:52 +03:00
parent 89519fe473
commit 5a9e6722c8

View File

@@ -78,27 +78,26 @@ namespace EveOPreview.Configuration
public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation) public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation)
{ {
Dictionary<string, Point> layoutSource = null; Point location;
if (this.EnablePerClientThumbnailLayouts) // What this code does:
// If Per-Client layouts are enabled
// and client name is known
// and there is a separate thumbnails layout for this client
// and this layout contains an entry for the current client
// then return that entry
// otherwise try to get client layout from the flat all-clients layout
// If there is no layout too then use the default one
if (this.EnablePerClientThumbnailLayouts && !string.IsNullOrEmpty(activeClient))
{ {
if (!string.IsNullOrEmpty(activeClient)) Dictionary<string, Point> layoutSource;
if (this.PerClientLayout.TryGetValue(activeClient, out layoutSource) && layoutSource.TryGetValue(currentClient, out location))
{ {
this.PerClientLayout.TryGetValue(activeClient, out layoutSource); return location;
} }
} }
else
{
layoutSource = this.FlatLayout;
}
if (layoutSource == null) return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation;
{
return defaultLocation;
}
Point location;
return layoutSource.TryGetValue(currentClient, out location) ? location : defaultLocation;
} }
public void SetThumbnailLocation(string currentClient, string activeClient, Point location) public void SetThumbnailLocation(string currentClient, string activeClient, Point location)