From 783152f7dc7d32b8979e478b0db6eb809ecc4ac5 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Mon, 15 Sep 2014 18:47:56 -0400 Subject: [PATCH] Start of improved browser support --- Common.csproj | 12 ++++++++---- Internet/Browser.cs | 28 ++++++++++++++++------------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Common.csproj b/Common.csproj index 53e63a4..5ea00e1 100644 --- a/Common.csproj +++ b/Common.csproj @@ -10,10 +10,14 @@ Common Common 4 - SAK - SAK - SAK - SAK + + + + + + + + diff --git a/Internet/Browser.cs b/Internet/Browser.cs index dc4fa1d..6588f0b 100644 --- a/Internet/Browser.cs +++ b/Internet/Browser.cs @@ -21,6 +21,7 @@ namespace Common.Internet public string Command { get; private set; } public string DefaultIcon { get; private set; } public ImageSource DefaultImage { get; private set; } + public bool SupportsPrivate { get; private set; } public void LoadImage() { @@ -41,11 +42,6 @@ namespace Common.Internet DefaultImage = wpfBitmap; } - public bool SupportsPrivate() - { - return false; - } - public override string ToString() { return Name; @@ -69,15 +65,22 @@ namespace Common.Internet return true; } - public static Dictionary DetectInstalledBrowsers() - { - return DetectInstalledBrowsers(false); - } - - public static Dictionary DetectInstalledBrowsers(bool loadImages) + public static Dictionary DetectInstalledBrowsers(bool loadImages, bool includeUseSystemDefault) { var browsers = new Dictionary(); + if (includeUseSystemDefault) + { + var browser = new Browser + { + Key = string.Empty, + Name = "System Default", + SupportsPrivate = false + }; + + browsers.Add(browser.Key, browser); + } + var browserKeys = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Clients\StartMenuInternet"); if (browserKeys == null) @@ -107,7 +110,8 @@ namespace Common.Internet Key = browserName, Name = (string) browserKey.GetValue(null), Command = (string) browserKeyPath.GetValue(null), - DefaultIcon = browserIconPath == null ? null : (string) browserIconPath.GetValue(null) + DefaultIcon = browserIconPath == null ? null : (string) browserIconPath.GetValue(null), + SupportsPrivate = true }; if (loadImages)