Update for "Set Program Access and Defaults" support

This commit is contained in:
2015-11-02 20:11:35 -05:00
parent f7dddff14d
commit ff2ef0fd46
4 changed files with 194 additions and 148 deletions

View File

@@ -87,7 +87,8 @@ namespace FeedCenter
Current.SetStartWithWindows(Settings.Default.StartWithWindows);
// Set whether we should be the default feed reader
SystemConfiguration.SetDefaultFeedReader(Settings.Default.RegisterAsDefaultFeedReader);
if (Settings.Default.RegisterAsDefaultFeedReader)
SystemConfiguration.SetDefaultFeedReader();
// Initialize the window
mainWindow.Initialize();

View File

@@ -36,7 +36,9 @@ namespace FeedCenter.Options
settings.RegisterAsDefaultFeedReader = registerAsDefaultFeedReaderCheckBox.IsChecked.Value;
Application.Current.SetStartWithWindows(settings.StartWithWindows);
SystemConfiguration.SetDefaultFeedReader(settings.RegisterAsDefaultFeedReader);
if (settings.RegisterAsDefaultFeedReader)
SystemConfiguration.SetDefaultFeedReader();
}
public override string CategoryName

View File

@@ -4,12 +4,13 @@ using System;
using System.IO;
using System.Reflection;
using System.Windows;
using FeedCenter.Properties;
namespace FeedCenter
{
public static class SystemConfiguration
{
public static void SetDefaultFeedReader(bool value)
public static void SetDefaultFeedReader()
{
// Get the location of the assembly
var assemblyLocation = Assembly.GetEntryAssembly().Location;

View File

@@ -5,6 +5,7 @@
<?define ProductName="$(fileVersion.ProductName($(var.FeedCenter.TargetPath)))" ?>
<?define CompanyName="$(fileVersion.CompanyName($(var.FeedCenter.TargetPath)))" ?>
<?define ProductVersion="$(fileVersion.ProductVersion($(var.FeedCenter.TargetPath)))" ?>
<?define FileDescription="$(fileVersion.FileDescription($(var.FeedCenter.TargetPath)))" ?>
<Product Id="*"
Name="$(var.ProductName)"
@@ -127,6 +128,47 @@
Value='1'
KeyPath='yes' />
<!-- Capabilities keys for Vista/7 "Set Program Access and Defaults" -->
<RegistryValue Root="HKCU"
Key="SOFTWARE\Feed Center\Capabilities"
Name="ApplicationDescription"
Value="$(var.FileDescription)"
Type="string" />
<RegistryValue Root="HKCU"
Key="SOFTWARE\Feed Center\Capabilities"
Name="ApplicationName"
Value="$(var.ProductName)"
Type="string" />
<RegistryValue Root="HKCU"
Key="SOFTWARE\Feed Center\Capabilities\URLAssociations"
Name="feed"
Value="FeedCenter.URL.feed"
Type="string" />
<RegistryValue Root="HKCU"
Key="SOFTWARE\Feed Center\Capabilities\URLAssociations"
Name="feeds"
Value="FeedCenter.URL.feed"
Type="string" />
<RegistryValue Root="HKCU"
Key="SOFTWARE\RegisteredApplications"
Name="Feed Center"
Value="SOFTWARE\Feed Center\Capabilities"
Type="string" />
<RegistryValue Root="HKCU"
Key="Software\Classes\FeedCenter.URL.feed"
Value="URL:Feed Center Add RSS Feed"
Type="string" />
<RegistryValue Root="HKCU"
Key="Software\Classes\FeedCenter.URL.feed\DefaultIcon"
Value="[INSTALLFOLDER]FeedCenter.exe"
Type="string" />
<RegistryValue Root="HKCU"
Key="Software\Classes\FeedCenter.URL.feed\shell\open\command"
Value="&quot;[INSTALLFOLDER]FeedCenter.exe&quot; %1"
Type="string" />
<File Source="$(var.Common.TargetPath)" />
<File Source="$(var.Common.Native.TargetPath)" />
<File Source="$(var.Common.Wpf.TargetPath)" />