Skip to content

Commit 950ea12

Browse files
committed
add demo app
1 parent e7636a0 commit 950ea12

File tree

7 files changed

+297
-0
lines changed

7 files changed

+297
-0
lines changed

Source/DemoApp/DemoApp.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net7.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<UseWindowsForms>true</UseWindowsForms>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\ImageGlass.Tools\ImageGlass.Tools.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

Source/DemoApp/Form1.Designer.cs

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

Source/DemoApp/Form1.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
ImageGlass.Tools - Build tools for ImageGlass
3+
Copyright (C) 2023 DUONG DIEU PHAP
4+
Project homepage: https://imageglass.org
5+
6+
MIT License
7+
*/
8+
using ImageGlass.Tools;
9+
10+
namespace DemoApp;
11+
12+
public partial class Form1 : Form
13+
{
14+
private readonly ImageGlassTool _igTool = new();
15+
16+
17+
public Form1()
18+
{
19+
InitializeComponent();
20+
21+
// ImageGlass tool events
22+
_ = ConnectToImageGlassAsync();
23+
}
24+
25+
26+
27+
// ImageGlassTool connection
28+
#region ImageGlassTool connection
29+
30+
private async Task ConnectToImageGlassAsync()
31+
{
32+
_igTool.ToolMessageReceived += IgTool_ToolMessageReceived;
33+
_igTool.ToolClosingRequest += IgTool_ToolClosingRequest;
34+
35+
// start connecting to ImageGlass
36+
await _igTool.ConnectAsync();
37+
}
38+
39+
40+
private void IgTool_ToolClosingRequest(object? sender, DisconnectedEventArgs e)
41+
{
42+
Close();
43+
}
44+
45+
46+
private void IgTool_ToolMessageReceived(object? sender, MessageReceivedEventArgs e)
47+
{
48+
if (string.IsNullOrEmpty(e.MessageData)) return;
49+
50+
51+
Txt.Text = $"""
52+
EVENT NAME = {e.MessageName}
53+
EVENT DATA =
54+
{e.MessageData}
55+
56+
----------------------------------------------
57+
{Txt.Text}
58+
""";
59+
}
60+
61+
62+
#endregion // ImageGlassTool connection
63+
64+
65+
}

Source/DemoApp/Form1.resx

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<root>
2+
<!--
3+
Microsoft ResX Schema
4+
5+
Version 2.0
6+
7+
The primary goals of this format is to allow a simple XML format
8+
that is mostly human readable. The generation and parsing of the
9+
various data types are done through the TypeConverter classes
10+
associated with the data types.
11+
12+
Example:
13+
14+
... ado.net/XML headers & schema ...
15+
<resheader name="resmimetype">text/microsoft-resx</resheader>
16+
<resheader name="version">2.0</resheader>
17+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
18+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
19+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
20+
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
21+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
22+
<value>[base64 mime encoded serialized .NET Framework object]</value>
23+
</data>
24+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
25+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
26+
<comment>This is a comment</comment>
27+
</data>
28+
29+
There are any number of "resheader" rows that contain simple
30+
name/value pairs.
31+
32+
Each data row contains a name, and value. The row also contains a
33+
type or mimetype. Type corresponds to a .NET class that support
34+
text/value conversion through the TypeConverter architecture.
35+
Classes that don't support this are serialized and stored with the
36+
mimetype set.
37+
38+
The mimetype is used for serialized objects, and tells the
39+
ResXResourceReader how to depersist the object. This is currently not
40+
extensible. For a given mimetype the value must be set accordingly:
41+
42+
Note - application/x-microsoft.net.object.binary.base64 is the format
43+
that the ResXResourceWriter will generate, however the reader can
44+
read any of the formats listed below.
45+
46+
mimetype: application/x-microsoft.net.object.binary.base64
47+
value : The object must be serialized with
48+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
49+
: and then encoded with base64 encoding.
50+
51+
mimetype: application/x-microsoft.net.object.soap.base64
52+
value : The object must be serialized with
53+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54+
: and then encoded with base64 encoding.
55+
56+
mimetype: application/x-microsoft.net.object.bytearray.base64
57+
value : The object must be serialized into a byte array
58+
: using a System.ComponentModel.TypeConverter
59+
: and then encoded with base64 encoding.
60+
-->
61+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="metadata">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
70+
</xsd:sequence>
71+
<xsd:attribute name="name" use="required" type="xsd:string" />
72+
<xsd:attribute name="type" type="xsd:string" />
73+
<xsd:attribute name="mimetype" type="xsd:string" />
74+
<xsd:attribute ref="xml:space" />
75+
</xsd:complexType>
76+
</xsd:element>
77+
<xsd:element name="assembly">
78+
<xsd:complexType>
79+
<xsd:attribute name="alias" type="xsd:string" />
80+
<xsd:attribute name="name" type="xsd:string" />
81+
</xsd:complexType>
82+
</xsd:element>
83+
<xsd:element name="data">
84+
<xsd:complexType>
85+
<xsd:sequence>
86+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
87+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
88+
</xsd:sequence>
89+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
90+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
91+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
92+
<xsd:attribute ref="xml:space" />
93+
</xsd:complexType>
94+
</xsd:element>
95+
<xsd:element name="resheader">
96+
<xsd:complexType>
97+
<xsd:sequence>
98+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
99+
</xsd:sequence>
100+
<xsd:attribute name="name" type="xsd:string" use="required" />
101+
</xsd:complexType>
102+
</xsd:element>
103+
</xsd:choice>
104+
</xsd:complexType>
105+
</xsd:element>
106+
</xsd:schema>
107+
<resheader name="resmimetype">
108+
<value>text/microsoft-resx</value>
109+
</resheader>
110+
<resheader name="version">
111+
<value>2.0</value>
112+
</resheader>
113+
<resheader name="reader">
114+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115+
</resheader>
116+
<resheader name="writer">
117+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118+
</resheader>
119+
</root>

Source/DemoApp/Program.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace DemoApp
2+
{
3+
internal static class Program
4+
{
5+
/// <summary>
6+
/// The main entry point for the application.
7+
/// </summary>
8+
[STAThread]
9+
static void Main()
10+
{
11+
// To customize application configuration such as set high DPI settings or default font,
12+
// see https://aka.ms/applicationconfiguration.
13+
ApplicationConfiguration.Initialize();
14+
Application.Run(new Form1());
15+
}
16+
}
17+
}

Source/ImageGlass.Tools.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33516.290
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageGlass.Tools", "ImageGlass.Tools\ImageGlass.Tools.csproj", "{6CA9B212-D676-4CB3-A90E-9685A51B807A}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoApp", "DemoApp\DemoApp.csproj", "{7AF2304D-312F-4708-A52C-A95C0B505E68}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -36,6 +38,24 @@ Global
3638
{6CA9B212-D676-4CB3-A90E-9685A51B807A}.Release|x64.Build.0 = Release|x64
3739
{6CA9B212-D676-4CB3-A90E-9685A51B807A}.Release|x86.ActiveCfg = Release|x86
3840
{6CA9B212-D676-4CB3-A90E-9685A51B807A}.Release|x86.Build.0 = Release|x86
41+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|x64.ActiveCfg = Debug|Any CPU
44+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|x64.Build.0 = Debug|Any CPU
45+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|x86.ActiveCfg = Debug|Any CPU
46+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Debug|x86.Build.0 = Debug|Any CPU
47+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|Any CPU.Build.0 = Release|Any CPU
49+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|x64.ActiveCfg = Release|Any CPU
50+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|x64.Build.0 = Release|Any CPU
51+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|x86.ActiveCfg = Release|Any CPU
52+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Publish_Release|x86.Build.0 = Release|Any CPU
53+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|Any CPU.ActiveCfg = Release|Any CPU
54+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|Any CPU.Build.0 = Release|Any CPU
55+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|x64.ActiveCfg = Release|Any CPU
56+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|x64.Build.0 = Release|Any CPU
57+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|x86.ActiveCfg = Release|Any CPU
58+
{7AF2304D-312F-4708-A52C-A95C0B505E68}.Release|x86.Build.0 = Release|Any CPU
3959
EndGlobalSection
4060
GlobalSection(SolutionProperties) = preSolution
4161
HideSolutionNode = FALSE

demo.jpg

1.85 MB
Loading

0 commit comments

Comments
 (0)