Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding possiblity for user changes of font colors and keyboard shortcuts #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/HuntAndPeck/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="HuntAndPeck.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<userSettings>
<HuntAndPeck.Properties.Settings>
<setting name="FontSize" serializeAs="String">
<value>14</value>
</setting>
<setting name="FontBackroundColor" serializeAs="String">
<value>#FFFAD500</value>
</setting>
<setting name="FontColor" serializeAs="String">
<value>#FF000000</value>
</setting>
<setting name="KbdShortWin" serializeAs="String">
<value>Alt+Oem1</value>
</setting>
<setting name="KbdShortTray" serializeAs="String">
<value>Ctrl+Oem1</value>
</setting>
</HuntAndPeck.Properties.Settings>
</userSettings>
</configuration>
23 changes: 23 additions & 0 deletions src/HuntAndPeck/HuntAndPeck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Enums.NET, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7ea1c1650d506225, processorArchitecture=MSIL">
<HintPath>..\packages\Enums.NET.4.0.1\lib\net45\Enums.NET.dll</HintPath>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -72,6 +79,21 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
Expand Down Expand Up @@ -105,6 +127,7 @@
</Compile>
<Compile Include="Services\UiAutomationPatternIds.cs" />
<Compile Include="Services\UiAutomationHintProviderService.cs" />
<Compile Include="Settings.cs" />
<Compile Include="SingleLaunchMutex.cs" />
<Compile Include="ViewModels\DebugHintViewModel.cs" />
<Compile Include="ViewModels\DebugOverlayViewModel.cs" />
Expand Down
79 changes: 63 additions & 16 deletions src/HuntAndPeck/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions src/HuntAndPeck/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="HuntAndPeck.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="FontSize" Type="System.String" Scope="User">
<Value Profile="(Default)">14</Value>
</Setting>
<Setting Name="FontBackroundColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFAD500</Value>
</Setting>
<Setting Name="FontColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF000000</Value>
</Setting>
<Setting Name="KbdShortWin" Type="System.String" Scope="User">
<Value Profile="(Default)">Alt+Oem1</Value>
</Setting>
<Setting Name="KbdShortTray" Type="System.String" Scope="User">
<Value Profile="(Default)">Ctrl+Oem1</Value>
</Setting>
</Settings>
</SettingsFile>
</SettingsFile>
10 changes: 10 additions & 0 deletions src/HuntAndPeck/Services/Interfaces/IKeyListenerService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows.Forms;
using HuntAndPeck.NativeMethods;
using EnumsNET;

namespace HuntAndPeck.Services.Interfaces
{
Expand All @@ -9,6 +10,15 @@ internal class HotKey
public KeyModifier Modifier { get; set; }
public Keys Keys { get; set; }

public HotKey(string pomString)
{
int i = pomString.LastIndexOf('+');
Keys = Enums.Parse<Keys>(pomString.Substring(i + 1));
Modifier = FlagEnums.ParseFlags<KeyModifier>(pomString.Substring(0, i),
ignoreCase: true,
delimiter: "+");
}

/// <summary>
/// Id of the hot key registration
/// </summary>
Expand Down
28 changes: 28 additions & 0 deletions src/HuntAndPeck/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace HuntAndPeck.Properties {


// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {

public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}

private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}

private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}
16 changes: 16 additions & 0 deletions src/HuntAndPeck/ViewModels/HintViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ public class HintViewModel : NotifyPropertyChanged
private string _label;
private bool _active;
private string _fontSizeReadValue;
private System.Windows.Media.Brush _fontBackroundColorReadValue;
private System.Windows.Media.Brush _fontColorReadValue;

public HintViewModel(Hint hint)
{
Hint = hint;
FontSizeReadValue = Settings.Default.FontSize;
FontBackroundColorReadValue = new System.Windows.Media.SolidColorBrush(Settings.Default.FontBackroundColor);
FontColorReadValue = new System.Windows.Media.SolidColorBrush(Settings.Default.FontColor);
}

public Hint Hint { get; set; }
Expand All @@ -34,5 +38,17 @@ public string FontSizeReadValue
get { return _fontSizeReadValue; }
set { _fontSizeReadValue = value; NotifyOfPropertyChange(); }
}

public System.Windows.Media.Brush FontBackroundColorReadValue
{
get { return _fontBackroundColorReadValue;}
set { _fontBackroundColorReadValue = value; NotifyOfPropertyChange(); }
}

public System.Windows.Media.Brush FontColorReadValue
{
get { return _fontColorReadValue; }
set { _fontColorReadValue = value; NotifyOfPropertyChange(); }
}
}
}
Loading