mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Partial cleanup of compiler warnings
Fixed most of the string related compiler warnings. Still lots to go!
This commit is contained in:
parent
c358bc9087
commit
e83a893640
@ -532,120 +532,6 @@ namespace HeliosPlus.Shared
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool ApplyProfile(ProfileItem profile)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
Debug.Print("Begin profile change");
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
ApplyTopos(profile);
|
|
||||||
|
|
||||||
Debug.Print("Finished setting topologies");
|
|
||||||
Debug.Print("Sleep");
|
|
||||||
Thread.Sleep(18000);
|
|
||||||
Debug.Print("Awake");
|
|
||||||
|
|
||||||
ApplyPathInfos(profile);
|
|
||||||
|
|
||||||
Debug.Print("Applying pathInfos");
|
|
||||||
Debug.Print("Sleep");
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
Debug.Print("Awake");
|
|
||||||
|
|
||||||
UpdateCurrentProfile();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"ProfileRepository/ApplyProfile exception: {ex.Message}: {ex.InnerException}");
|
|
||||||
UpdateCurrentProfile();
|
|
||||||
Console.WriteLine($"Profile: Problem applying the '{profile.Name}' Display Profile: {ex.Message}");
|
|
||||||
MessageBox.Show($"Problem applying the '{profile.Name}' Display Profile! \n(ex.Message)", $"Problem applying '{profile.Name}' Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyTopos(ProfileItem profile)
|
|
||||||
{
|
|
||||||
Debug.Print("_applyTopos()");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var surroundTopologies =
|
|
||||||
profile.Viewports.SelectMany(viewport => viewport.TargetDisplays)
|
|
||||||
.Select(target => target.SurroundTopology)
|
|
||||||
.Where(topology => topology != null)
|
|
||||||
.Select(topology => topology.ToGridTopology())
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
if (surroundTopologies.Length == 0)
|
|
||||||
{
|
|
||||||
var currentTopologies = GridTopology.GetGridTopologies();
|
|
||||||
|
|
||||||
if (currentTopologies.Any(topology => topology.Rows * topology.Columns > 1))
|
|
||||||
{
|
|
||||||
surroundTopologies =
|
|
||||||
GridTopology.GetGridTopologies()
|
|
||||||
.SelectMany(topology => topology.Displays)
|
|
||||||
.Select(displays => new GridTopology(1, 1, new[] { displays }))
|
|
||||||
.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (surroundTopologies.Length > 0)
|
|
||||||
{
|
|
||||||
GridTopology.SetGridTopologies(surroundTopologies, SetDisplayTopologyFlag.MaximizePerformance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"ProfileItem/ApplyTopos exception: {ex.Message}: {ex.InnerException}");
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyPathInfos(ProfileItem profile)
|
|
||||||
{
|
|
||||||
Debug.Print("_applyPathInfos()");
|
|
||||||
if (!profile.IsPossible)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
$"Problem applying the '{profile.Name}' Display Profile! The display configuration changed since this profile is created. Please re-create this profile.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var pathInfos = profile.Viewports.Select(viewport => viewport.ToPathInfo()).Where(info => info != null).ToArray();
|
|
||||||
PathInfo.ApplyPathInfos(pathInfos, true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* public static IDictionary<string, Action> applyProfileActions(ProfileItem profile)
|
|
||||||
{
|
|
||||||
var dict = new Dictionary<string, Action>()
|
|
||||||
{
|
|
||||||
{ "Applying_Topos", ApplyTopos(profile) },
|
|
||||||
{ "Applying_Paths", ApplyPathInfos(profile) }
|
|
||||||
};
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDictionary<string, string> applyProfileMsgs()
|
|
||||||
{
|
|
||||||
var dict = new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
{ "Applying_Topos", Language.Applying_First_Message },
|
|
||||||
{ "Applying_Paths", Language.Applying_Second_Message }
|
|
||||||
};
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<string> applyProfileSequence()
|
|
||||||
{
|
|
||||||
var list = new List<string>() { "Applying_Topos", "Applying_Paths" };
|
|
||||||
return list;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public static bool IsValidFilename(string testName)
|
public static bool IsValidFilename(string testName)
|
||||||
{
|
{
|
||||||
string strTheseAreInvalidFileNameChars = new string(Path.GetInvalidFileNameChars());
|
string strTheseAreInvalidFileNameChars = new string(Path.GetInvalidFileNameChars());
|
||||||
|
@ -43,11 +43,13 @@ namespace HeliosPlus
|
|||||||
public class ShortcutItem
|
public class ShortcutItem
|
||||||
{
|
{
|
||||||
|
|
||||||
private static List<ShortcutItem> _allSavedShortcuts = new List<ShortcutItem>();
|
//private static List<ShortcutItem> _allSavedShortcuts = new List<ShortcutItem>();
|
||||||
private MultiIcon _shortcutIcon, _originalIcon = null;
|
//private MultiIcon _shortcutIcon, _originalIcon = null;
|
||||||
private Bitmap _shortcutBitmap, _originalBitmap = null;
|
private Bitmap _shortcutBitmap, _originalBitmap = null;
|
||||||
private ProfileItem _profileToUse = null;
|
private ProfileItem _profileToUse = null;
|
||||||
private string _originalIconPath = "", _savedShortcutIconCacheFilename = "", _uuid = "";
|
private string _originalIconPath = "";
|
||||||
|
//private string _savedShortcutIconCacheFilename = "";
|
||||||
|
private string _uuid = "";
|
||||||
private string _name = "";
|
private string _name = "";
|
||||||
//private uint _id = 0;
|
//private uint _id = 0;
|
||||||
private string _profileUuid = "";
|
private string _profileUuid = "";
|
||||||
@ -62,7 +64,10 @@ namespace HeliosPlus
|
|||||||
ProfileToUse = profile;
|
ProfileToUse = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Version Version = new Version(1, 0);
|
public static Version Version
|
||||||
|
{
|
||||||
|
get => new Version(1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public string UUID
|
public string UUID
|
||||||
{
|
{
|
||||||
@ -147,7 +152,7 @@ namespace HeliosPlus
|
|||||||
// We try to find and set the ProfileTouse
|
// We try to find and set the ProfileTouse
|
||||||
foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles)
|
foreach (ProfileItem profileToTest in ProfileRepository.AllProfiles)
|
||||||
{
|
{
|
||||||
if (profileToTest.UUID.Equals(_profileUuid))
|
if (profileToTest.UUID.Equals(_profileUuid, StringComparison.InvariantCultureIgnoreCase))
|
||||||
_profileToUse = profileToTest;
|
_profileToUse = profileToTest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
using HeliosPlus.InterProcess;
|
using HeliosPlus.InterProcess;
|
||||||
using HeliosPlus.Resources;
|
using HeliosPlus.Resources;
|
||||||
using HeliosPlus.Shared;
|
using HeliosPlus.Shared;
|
||||||
using HeliosPlus.UIForms;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using NvAPIWrapper.Mosaic;
|
||||||
|
using NvAPIWrapper.Native.Mosaic;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing.IconLib;
|
using System.Drawing.IconLib;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -26,7 +25,6 @@ namespace HeliosPlus
|
|||||||
#region Class Variables
|
#region Class Variables
|
||||||
// Common items to the class
|
// Common items to the class
|
||||||
private static List<ShortcutItem> _allShortcuts = null;
|
private static List<ShortcutItem> _allShortcuts = null;
|
||||||
public static Version Version = new Version(1, 0, 0);
|
|
||||||
// Other constants that are useful
|
// Other constants that are useful
|
||||||
private static string _shortcutStorageJsonPath = Path.Combine(Program.AppDataPath, $"Shortcuts");
|
private static string _shortcutStorageJsonPath = Path.Combine(Program.AppDataPath, $"Shortcuts");
|
||||||
private static string _shortcutStorageJsonFileName = Path.Combine(_shortcutStorageJsonPath, $"Shortcuts_{Version.ToString(2)}.json");
|
private static string _shortcutStorageJsonFileName = Path.Combine(_shortcutStorageJsonPath, $"Shortcuts_{Version.ToString(2)}.json");
|
||||||
@ -72,6 +70,11 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Version Version
|
||||||
|
{
|
||||||
|
get => new Version(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Class Methods
|
#region Class Methods
|
||||||
@ -116,7 +119,7 @@ namespace HeliosPlus
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Remove the Shortcut Icons from the Cache
|
// Remove the Shortcut Icons from the Cache
|
||||||
List<ShortcutItem> shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcut.UUID));
|
List<ShortcutItem> shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.InvariantCultureIgnoreCase));
|
||||||
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -132,7 +135,7 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the shortcut from the list.
|
// Remove the shortcut from the list.
|
||||||
int numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcut.UUID));
|
int numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcut.UUID, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
if (numRemoved == 1)
|
if (numRemoved == 1)
|
||||||
{
|
{
|
||||||
@ -158,13 +161,13 @@ namespace HeliosPlus
|
|||||||
Match match = Regex.Match(shortcutNameOrUuid, uuidV4Regex, RegexOptions.IgnoreCase);
|
Match match = Regex.Match(shortcutNameOrUuid, uuidV4Regex, RegexOptions.IgnoreCase);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcutNameOrUuid));
|
shortcutsToRemove = _allShortcuts.FindAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase));
|
||||||
numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcutNameOrUuid));
|
numRemoved = _allShortcuts.RemoveAll(item => item.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shortcutsToRemove = _allShortcuts.FindAll(item => item.Name.Equals(shortcutNameOrUuid));
|
shortcutsToRemove = _allShortcuts.FindAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase));
|
||||||
numRemoved = _allShortcuts.RemoveAll(item => item.Name.Equals(shortcutNameOrUuid));
|
numRemoved = _allShortcuts.RemoveAll(item => item.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase));
|
||||||
}
|
}
|
||||||
// Remove the Shortcut Icons from the Cache
|
// Remove the Shortcut Icons from the Cache
|
||||||
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
||||||
@ -201,7 +204,7 @@ namespace HeliosPlus
|
|||||||
|
|
||||||
foreach (ShortcutItem testShortcut in _allShortcuts)
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.UUID.Equals(shortcut.UUID))
|
if (testShortcut.UUID.Equals(shortcut.UUID,StringComparison.InvariantCultureIgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +223,7 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
foreach (ShortcutItem testShortcut in _allShortcuts)
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.UUID.Equals(shortcutNameOrUuid))
|
if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +232,7 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
foreach (ShortcutItem testShortcut in _allShortcuts)
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.Name.Equals(shortcutNameOrUuid))
|
if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +254,7 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
foreach (ShortcutItem testShortcut in _allShortcuts)
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.UUID.Equals(shortcutNameOrUuid))
|
if (testShortcut.UUID.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return testShortcut;
|
return testShortcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +263,7 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
foreach (ShortcutItem testShortcut in _allShortcuts)
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.Name.Equals(shortcutNameOrUuid))
|
if (testShortcut.Name.Equals(shortcutNameOrUuid, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return testShortcut;
|
return testShortcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +280,7 @@ namespace HeliosPlus
|
|||||||
|
|
||||||
foreach (ShortcutItem testShortcut in ShortcutRepository.AllShortcuts)
|
foreach (ShortcutItem testShortcut in ShortcutRepository.AllShortcuts)
|
||||||
{
|
{
|
||||||
if (testShortcut.ProfileUUID.Equals(newProfile.UUID) && testShortcut.AutoName)
|
if (testShortcut.ProfileUUID.Equals(newProfile.UUID, StringComparison.InvariantCultureIgnoreCase) && testShortcut.AutoName)
|
||||||
{
|
{
|
||||||
testShortcut.ProfileToUse = newProfile;
|
testShortcut.ProfileToUse = newProfile;
|
||||||
testShortcut.AutoSuggestShortcutName();
|
testShortcut.AutoSuggestShortcutName();
|
||||||
@ -446,18 +449,22 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
// Do some validation to make sure the shortcut is sensible
|
// Do some validation to make sure the shortcut is sensible
|
||||||
// And that we have enough to try and action within the shortcut
|
// And that we have enough to try and action within the shortcut
|
||||||
|
// including checking the Profile in the shortcut is possible
|
||||||
// (in other words check everything in the shortcut is still valid)
|
// (in other words check everything in the shortcut is still valid)
|
||||||
|
if (!(shortcutToUse is ShortcutItem))
|
||||||
|
return;
|
||||||
|
|
||||||
(bool valid, string reason) = shortcutToUse.IsValid();
|
(bool valid, string reason) = shortcutToUse.IsValid();
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
throw new Exception(string.Format("Unable to run the shortcut '{0}': {1}", shortcutToUse.Name, reason));
|
throw new Exception(string.Format("ShortcutRepository/SaveShortcutIconToCache exception: Unable to run the shortcut '{0}': {1}", shortcutToUse.Name, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember the profile we are on now
|
// Remember the profile we are on now
|
||||||
ProfileItem rollbackProfile = ProfileRepository.CurrentProfile;
|
ProfileItem rollbackProfile = ProfileRepository.CurrentProfile;
|
||||||
|
|
||||||
// Try to change to the wanted profile
|
// Apply the Profile!
|
||||||
if (!ProfileRepository.ApplyProfile(shortcutToUse.ProfileToUse))
|
if (!ApplyProfile(shortcutToUse.ProfileToUse))
|
||||||
{
|
{
|
||||||
throw new Exception(Language.Cannot_change_active_profile);
|
throw new Exception(Language.Cannot_change_active_profile);
|
||||||
}
|
}
|
||||||
@ -664,7 +671,7 @@ namespace HeliosPlus
|
|||||||
// Change back to the original profile if it is different
|
// Change back to the original profile if it is different
|
||||||
if (!ProfileRepository.IsActiveProfile(rollbackProfile))
|
if (!ProfileRepository.IsActiveProfile(rollbackProfile))
|
||||||
{
|
{
|
||||||
if (!ProfileRepository.ApplyProfile(rollbackProfile))
|
if (!ApplyProfile(rollbackProfile))
|
||||||
{
|
{
|
||||||
throw new Exception(Language.Cannot_change_active_profile);
|
throw new Exception(Language.Cannot_change_active_profile);
|
||||||
}
|
}
|
||||||
@ -672,7 +679,7 @@ namespace HeliosPlus
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ChangeToProfile(ProfileItem profile)
|
private static bool ApplyProfile(ProfileItem profile)
|
||||||
{
|
{
|
||||||
// If we're already on the wanted profile then no need to change!
|
// If we're already on the wanted profile then no need to change!
|
||||||
if (ProfileRepository.IsActiveProfile(profile))
|
if (ProfileRepository.IsActiveProfile(profile))
|
||||||
@ -685,25 +692,21 @@ namespace HeliosPlus
|
|||||||
IPCService.GetInstance().Status = InstanceStatus.Busy;
|
IPCService.GetInstance().Status = InstanceStatus.Busy;
|
||||||
var failed = false;
|
var failed = false;
|
||||||
|
|
||||||
if (new ApplyingChangesForm(() =>
|
// Now lets start by changing the display topology
|
||||||
|
Task applyProfileTopologyTask = Task.Run(() =>
|
||||||
{
|
{
|
||||||
Task.Factory.StartNew(() =>
|
Console.WriteLine("ShortcutRepository/SaveShortcutIconToCache : Applying Profile Topology" + profile.Name);
|
||||||
{
|
ApplyTopology(profile);
|
||||||
if (!(ProfileRepository.ApplyProfile(profile)))
|
});
|
||||||
{
|
applyProfileTopologyTask.Wait();
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
}, TaskCreationOptions.LongRunning);
|
|
||||||
}, 3, 30).ShowDialog() !=
|
|
||||||
DialogResult.Cancel)
|
|
||||||
{
|
|
||||||
if (failed)
|
|
||||||
{
|
|
||||||
throw new Exception(Language.Profile_is_invalid_or_not_possible_to_apply);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
// And then change the path information
|
||||||
}
|
Task applyProfilePathInfoTask = Task.Run(() =>
|
||||||
|
{
|
||||||
|
Console.WriteLine("ShortcutRepository/SaveShortcutIconToCache : Applying Profile Topology" + profile.Name);
|
||||||
|
ApplyPathInfo(profile);
|
||||||
|
});
|
||||||
|
applyProfilePathInfoTask.Wait();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -712,6 +715,64 @@ namespace HeliosPlus
|
|||||||
IPCService.GetInstance().Status = instanceStatus;
|
IPCService.GetInstance().Status = instanceStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyTopology(ProfileItem profile)
|
||||||
|
{
|
||||||
|
Debug.Print("ShortcutRepository.ApplyTopology()");
|
||||||
|
if (profile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var surroundTopologies =
|
||||||
|
profile.Viewports.SelectMany(viewport => viewport.TargetDisplays)
|
||||||
|
.Select(target => target.SurroundTopology)
|
||||||
|
.Where(topology => topology != null)
|
||||||
|
.Select(topology => topology.ToGridTopology())
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (surroundTopologies.Length == 0)
|
||||||
|
{
|
||||||
|
var currentTopologies = GridTopology.GetGridTopologies();
|
||||||
|
|
||||||
|
if (currentTopologies.Any(topology => topology.Rows * topology.Columns > 1))
|
||||||
|
{
|
||||||
|
surroundTopologies =
|
||||||
|
GridTopology.GetGridTopologies()
|
||||||
|
.SelectMany(topology => topology.Displays)
|
||||||
|
.Select(displays => new GridTopology(1, 1, new[] { displays }))
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (surroundTopologies.Length > 0)
|
||||||
|
{
|
||||||
|
GridTopology.SetGridTopologies(surroundTopologies, SetDisplayTopologyFlag.MaximizePerformance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ShortcutRepository/ApplyTopology exception: {ex.Message}: {ex.InnerException}");
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ApplyPathInfo(ProfileItem profile)
|
||||||
|
{
|
||||||
|
Debug.Print("ShortcutRepository.ApplyPathInfo()");
|
||||||
|
if (profile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!profile.IsPossible)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"ShortcutRepository/ApplyPathInfo exception: Problem applying the '{profile.Name}' Display Profile! The display configuration changed since this profile is created. Please re-create this profile.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var pathInfos = profile.Viewports.Select(viewport => viewport.ToPathInfo()).Where(info => info != null).ToArray();
|
||||||
|
WindowsDisplayAPI.DisplayConfig.PathInfo.ApplyPathInfos(pathInfos, true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ namespace HeliosPlus.UIForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to move this logic to the Shortcut Repository or the Profile Repository.
|
||||||
/*IDictionary<string, Action> actions = dv_profile.Profile.applyProfileActions();
|
/*IDictionary<string, Action> actions = dv_profile.Profile.applyProfileActions();
|
||||||
IDictionary<string, string> messages = dv_profile.Profile.applyProfileMsgs();
|
IDictionary<string, string> messages = dv_profile.Profile.applyProfileMsgs();
|
||||||
List<string> sequence = dv_profile.Profile.applyProfileSequence();
|
List<string> sequence = dv_profile.Profile.applyProfileSequence();
|
||||||
@ -70,10 +71,9 @@ namespace HeliosPlus.UIForms
|
|||||||
|
|
||||||
Activate();*/
|
Activate();*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Exit_Click(object sender, EventArgs e)
|
private void Exit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
|
@ -21,7 +21,7 @@ namespace HeliosPlus.UIForms
|
|||||||
{
|
{
|
||||||
|
|
||||||
private ShortcutAdaptor _shortcutAdaptor = new ShortcutAdaptor();
|
private ShortcutAdaptor _shortcutAdaptor = new ShortcutAdaptor();
|
||||||
private ImageListViewItem _selectedShortcutILVItem = null;
|
//private ImageListViewItem _selectedShortcutILVItem = null;
|
||||||
private ShortcutItem _selectedShortcut = null;
|
private ShortcutItem _selectedShortcut = null;
|
||||||
|
|
||||||
public ShortcutLibraryForm()
|
public ShortcutLibraryForm()
|
||||||
|
Loading…
Reference in New Issue
Block a user