Skip to content

Commit

Permalink
Added manifest to handle DPI scaling
Browse files Browse the repository at this point in the history
Added application icon
Updated build output paths
  • Loading branch information
voltura committed Oct 4, 2018
1 parent 8716f46 commit bc242c6
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 35 deletions.
22 changes: 4 additions & 18 deletions Voltura Tools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,32 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeekNumber", "WeekNumber\We
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|x64.ActiveCfg = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|x64.Build.0 = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|x86.ActiveCfg = Debug|x86
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Debug|x86.Build.0 = Debug|x86
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Release|Any CPU.Build.0 = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Release|x64.ActiveCfg = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Release|x64.Build.0 = Debug|Any CPU
{7192A019-B0AC-4307-96B6-F2FA0C4CF77C}.Release|x86.ActiveCfg = Release|x86
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|Any CPU.ActiveCfg = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|Any CPU.Build.0 = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|x64.ActiveCfg = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|x64.Build.0 = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|x86.ActiveCfg = Debug
{73DDE078-A263-4B90-91FF-476331051B79}.Debug|x86.Build.0 = Debug
{73DDE078-A263-4B90-91FF-476331051B79}.Release|Any CPU.ActiveCfg = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Release|Any CPU.Build.0 = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Release|x64.ActiveCfg = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Release|x64.Build.0 = Release
{73DDE078-A263-4B90-91FF-476331051B79}.Release|x86.ActiveCfg = Release
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x64.ActiveCfg = Debug|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x64.Build.0 = Debug|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x64.ActiveCfg = Debug|x64
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x64.Build.0 = Debug|x64
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x86.ActiveCfg = Debug|x86
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Debug|x86.Build.0 = Debug|x86
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|Any CPU.Build.0 = Release|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x64.ActiveCfg = Release|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x64.Build.0 = Release|Any CPU
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x64.ActiveCfg = Release|x64
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x64.Build.0 = Release|x64
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x86.ActiveCfg = Release|x86
{82D086D4-E145-4487-81FA-28BD3B1577D2}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
2 changes: 1 addition & 1 deletion WeekNumber/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ private static void Main()
{
if (_mutex.WaitOne(TimeSpan.Zero, true))
{
Application.EnableVisualStyles();
Program program = new Program();
program.Run();
Application.EnableVisualStyles();
Application.Run();
_mutex.ReleaseMutex();
}
Expand Down
4 changes: 2 additions & 2 deletions WeekNumber/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("550adc75-8afb-4813-ac91-8c8c6cb681ae")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyFileVersion("1.2.0.0")]

#endregion
6 changes: 3 additions & 3 deletions WeekNumber/TaskbarGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static void UpdateIcon(int weekNumber, ref NotifyIcon notifyIcon)
}
graphics.FillRectangle(Brushes.White, 10, 2, 6, 12);
graphics.FillRectangle(Brushes.White, 48, 2, 6, 12);
using (Font font = new Font(FontFamily.GenericMonospace, 36f, FontStyle.Bold))
using (Font font = new Font(FontFamily.GenericMonospace, 12f, FontStyle.Bold))
{
graphics.DrawString(weekNumber.ToString().PadLeft(2, '0').Substring(0, 2), font, Brushes.White, -6f, 10f);
}
Expand All @@ -114,12 +114,12 @@ private static void UpdateIcon(int weekNumber, ref NotifyIcon notifyIcon)

#region Private properties

private ContextMenu GetContextMenu => new ContextMenu(new MenuItem[4]
private ContextMenu GetContextMenu => new ContextMenu(new[]
{
new MenuItem(Text.AboutMenu, new EventHandler(AboutClick)) { DefaultItem = true },
new MenuItem(Text.StartWithWindowsMenu, new EventHandler(StartWithWindowsClick)) { Checked = Settings.StartWithWindows },
new MenuItem(Text.SeparatorMenu),
new MenuItem(Text.ExitMenu, delegate { OnUserClose(); })
new MenuItem(Text.ExitMenu, delegate { OnUserClose(); })// { OwnerDraw = }
});

#endregion
Expand Down
6 changes: 3 additions & 3 deletions WeekNumber/Text.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ internal static class Text
#region Static texts variables

internal static readonly string About = Application.ProductName + " by Voltura AB\r\rhttps://github.com/voltura/VolturaTools\r\rFree for all.";
internal static readonly string AboutMenu = "&About " + Application.ProductName + "\tshift+A";
internal static readonly string StartWithWindowsMenu = "&Start with Windows\tshift+S";
internal static readonly string ExitMenu = "E&xit " + Application.ProductName + "\tshift+X";
internal static readonly string AboutMenu = "About " + Application.ProductName;
internal static readonly string StartWithWindowsMenu = "Start with Windows";
internal static readonly string ExitMenu = "Exit " + Application.ProductName;
internal static readonly string SeparatorMenu = "-";
internal static readonly string ApplicationNameAndVersion = Application.ProductName + " version " + Application.ProductVersion;
internal static readonly string FailedToSetIcon = "Could not set Icon. Please report to feedback@voltura.se!\r\r";
Expand Down
32 changes: 24 additions & 8 deletions WeekNumber/WeekNumber.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{82D086D4-E145-4487-81FA-28BD3B1577D2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WeekNumber</RootNamespace>
Expand All @@ -12,32 +10,32 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>ExtendedCorrectnessRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>ExtendedCorrectnessRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\Release\WeekNumber.xml</DocumentationFile>
<DocumentationFile>bin\x64\Release\WeekNumber.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -54,14 +52,24 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>CODE_ANALYSIS;TRACE</DefineConstants>
<DocumentationFile>bin\Release\WeekNumber.xml</DocumentationFile>
<DocumentationFile>bin\x86\Release\WeekNumber.xml</DocumentationFile>
<Optimize>true</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<RunCodeAnalysis>true</RunCodeAnalysis>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExtendedCorrectnessRules.ruleset</CodeAnalysisRuleSet>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup>
<StartupObject>WeekNumber.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>weekicon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>settings.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -79,6 +87,14 @@
<Compile Include="Text.cs" />
<Compile Include="Week.cs" />
</ItemGroup>
<ItemGroup>
<None Include="settings.manifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="weekicon.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
21 changes: 21 additions & 0 deletions WeekNumber/settings.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
Binary file added WeekNumber/weekicon.ico
Binary file not shown.

0 comments on commit bc242c6

Please sign in to comment.