Skip to content

Commit e036f5c

Browse files
authored
Merge pull request #2 from jsmarsch/dev
Added Wix Installer
2 parents a5f27cb + 1327985 commit e036f5c

File tree

7 files changed

+175
-5
lines changed

7 files changed

+175
-5
lines changed

Covfefe.sln

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28010.2046
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29418.71
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covfefe", "src\Covfefe\Covfefe.csproj", "{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}"
77
EndProject
@@ -12,16 +12,34 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
LICENSE = LICENSE
1313
EndProjectSection
1414
EndProject
15+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "CovfefeSetup", "src\CovfefeSetup\CovfefeSetup.wixproj", "{BB577DC2-22B4-46D5-BE65-5C81E8775D25}"
16+
ProjectSection(ProjectDependencies) = postProject
17+
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9} = {D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}
18+
EndProjectSection
19+
EndProject
1520
Global
1621
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1722
Debug|Any CPU = Debug|Any CPU
23+
Debug|x86 = Debug|x86
1824
Release|Any CPU = Release|Any CPU
25+
Release|x86 = Release|x86
1926
EndGlobalSection
2027
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2128
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2229
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Debug|x86.ActiveCfg = Debug|Any CPU
31+
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Debug|x86.Build.0 = Debug|Any CPU
2332
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
2433
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Release|x86.ActiveCfg = Release|Any CPU
35+
{D01576AA-C8DD-4D03-AE3E-D3F9E52362F9}.Release|x86.Build.0 = Release|Any CPU
36+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Debug|Any CPU.ActiveCfg = Debug|x86
37+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Debug|x86.ActiveCfg = Debug|x86
38+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Debug|x86.Build.0 = Debug|x86
39+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Release|Any CPU.ActiveCfg = Release|x86
40+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Release|Any CPU.Build.0 = Release|x86
41+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Release|x86.ActiveCfg = Release|x86
42+
{BB577DC2-22B4-46D5-BE65-5C81E8775D25}.Release|x86.Build.0 = Release|x86
2543
EndGlobalSection
2644
GlobalSection(SolutionProperties) = preSolution
2745
HideSolutionNode = FALSE

License.rtf

1.3 KB
Binary file not shown.

src/Covfefe/Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using System.Reflection;
34
using System.Threading;
45
using System.Windows.Forms;
@@ -13,7 +14,7 @@ static class Program
1314
/// The main entry point for the application.
1415
/// </summary>
1516
[STAThread]
16-
static void Main()
17+
static void Main(string[] args)
1718
{
1819
// only allow 1 instance of this app to run at a time
1920
// todo: I should scope this to the login session, so that there can be multiple instances in multi-session
@@ -29,6 +30,10 @@ static void Main()
2930
var sleepManagementFacade = new SleepManagementFacade(new Windows7PowerManagementEngine());
3031
var settingsFacade = new SettingsFacade();
3132
var mainForm = new TrayForm(sleepManagementFacade, settingsFacade);
33+
34+
if(args?.FirstOrDefault() == "--ShowSettings")
35+
mainForm.ShowSettingsScreenOnInitialLoad();
36+
3237
Application.Run(mainForm);
3338
}
3439
finally

src/Covfefe/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("1.1.0.0")]
36+
[assembly: AssemblyFileVersion("1.1.0.0")]

src/Covfefe/TrayForm.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,14 @@ private void CovfefeNotifyIcon_DoubleClick(object sender, EventArgs e)
154154
else
155155
SetSleepMode(CovfefeSleepMode.Normal);
156156
}
157+
158+
/// <summary>
159+
/// Normally, the settings screen will be suppressed when Covfefe launches so that it runs unobtrusively in the system tray. Call this method prior to launch to request that
160+
/// the settings be displayed. Generally, this would be done on the very first run of the app, so that the user is presented with the settings and knows that the app is running.
161+
/// </summary>
162+
public void ShowSettingsScreenOnInitialLoad()
163+
{
164+
_isInitialLoad = false;
165+
}
157166
}
158167
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>3.10</ProductVersion>
7+
<ProjectGuid>bb577dc2-22b4-46d5-be65-5c81e8775d25</ProjectGuid>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<OutputName>CovfefeSetup</OutputName>
10+
<OutputType>Package</OutputType>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13+
<OutputPath>bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
15+
<DefineConstants>Debug</DefineConstants>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
18+
<OutputPath>bin\$(Configuration)\</OutputPath>
19+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
22+
<DefineConstants>Debug</DefineConstants>
23+
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
24+
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
27+
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
28+
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
29+
</PropertyGroup>
30+
<ItemGroup>
31+
<Compile Include="CovfefeSetup.wxs" />
32+
</ItemGroup>
33+
<ItemGroup>
34+
<WixExtension Include="WixUtilExtension">
35+
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
36+
<Name>WixUtilExtension</Name>
37+
</WixExtension>
38+
<WixExtension Include="WixUIExtension">
39+
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
40+
<Name>WixUIExtension</Name>
41+
</WixExtension>
42+
</ItemGroup>
43+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
44+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
45+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
46+
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
47+
</Target>
48+
<!--
49+
To modify your build process, add your task inside one of the targets below and uncomment it.
50+
Other similar extension points exist, see Wix.targets.
51+
<Target Name="BeforeBuild">
52+
</Target>
53+
<Target Name="AfterBuild">
54+
</Target>
55+
-->
56+
</Project>

src/CovfefeSetup/CovfefeSetup.wxs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
4+
<Product Id="*"
5+
Name="Covfefe"
6+
Language="1033"
7+
Version="!(bind.fileVersion.Covfefe.exe)"
8+
Manufacturer="jsm"
9+
UpgradeCode="0a24d660-a0cd-483f-9f71-6b33d7f0eed1"
10+
>
11+
12+
<Package
13+
InstallerVersion="500"
14+
Compressed="yes"
15+
Description="Covfefe! Sleep Preventer"
16+
InstallPrivileges="limited"
17+
/>
18+
19+
<Media Id="1" Cabinet="Covfefe.cab" EmbedCab="yes"/>
20+
21+
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
22+
23+
<Feature Id="ProductFeature" Title="Covfefe" Level="1">
24+
<ComponentRef Id="Covfefe.exe" />
25+
<ComponentRef Id="ApplicationShortcut"/>
26+
</Feature>
27+
28+
<!-- This property defines the ALLUSERS property and sets it to blank, which indicates that this -->
29+
<!-- product will be installed per-user instead of per-machine. -->
30+
<Property Id="ALLUSERS" Secure="yes"/>
31+
<WixVariable Id="WixUILicenseRtf" Value="..\..\License.rtf" />
32+
33+
<Directory Id="TARGETDIR" Name="SourceDir">
34+
<Directory Id="AppDataFolder" Name="AppData">
35+
<Directory Id="AppRootDirectory" Name="Covfefe">
36+
</Directory>
37+
</Directory>
38+
<Directory Id="ProgramMenuFolder">
39+
<Directory Id="ApplicationProgramsFolder" Name="Covfefe"/>
40+
</Directory>
41+
</Directory>
42+
<!--Note: Need to add a "delete all settings" option. If we delete them all unconditionally, then they will be deleted on an upgrade. A future feature would be a "delete settings" option on uninstall.-->
43+
44+
<DirectoryRef Id="AppRootDirectory">
45+
<Component Id="Covfefe.exe" Guid="1FC747AA-852D-41DE-B948-8A4F6D201D2C" DiskId="1">
46+
<CreateFolder/>
47+
<File Id="covfefe.exe" Source="..\Covfefe\bin\Release\Covfefe.exe" />
48+
<File Id="covfefe.exe.config" Source="..\Covfefe\bin\Release\Covfefe.exe.config" />
49+
<RemoveFolder Id="RemoveAppRootDirectory" On="uninstall"/>
50+
<RegistryKey Root="HKCU" Key="Software\jsm\Covfefe">
51+
<RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
52+
</RegistryKey>
53+
</Component>
54+
</DirectoryRef>
55+
<DirectoryRef Id="ApplicationProgramsFolder">
56+
<Component Id="ApplicationShortcut" Guid="2D0EC93F-CAE7-4700-BC06-8E84FC915574">
57+
<Shortcut Id="ApplicationStartMenuShortcut"
58+
Name="Covfefe"
59+
Description="Covfefe!"
60+
Target="[AppRootDirectory]Covfefe.exe"
61+
WorkingDirectory="INSTALLFOLDER"
62+
/>
63+
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall"/>
64+
<RegistryValue Root="HKCU" Key="Software\jsm\Covfefe" Name="installed" Type="integer" Value="1" KeyPath="yes" />
65+
</Component>
66+
67+
</DirectoryRef>
68+
69+
<!--for launching Covfefe when the installation completes-->
70+
<UI>
71+
<UIRef Id="WixUI_Minimal" />
72+
<Publish Dialog="ExitDialog"
73+
Control="Finish"
74+
Event="DoAction"
75+
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1</Publish>
76+
</UI>
77+
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Covfefe!" />
78+
<Property Id="WixShellExecTarget" Value="[#covfefe.exe]"/>
79+
<!--<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes"/>-->
80+
<CustomAction Id="LaunchApplication" FileKey="covfefe.exe" ExeCommand="--ShowSettings" Impersonate="yes" Return="asyncNoWait" Execute="immediate"/>
81+
</Product>
82+
</Wix>

0 commit comments

Comments
 (0)