Updated Shortcut saving to work with the library

Updated the 'Save To Desktop' button in the
ShortcutLibraryForm to use the CreateShortcut
function in the ShortcutItem, and fixed that so
it now uses the IWshRuntimeLibrary to create
a Windows Script Host that will create the
shortcut.
This commit is contained in:
terrymacdonald
2020-07-21 19:50:41 +12:00
parent 85963b3417
commit c1ce153c68
13 changed files with 1942 additions and 102 deletions

View File

@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace HeliosPlus
{
class ShortcutRepository
public static class ShortcutRepository
{
#region Class Variables
// Common items to the class
@ -24,33 +24,15 @@ namespace HeliosPlus
// Other constants that are useful
private static string _shortcutStorageJsonPath = Path.Combine(Program.AppDataPath, $"Shortcuts");
private static string _shortcutStorageJsonFileName = Path.Combine(_shortcutStorageJsonPath, $"Shortcuts_{Version.ToString(2)}.json");
private static uint _lastShortcutId;
#endregion
#region Instance Variables
// Individual items per class instance
#endregion
#region Class Constructors
public ShortcutRepository()
static ShortcutRepository()
{
// Load the Shortcuts from storage
LoadShortcuts();
/* if (LoadShortcuts() && ShortcutCount > 0)
{
// Work out the starting NextShortcutId value
long max = _allShortcuts.Max<ShortcutItem>(item => item.Id);
_lastShortcutId = Convert.ToUInt32(max);
} else
_lastShortcutId = 0;
*/ }
public ShortcutRepository(ShortcutItem shortcut) : this()
{
if (shortcut is ShortcutItem)
AddShortcut(shortcut);
}
#endregion
#region Class Properties