Skip to content
This repository was archived by the owner on Apr 21, 2021. It is now read-only.

Commit 4f7a759

Browse files
committed
Add WPF example project
1 parent 7ea6c4b commit 4f7a759

File tree

13 files changed

+502
-1
lines changed

13 files changed

+502
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
5+
</startup>
6+
</configuration>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application x:Class="EventHook.WPF.Example.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
StartupUri="MainWindow.xaml">
5+
<Application.Resources>
6+
7+
</Application.Resources>
8+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace EventHook.WPF.Example
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{41F4FF6F-0E65-439C-9091-BA2C8E25BAE0}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>EventHook.WPF.Example</RootNamespace>
11+
<AssemblyName>EventHook.WPF.Example</AssemblyName>
12+
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15+
<WarningLevel>4</WarningLevel>
16+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Xml" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="System.Xaml">
46+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
47+
</Reference>
48+
<Reference Include="WindowsBase" />
49+
<Reference Include="PresentationCore" />
50+
<Reference Include="PresentationFramework" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<ApplicationDefinition Include="App.xaml">
54+
<Generator>MSBuild:Compile</Generator>
55+
<SubType>Designer</SubType>
56+
</ApplicationDefinition>
57+
<Page Include="MainWindow.xaml">
58+
<Generator>MSBuild:Compile</Generator>
59+
<SubType>Designer</SubType>
60+
</Page>
61+
<Compile Include="App.xaml.cs">
62+
<DependentUpon>App.xaml</DependentUpon>
63+
<SubType>Code</SubType>
64+
</Compile>
65+
<Compile Include="MainWindow.xaml.cs">
66+
<DependentUpon>MainWindow.xaml</DependentUpon>
67+
<SubType>Code</SubType>
68+
</Compile>
69+
</ItemGroup>
70+
<ItemGroup>
71+
<Compile Include="Properties\AssemblyInfo.cs">
72+
<SubType>Code</SubType>
73+
</Compile>
74+
<Compile Include="Properties\Resources.Designer.cs">
75+
<AutoGen>True</AutoGen>
76+
<DesignTime>True</DesignTime>
77+
<DependentUpon>Resources.resx</DependentUpon>
78+
</Compile>
79+
<Compile Include="Properties\Settings.Designer.cs">
80+
<AutoGen>True</AutoGen>
81+
<DependentUpon>Settings.settings</DependentUpon>
82+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
83+
</Compile>
84+
<EmbeddedResource Include="Properties\Resources.resx">
85+
<Generator>ResXFileCodeGenerator</Generator>
86+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
87+
</EmbeddedResource>
88+
<None Include="Properties\Settings.settings">
89+
<Generator>SettingsSingleFileGenerator</Generator>
90+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
91+
</None>
92+
<AppDesigner Include="Properties\" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<None Include="App.config" />
96+
</ItemGroup>
97+
<ItemGroup>
98+
<ProjectReference Include="..\..\EventHook\EventHook.csproj">
99+
<Project>{4ff5e04f-3425-4f55-a50a-30ceba7c2b95}</Project>
100+
<Name>EventHook</Name>
101+
</ProjectReference>
102+
</ItemGroup>
103+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
105+
Other similar extension points exist, see Microsoft.Common.targets.
106+
<Target Name="BeforeBuild">
107+
</Target>
108+
<Target Name="AfterBuild">
109+
</Target>
110+
-->
111+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Window x:Class="EventHook.WPF.Example.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="MainWindow" Height="350" Width="525">
5+
<Grid>
6+
7+
</Grid>
8+
</Window>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Controls;
9+
using System.Windows.Data;
10+
using System.Windows.Documents;
11+
using System.Windows.Input;
12+
using System.Windows.Media;
13+
using System.Windows.Media.Imaging;
14+
using System.Windows.Navigation;
15+
using System.Windows.Shapes;
16+
17+
namespace EventHook.WPF.Example
18+
{
19+
/// <summary>
20+
/// Interaction logic for MainWindow.xaml
21+
/// </summary>
22+
public partial class MainWindow : Window
23+
{
24+
public MainWindow()
25+
{
26+
InitializeComponent();
27+
28+
KeyboardWatcher.Start();
29+
KeyboardWatcher.OnKeyInput += (s, e) =>
30+
{
31+
Debug.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname));
32+
};
33+
34+
MouseWatcher.Start();
35+
MouseWatcher.OnMouseInput += (s, e) =>
36+
{
37+
Debug.WriteLine(string.Format("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y));
38+
};
39+
40+
ClipboardWatcher.Start();
41+
ClipboardWatcher.OnClipboardModified += (s, e) =>
42+
{
43+
Debug.WriteLine(string.Format("Clipboard updated with data '{0}' of format {1}", e.Data, e.DataFormat.ToString()));
44+
};
45+
46+
ApplicationWatcher.Start();
47+
ApplicationWatcher.OnApplicationWindowChange += (s, e) =>
48+
{
49+
Debug.WriteLine(string.Format("Application window of '{0}' with the title '{1}' was {2}", e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event));
50+
};
51+
52+
PrintWatcher.Start();
53+
PrintWatcher.OnPrintEvent += (s, e) =>
54+
{
55+
Debug.WriteLine(string.Format("Printer '{0}' currently printing {1} pages.", e.EventData.PrinterName, e.EventData.Pages));
56+
};
57+
58+
}
59+
}
60+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[assembly: AssemblyTitle("EventHook.WPF.Example")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("EventHook.WPF.Example")]
15+
[assembly: AssemblyCopyright("Copyright © 2016")]
16+
[assembly: AssemblyTrademark("")]
17+
[assembly: AssemblyCulture("")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
//In order to begin building localizable applications, set
25+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
26+
//inside a <PropertyGroup>. For example, if you are using US english
27+
//in your source files, set the <UICulture> to en-US. Then uncomment
28+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
29+
//the line below to match the UICulture setting in the project file.
30+
31+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32+
33+
34+
[assembly: ThemeInfo(
35+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36+
//(used if a resource is not found in the page,
37+
// or application resource dictionaries)
38+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39+
//(used if a resource is not found in the page,
40+
// app, or any theme specific resource dictionaries)
41+
)]
42+
43+
44+
// Version information for an assembly consists of the following four values:
45+
//
46+
// Major Version
47+
// Minor Version
48+
// Build Number
49+
// Revision
50+
//
51+
// You can specify all the values or you can default the Build and Revision Numbers
52+
// by using the '*' as shown below:
53+
// [assembly: AssemblyVersion("1.0.*")]
54+
[assembly: AssemblyVersion("1.0.0.0")]
55+
[assembly: AssemblyFileVersion("1.0.0.0")]

EventHook.Examples/EventHook.WPF.Example/Properties/Resources.Designer.cs

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)