├── .gitignore ├── packages ├── repositories.config ├── Newtonsoft.Json.4.5.11 │ ├── Newtonsoft.Json.4.5.11.nupkg │ ├── lib │ │ ├── sl4 │ │ │ └── Newtonsoft.Json.dll │ │ ├── net20 │ │ │ └── Newtonsoft.Json.dll │ │ ├── net35 │ │ │ └── Newtonsoft.Json.dll │ │ ├── net40 │ │ │ └── Newtonsoft.Json.dll │ │ ├── sl3-wp │ │ │ └── Newtonsoft.Json.dll │ │ ├── winrt45 │ │ │ └── Newtonsoft.Json.dll │ │ ├── sl4-windowsphone71 │ │ │ └── Newtonsoft.Json.dll │ │ └── portable-net40+sl4+wp7+win8 │ │ │ └── Newtonsoft.Json.dll │ └── Newtonsoft.Json.4.5.11.nuspec └── Newtonsoft.Json.5.0.5 │ └── lib │ ├── net20 │ └── Newtonsoft.Json.dll │ ├── net35 │ └── Newtonsoft.Json.dll │ ├── net40 │ └── Newtonsoft.Json.dll │ ├── net45 │ └── Newtonsoft.Json.dll │ ├── netcore45 │ └── Newtonsoft.Json.dll │ ├── portable-net45+wp80+win8 │ └── Newtonsoft.Json.dll │ └── portable-net40+sl4+wp7+win8 │ └── Newtonsoft.Json.dll ├── PreactClient ├── packages.config ├── Models │ ├── BackgroundSignalRequest.cs │ ├── PersonActionLink.cs │ ├── ActionEventCreateRequest.cs │ ├── CoreResponse.cs │ ├── Account.cs │ ├── ActionEvent.cs │ ├── Person.cs │ └── CoreRequest.cs ├── Properties │ └── AssemblyInfo.cs ├── Api.cs ├── Preact.csproj ├── Extensions.cs └── Helpers.cs ├── Preact Api Consumer ├── Program.cs ├── Properties │ ├── Settings.settings │ ├── DataSources │ │ └── Preact_Api_Consumer.Properties.Settings.datasource │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── app.config ├── ExampleForm.cs ├── Preact Api Consumer.csproj ├── ExampleForm.resx └── ExampleForm.Designer.cs ├── LICENSE.txt ├── Preact.sln └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | *.suo 4 | *.user 5 | *.sln.docstates 6 | *.nuspec 7 | *.nupkg -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PreactClient/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/net45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/net45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/netcore45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/netcore45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/portable-net45+wp80+win8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/portable-net45+wp80+win8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.5.0.5/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.5.0.5/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preact/preact-dotnet/master/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Preact Api Consumer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace Preact_Api_Consumer 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new MainForm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | fds7b7mf0v 7 | 8 | 9 | 4rlvrkjau1 10 | 11 | 12 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/DataSources/Preact_Api_Consumer.Properties.Settings.datasource: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | Preact_Api_Consumer.Properties.Settings, Properties.Resources.Designer.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /PreactClient/Models/BackgroundSignalRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Newtonsoft.Json; 6 | 7 | namespace Preact 8 | { 9 | [JsonObject(MemberSerialization.OptIn)] 10 | public class BackgroundSignalRequest 11 | { 12 | [JsonProperty(PropertyName = "account_id")] 13 | public string AccountId { get; set; } 14 | 15 | [JsonProperty(PropertyName = "name")] 16 | public string Name { get; set; } 17 | 18 | [JsonProperty(PropertyName = "value")] 19 | public int Value { get; set; } 20 | 21 | [JsonProperty(PropertyName = "ts")] 22 | public double Timestamp { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Newtonsoft.Json 5 | 4.5.11 6 | Json.NET 7 | James Newton-King 8 | James Newton-King 9 | http://json.codeplex.com/license 10 | http://james.newtonking.com/projects/json-net.aspx 11 | false 12 | Json.NET is a popular high-performance JSON framework for .NET 13 | 14 | 15 | en-US 16 | json 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Preact Api Consumer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | YOUR_CODE 12 | 13 | 14 | YOUR_KEY 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Preact 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /PreactClient/Models/PersonActionLink.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | using Newtonsoft.Json; 26 | using Newtonsoft.Json.Converters; 27 | using Newtonsoft.Json.Linq; 28 | 29 | namespace Preact 30 | { 31 | [JsonObject(MemberSerialization.OptIn)] 32 | public class ActionLink 33 | { 34 | [JsonProperty(PropertyName = "name")] 35 | public string Name { get; set; } 36 | 37 | [JsonProperty(PropertyName = "href")] 38 | public string Href { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /PreactClient/Models/ActionEventCreateRequest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | using Newtonsoft.Json; 26 | using Newtonsoft.Json.Converters; 27 | using Newtonsoft.Json.Linq; 28 | 29 | namespace Preact 30 | { 31 | public class ActionEventCreateRequest : CoreRequest 32 | { 33 | [JsonProperty(PropertyName = "account")] 34 | public Account Account { get; set; } 35 | 36 | [JsonProperty(PropertyName = "person")] 37 | public Person Person { get; set; } 38 | 39 | [JsonProperty(PropertyName = "event")] 40 | public ActionEvent Event { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Preact.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Preact", "PreactClient\Preact.csproj", "{D4BA2C88-670D-426A-AC66-2857FD11B017}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Preact Api Consumer", "Preact Api Consumer\Preact Api Consumer.csproj", "{90FF590C-1A58-4A79-AA08-58A295F43D19}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D4BA2C88-670D-426A-AC66-2857FD11B017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D4BA2C88-670D-426A-AC66-2857FD11B017}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D4BA2C88-670D-426A-AC66-2857FD11B017}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D4BA2C88-670D-426A-AC66-2857FD11B017}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {90FF590C-1A58-4A79-AA08-58A295F43D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {90FF590C-1A58-4A79-AA08-58A295F43D19}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {90FF590C-1A58-4A79-AA08-58A295F43D19}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {90FF590C-1A58-4A79-AA08-58A295F43D19}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Preact Api Consumer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Preact Api Consumer")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("eabe1a83-2fec-4752-aa1d-7077f8d61058")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Preact C# Client 2 | === 3 | Allow your .NET app to easily submit server-side messages and events to Preact. 4 | 5 | You can optionally install the Preact Client from [NuGet](http://nuget.org/packages/Preact/). 6 | 7 | 8 | Usage 9 | --- 10 | 11 | Add your project code and secret to your web.config: 12 | 13 | ```xml 14 | 15 | ... 16 | 17 | 18 | ... 19 | 20 | ``` 21 | 22 | Add a Reference to the Preact library in your Project (either directly to the source, or compile it first and include the .dll) 23 | 24 | Then, log events as they happen using the client: 25 | 26 | ```csharp 27 | Preact.Api.Client.LogEvent(new Preact.ActionEventCreateRequest() 28 | { 29 | Event = new Preact.ActionEvent() 30 | { 31 | Name = "event-name" 32 | }, 33 | Person = new Preact.Person() 34 | { 35 | Email = "gooley@preact.io", 36 | Name = "Christopher Gooley", 37 | Uid = "gooley" 38 | } 39 | }); 40 | ``` 41 | 42 | Sample Helper Class 43 | --- 44 | 45 | We suggest you create a simple helper class such as preact.cs to convert your User data model into a Preact Person and submit the event. 46 | 47 | Here's a nice sample gist: https://gist.github.com/azcoov/5596023 48 | 49 | And then, you can log stuff nice and easily: 50 | ```csharp 51 | Preact.LogEvent(currentUserObject, "updated-profile") 52 | ``` 53 | 54 | Copyright (c) 2011-2013 Preact. See LICENSE.txt for further details. -------------------------------------------------------------------------------- /PreactClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PreactClient")] 9 | [assembly: AssemblyDescription("Wrapper for the Preact API")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Preact")] 12 | [assembly: AssemblyProduct("PreactClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b6dde76b-7f25-40ab-a229-a0b1ef164273")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.1")] 36 | [assembly: AssemblyFileVersion("1.0.0.1")] 37 | -------------------------------------------------------------------------------- /PreactClient/Models/CoreResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | using System.Security.Cryptography; 26 | 27 | using Newtonsoft.Json; 28 | using Newtonsoft.Json.Converters; 29 | using Newtonsoft.Json.Linq; 30 | 31 | namespace Preact 32 | { 33 | public class CoreResponse 34 | { 35 | public bool Success { get; private set; } 36 | public string Error { get; private set; } 37 | 38 | public JObject RawResponse { get; private set; } 39 | 40 | public CoreResponse(JObject response) 41 | { 42 | RawResponse = response; 43 | 44 | Success = response.Value("success"); 45 | 46 | JToken error; 47 | if (response.TryGetValue("error", out error)) 48 | { 49 | Error = error.Value(); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /PreactClient/Models/Account.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Preact 5 | { 6 | [JsonObject(MemberSerialization.OptIn)] 7 | public class Account 8 | { 9 | [JsonProperty(PropertyName = "id")] 10 | public string Id { get; set; } 11 | 12 | [JsonProperty(PropertyName = "name")] 13 | public string Name { get; set; } 14 | 15 | [JsonProperty(PropertyName = "license_type")] 16 | public string LicenseType { get; set; } 17 | 18 | [JsonProperty(PropertyName = "license_count")] 19 | public int? LicenseCount { get; set; } 20 | 21 | [JsonProperty(PropertyName = "license_renewal")] 22 | public DateTime? LicenseRenewal { get; set; } 23 | 24 | [JsonProperty(PropertyName = "license_value")] 25 | public int? LicenseValue { get; set; } 26 | 27 | [JsonProperty(PropertyName = "license_mrr")] 28 | public decimal? LicenseMRR { get; set; } 29 | 30 | [JsonProperty(PropertyName = "license_duration")] 31 | public int? LicenseDuration { get; set; } 32 | 33 | [JsonProperty(PropertyName = "license_status")] 34 | public string LicenseStatus { get; set; } 35 | 36 | [JsonProperty(PropertyName = "customer_since")] 37 | public DateTime? CustomerSince { get; set; } 38 | 39 | [JsonProperty(PropertyName = "trial_start")] 40 | public DateTime? TrialStart { get; set; } 41 | 42 | [JsonProperty(PropertyName = "trial_end")] 43 | public DateTime? TrialEnd { get; set; } 44 | 45 | [JsonProperty(PropertyName = "account_manager_name")] 46 | public string AccountManagerName { get; set; } 47 | 48 | [JsonProperty(PropertyName = "account_manager_email")] 49 | public string AccountManagerEmail { get; set; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /PreactClient/Models/ActionEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System.Collections.Generic; 21 | 22 | using Newtonsoft.Json; 23 | 24 | namespace Preact 25 | { 26 | [JsonObject(MemberSerialization.OptIn)] 27 | public class ActionEvent 28 | { 29 | /* Required Fields */ 30 | [JsonProperty(PropertyName = "source")] 31 | public string Source = Helpers.SourceApiVersion; 32 | 33 | [JsonProperty(PropertyName = "target_id")] 34 | public string TargetId { get; set; } 35 | 36 | [JsonProperty(PropertyName = "name")] 37 | public string Name { get; set; } 38 | 39 | /* Optional Fields */ 40 | [JsonProperty(PropertyName = "note")] 41 | public string Note { get; set; } 42 | 43 | [JsonProperty(PropertyName = "revenue")] 44 | public decimal? Revenue { get; set; } 45 | 46 | [JsonProperty(PropertyName = "account")] 47 | public Account Account { get; set; } 48 | 49 | [JsonProperty(PropertyName = "links")] 50 | public ActionLink[] Links { get; set; } 51 | 52 | [JsonProperty(PropertyName = "extras")] 53 | public Dictionary Extras { get; set; } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /PreactClient/Models/Person.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | using Newtonsoft.Json; 24 | 25 | namespace Preact 26 | { 27 | [JsonObject(MemberSerialization.OptIn)] 28 | public class Person 29 | { 30 | /* Required Fields */ 31 | [JsonProperty(PropertyName = "email")] 32 | public string Email { get; set; } 33 | 34 | /* Strongly Suggested Fields */ 35 | [JsonProperty(PropertyName = "name")] 36 | public string Name { get; set; } 37 | 38 | [JsonProperty(PropertyName = "created_at")] 39 | public DateTime? CreatedAt { get; set; } 40 | 41 | [JsonProperty(PropertyName = "uid")] 42 | public string Uid { get; set; } 43 | 44 | /* Optional Fields */ 45 | [JsonProperty(PropertyName = "twitter_id")] 46 | public string TwitterId { get; set; } 47 | 48 | [JsonProperty(PropertyName = "facebook_id")] 49 | public string FacebookId { get; set; } 50 | 51 | [JsonProperty(PropertyName = "stripe_id")] 52 | public string StripeId { get; set; } 53 | 54 | [JsonProperty(PropertyName = "properties")] 55 | public Dictionary Properties { get; set; } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Preact_Api_Consumer.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("fds7b7mf0v")] 29 | public string ProjectCode { 30 | get { 31 | return ((string)(this["ProjectCode"])); 32 | } 33 | set { 34 | this["ProjectCode"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("4rlvrkjau1")] 41 | public string SecretKey { 42 | get { 43 | return ((string)(this["SecretKey"])); 44 | } 45 | set { 46 | this["SecretKey"] = value; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /PreactClient/Models/CoreRequest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | using System.Security.Cryptography; 26 | 27 | using Newtonsoft.Json; 28 | using Newtonsoft.Json.Converters; 29 | using Newtonsoft.Json.Linq; 30 | 31 | namespace Preact 32 | { 33 | [JsonObject(MemberSerialization.OptIn)] 34 | public class CoreRequest 35 | { 36 | [JsonProperty(PropertyName = "project_code")] 37 | public string ProjectCode { get; private set; } 38 | 39 | [JsonProperty(PropertyName = "timestamp")] 40 | public string Timestamp { get; private set; } 41 | 42 | [JsonProperty(PropertyName = "token")] 43 | public string Token { get; private set; } 44 | 45 | [JsonProperty(PropertyName = "signature")] 46 | public string Signature { get; private set; } 47 | 48 | public void SignRequest(string projectCode, string secretKey) 49 | { 50 | ProjectCode = projectCode; 51 | Timestamp = DateTime.Now.Ticks.ToString(); 52 | Token = Guid.NewGuid().ToString("N"); 53 | 54 | System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 55 | byte[] keyByte = encoding.GetBytes(secretKey); 56 | HMACSHA256 hmacsha256 = new HMACSHA256(keyByte); 57 | 58 | byte[] messageBytes = encoding.GetBytes(string.Format("{0}{1}", Timestamp, Token)); 59 | byte[] hashmessage = hmacsha256.ComputeHash(messageBytes); 60 | 61 | Signature = ByteToString(hashmessage).ToLower(); 62 | } 63 | 64 | private static string ByteToString(byte[] buff) 65 | { 66 | string sbinary = ""; 67 | 68 | for (int i = 0; i < buff.Length; i++) 69 | { 70 | sbinary += buff[i].ToString("X2"); // hex format 71 | } 72 | return (sbinary); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /PreactClient/Api.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | 25 | using System.IO; 26 | using System.Net; 27 | using System.Web; 28 | using System.Security.Cryptography; 29 | 30 | using Newtonsoft.Json; 31 | using Newtonsoft.Json.Converters; 32 | using Newtonsoft.Json.Linq; 33 | 34 | namespace Preact 35 | { 36 | public class Api 37 | { 38 | private static string api_endpoint_events = "https://api.preact.io/api/v2/events"; 39 | private static string api_endpoint_metrics = "https://api.preact.io/api/v2/metrics"; 40 | private static Encoding encoding = Encoding.UTF8; 41 | 42 | private string ProjectCode { get; set; } 43 | private string ProjectApiSecret { get; set; } 44 | 45 | #region Constructors 46 | public Api() : 47 | this(System.Configuration.ConfigurationManager.AppSettings["PreactProjectCode"], 48 | System.Configuration.ConfigurationManager.AppSettings["PreactProjectApiSecret"]) { } 49 | 50 | public Api(string projectCode, string secretKey) 51 | { 52 | if (string.IsNullOrEmpty(projectCode) || string.IsNullOrEmpty(secretKey)) 53 | throw new ArgumentException("Missing ProjectCode or ProjectApiSecret"); 54 | 55 | ProjectCode = projectCode; 56 | ProjectApiSecret = secretKey; 57 | } 58 | #endregion 59 | 60 | #region Static Helpers 61 | private static Api _client; 62 | 63 | public static Api Client 64 | { 65 | get 66 | { 67 | if (_client == null) { _client = new Api(); } 68 | return _client; 69 | } 70 | } 71 | #endregion 72 | 73 | public void LogEvent(ActionEventCreateRequest request) 74 | { 75 | JObject param = JObject.FromObject(request); 76 | Helpers.SendData(ProjectCode, ProjectApiSecret, api_endpoint_events, "POST", param); 77 | 78 | } 79 | 80 | public void LogBackgroundSignal(BackgroundSignalRequest request) 81 | { 82 | JObject param = JObject.FromObject(request); 83 | Helpers.SendData(ProjectCode, ProjectApiSecret, api_endpoint_metrics, "POST", param); 84 | } 85 | 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /PreactClient/Preact.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D4BA2C88-670D-426A-AC66-2857FD11B017} 9 | Library 10 | Properties 11 | Preact 12 | Preact 13 | v4.0 14 | 512 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | False 39 | ..\packages\Newtonsoft.Json.5.0.5\lib\net40\Newtonsoft.Json.dll 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 74 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Preact_Api_Consumer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Preact_Api_Consumer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to { 65 | /// “account_id”: “593929”, 66 | /// “name”: “emails-sent”, 67 | /// “value”: 500, 68 | /// “ts”: 1395691710.0217988 69 | ///}. 70 | /// 71 | internal static string LogBackgroundSignal_JSON { 72 | get { 73 | return ResourceManager.GetString("LogBackgroundSignal_JSON", resourceCulture); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Preact Api Consumer/ExampleForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using Newtonsoft.Json; 10 | 11 | namespace Preact_Api_Consumer 12 | { 13 | public partial class MainForm : Form 14 | { 15 | public MainForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | #region Log Event 21 | 22 | private void btnLogEvent_Click(object sender, EventArgs e) 23 | { 24 | CreateLogEvent(); 25 | } 26 | 27 | private void CreateLogEvent() 28 | { 29 | outputTextbox.AppendText("Logging event\n"); 30 | Preact.Api api = new Preact.Api(codeTextbox.Text, secretTextbox.Text); 31 | try 32 | { 33 | Preact.ActionEventCreateRequest request = new Preact.ActionEventCreateRequest() 34 | { 35 | Account = new Preact.Account() 36 | { 37 | Name = accountNameTextbox.Text, 38 | Id = accountIdTextbox.Text, 39 | LicenseType = "paying", 40 | LicenseRenewal = DateTime.UtcNow 41 | }, 42 | Event = new Preact.ActionEvent() 43 | { 44 | Name = eventNameTextbox.Text, 45 | Revenue = 99 46 | }, 47 | Person = new Preact.Person() 48 | { 49 | Email = emailTextbox.Text, 50 | Name = personNameTextbox.Text, 51 | Uid = uidTextbox.Text, 52 | CreatedAt = DateTime.Now, 53 | Properties = new Dictionary() 54 | { 55 | {"created_at", (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds}, 56 | {"is_paying", true}, 57 | {"account_level", 2}, 58 | {"account_level_name", "Pro"} 59 | } 60 | } 61 | }; 62 | outputTextbox.AppendText(JsonConvert.SerializeObject(request,Formatting.Indented) + "\n"); 63 | api.LogEvent(request); 64 | } 65 | catch (Exception ex) 66 | { 67 | outputTextbox.AppendText("Log failure:" + ex.Message); 68 | outputTextbox.AppendText(ex.StackTrace); 69 | } 70 | } 71 | 72 | #endregion 73 | 74 | private void btnLogBackgroundSignal_Click(object sender, EventArgs e) 75 | { 76 | outputTextbox.AppendText("Logging signal\n"); 77 | Preact.Api api = new Preact.Api(codeTextbox.Text, secretTextbox.Text); 78 | 79 | try { 80 | Preact.BackgroundSignalRequest request = new Preact.BackgroundSignalRequest() 81 | { 82 | AccountId = accountIdTextbox.Text, 83 | Name = signalNameTextbox.Text, 84 | Value = int.Parse(signalValueTextbox.Text), 85 | Timestamp = (DateTime.UtcNow - new DateTime(1970, new Random().Next(1, 3), new Random().Next(1, 30))).TotalSeconds 86 | }; 87 | outputTextbox.AppendText(JsonConvert.SerializeObject(request, Formatting.Indented) + "\n"); 88 | api.LogBackgroundSignal(request); 89 | } 90 | catch (Exception ex) 91 | { 92 | outputTextbox.AppendText("Log failure:" + ex.Message); 93 | outputTextbox.AppendText(ex.StackTrace); 94 | } 95 | 96 | } 97 | 98 | private void MainForm_Load(object sender, EventArgs e) 99 | { 100 | 101 | } 102 | 103 | private void groupBox1_Enter(object sender, EventArgs e) 104 | { 105 | 106 | } 107 | 108 | private void textBox4_TextChanged(object sender, EventArgs e) 109 | { 110 | 111 | } 112 | 113 | private void textBox3_TextChanged(object sender, EventArgs e) 114 | { 115 | 116 | } 117 | 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Preact Api Consumer/Preact Api Consumer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {90FF590C-1A58-4A79-AA08-58A295F43D19} 8 | WinExe 9 | Properties 10 | Preact_Api_Consumer 11 | Preact Api Consumer 12 | v4.0 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | False 37 | ..\packages\Newtonsoft.Json.5.0.5\lib\net40\Newtonsoft.Json.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Form 53 | 54 | 55 | ExampleForm.cs 56 | 57 | 58 | 59 | 60 | ExampleForm.cs 61 | 62 | 63 | ResXFileCodeGenerator 64 | Resources.Designer.cs 65 | Designer 66 | 67 | 68 | True 69 | Resources.resx 70 | True 71 | 72 | 73 | Designer 74 | 75 | 76 | 77 | SettingsSingleFileGenerator 78 | Settings.Designer.cs 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | 87 | 88 | {d4ba2c88-670d-426a-ac66-2857fd11b017} 89 | Preact 90 | 91 | 92 | 93 | 100 | -------------------------------------------------------------------------------- /PreactClient/Extensions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | namespace Preact 24 | { 25 | public static class Extensions 26 | { 27 | #region ActionEventCreateRequest 28 | public static ActionEventCreateRequest ForPerson(this ActionEventCreateRequest req, Person person) 29 | { 30 | req.Person = person; 31 | return req; 32 | } 33 | 34 | public static ActionEventCreateRequest WithEvent(this ActionEventCreateRequest req, ActionEvent actionEvent) 35 | { 36 | req.Event = actionEvent; 37 | return req; 38 | } 39 | #endregion 40 | 41 | #region ActionEvent 42 | public static ActionEvent WithName(this ActionEvent actionEvent, string name) 43 | { 44 | actionEvent.Name = name; 45 | return actionEvent; 46 | } 47 | 48 | public static ActionEvent WithNote(this ActionEvent actionEvent, string note) 49 | { 50 | actionEvent.Note = note; 51 | return actionEvent; 52 | } 53 | 54 | public static ActionEvent WithLinks(this ActionEvent actionEvent, ActionLink[] links) 55 | { 56 | actionEvent.Links = links; 57 | return actionEvent; 58 | } 59 | 60 | public static ActionEvent WithAccount(this ActionEvent actionEvent, Account account) 61 | { 62 | actionEvent.Account = account; 63 | return actionEvent; 64 | } 65 | 66 | public static ActionEvent WithRevenue(this ActionEvent actionEvent, decimal revenue) 67 | { 68 | actionEvent.Revenue = revenue; 69 | return actionEvent; 70 | } 71 | 72 | public static ActionEvent WithExtras(this ActionEvent actionEvent, Dictionary extras) 73 | { 74 | actionEvent.Extras = extras; 75 | return actionEvent; 76 | } 77 | #endregion 78 | 79 | #region Person 80 | public static Person WithEmail(this Person person, string email) 81 | { 82 | person.Email = email; 83 | return person; 84 | } 85 | 86 | public static Person WithName(this Person person, string name) 87 | { 88 | person.Name = name; 89 | return person; 90 | } 91 | 92 | public static Person WithUid(this Person person, string uid) 93 | { 94 | person.Uid = uid; 95 | return person; 96 | } 97 | 98 | public static Person WithTwitterId(this Person person, string twitterId) 99 | { 100 | person.TwitterId = twitterId; 101 | return person; 102 | } 103 | 104 | public static Person WithFacebookId(this Person person, string facebookId) 105 | { 106 | person.FacebookId = facebookId; 107 | return person; 108 | } 109 | 110 | public static Person WithStripeId(this Person person, string stripeId) 111 | { 112 | person.StripeId = stripeId; 113 | return person; 114 | } 115 | 116 | public static Person WithCreatedAt(this Person person, DateTime createdAt) 117 | { 118 | person.CreatedAt = createdAt; 119 | return person; 120 | } 121 | 122 | public static Person WithProperties(this Person person, Dictionary properties) 123 | { 124 | person.Properties = properties; 125 | return person; 126 | } 127 | #endregion 128 | 129 | #region PersonActionLink 130 | public static ActionLink WithHref(this ActionLink actionLink, string href) 131 | { 132 | actionLink.Href = href; 133 | return actionLink; 134 | } 135 | 136 | public static ActionLink WithName(this ActionLink actionLink, string name) 137 | { 138 | actionLink.Name = name; 139 | return actionLink; 140 | } 141 | #endregion 142 | 143 | #region Account 144 | public static Account WithId(this Account account, string id) 145 | { 146 | account.Id = id; 147 | return account; 148 | } 149 | 150 | public static Account WithName(this Account account, string name) 151 | { 152 | account.Name = name; 153 | return account; 154 | } 155 | #endregion 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Preact Api Consumer/ExampleForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Preact Api Consumer/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | { 122 | “account_id”: “593929”, 123 | “name”: “emails-sent”, 124 | “value”: 500, 125 | “ts”: 1395691710.0217988 126 | } 127 | 128 | -------------------------------------------------------------------------------- /PreactClient/Helpers.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Preact / Preact.io 3 | * 4 | * Author(s): 5 | * Christopher Gooley / Preact (gooley@preact.io) 6 | * Billy Coover / Preact (gooley@preact.io) 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | using System.Threading; 25 | 26 | using System.IO; 27 | using System.Net; 28 | using System.Web; 29 | using System.Security.Cryptography; 30 | 31 | using Newtonsoft.Json; 32 | using Newtonsoft.Json.Converters; 33 | using Newtonsoft.Json.Linq; 34 | 35 | namespace Preact 36 | { 37 | internal static class Helpers 38 | { 39 | private static string UserAgent = "Preact Client .NET v0.4"; 40 | public static string SourceApiVersion = "preact-dotnet:0.4"; 41 | 42 | public static byte[] GetPostData(List> items) 43 | { 44 | string postData = ""; 45 | List vals = new List(); 46 | foreach (var item in items) 47 | { 48 | vals.Add(string.Format("{0}={1}", HttpUtility.UrlEncode(item.Key), HttpUtility.UrlEncode(item.Value))); 49 | } 50 | postData = string.Join("&", vals.ToArray()); 51 | 52 | ASCIIEncoding encoding = new ASCIIEncoding(); 53 | return encoding.GetBytes(postData); 54 | } 55 | 56 | public static List> BuildFormData(JObject obj, string parent = null) 57 | { 58 | List> items = new List>(); 59 | 60 | foreach (var v in obj.Properties()) 61 | { 62 | if (v.Value.Type == JTokenType.Array) 63 | { 64 | int index = 0; 65 | foreach (var vv in v.Value) 66 | { 67 | JObject joInside = vv as JObject; 68 | if (joInside != null) 69 | { 70 | items.AddRange(BuildFormData(joInside, GetFormDataKey(parent + "[" + v.Name + "]", index.ToString()))); 71 | } 72 | 73 | index++; 74 | } 75 | } 76 | else if (v.Value.HasValues) 77 | { 78 | foreach (var vv in v.Children()) 79 | { 80 | JObject joInside = vv as JObject; 81 | if (joInside != null) 82 | { 83 | items.AddRange(BuildFormData(joInside, GetFormDataKey(parent, v.Name))); 84 | } 85 | } 86 | } 87 | else if (v.Value.Type != JTokenType.Null && v.Value.Type != JTokenType.None) 88 | { 89 | items.Add(new KeyValuePair(GetFormDataKey(parent, v.Name), v.Value.ToString())); 90 | } 91 | } 92 | 93 | return items; 94 | } 95 | 96 | public static string GetFormDataKey(string parent, string key) 97 | { 98 | if (string.IsNullOrEmpty(parent)) 99 | { 100 | return key; 101 | } 102 | else 103 | { 104 | return string.Format("{0}[{1}]", parent, key); 105 | } 106 | } 107 | 108 | public static void SendData(string projectCode, string projectApiSecret, string url, string method, JObject obj) 109 | { 110 | SendData(projectCode, projectApiSecret, url, method, BuildFormData(obj)); 111 | } 112 | 113 | // POST or PUT or something 114 | public static void SendData(string projectCode, string projectApiSecret, string url, string method, List> items) 115 | { 116 | new ApiLogger(projectCode, projectApiSecret, url, method, items); 117 | } 118 | 119 | private class ApiLogger 120 | { 121 | public string Url { get; set; } 122 | public string Method { get; set; } 123 | public string Code { get; set; } 124 | public string Secret { get; set; } 125 | public List> Items { get; set; } 126 | 127 | private HttpWebRequest req; 128 | 129 | const int DefaultTimeout = 10 * 1000; // 10 second timeout 130 | 131 | // Abort the request if the timer fires. 132 | private static void TimeoutCallback(object state, bool timedOut) 133 | { 134 | if (timedOut) 135 | { 136 | HttpWebRequest request = state as HttpWebRequest; 137 | if (request != null) 138 | { 139 | request.Abort(); 140 | } 141 | } 142 | } 143 | 144 | public ApiLogger(string projectCode, string projectApiSecret, string url, string method, List> items) 145 | { 146 | Url = url; 147 | Method = method; 148 | Items = items; 149 | Code = projectCode; 150 | Secret = projectApiSecret; 151 | Send(); 152 | } 153 | 154 | public void Send() 155 | { 156 | req = (HttpWebRequest)WebRequest.Create(this.Url); 157 | req.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(Code + ":" + Secret)); 158 | req.Method = this.Method; 159 | req.ContentType = "application/x-www-form-urlencoded"; 160 | req.Accept = "text/javascript"; 161 | req.UserAgent = UserAgent; 162 | var asyncResult = req.BeginGetRequestStream(this.RequestCallback, req); 163 | 164 | // implement a timeout 165 | ThreadPool.RegisterWaitForSingleObject(asyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), req, DefaultTimeout, true); 166 | } 167 | 168 | private void RequestCallback(IAsyncResult asyncResult) 169 | { 170 | try 171 | { 172 | var data = GetPostData(Items); 173 | 174 | Stream newStream = req.EndGetRequestStream(asyncResult); 175 | newStream.Write(data, 0, data.Length); 176 | newStream.Close(); 177 | 178 | var result = req.BeginGetResponse(this.ResponseCallback, req); 179 | } 180 | catch (Exception e) 181 | { 182 | Console.WriteLine(e.Message); 183 | } 184 | } 185 | 186 | private void ResponseCallback(IAsyncResult asyncResult) 187 | { 188 | try 189 | { 190 | WebResponse response = req.EndGetResponse(asyncResult); 191 | response.Close(); 192 | } 193 | catch (Exception e) 194 | { 195 | Console.WriteLine(e.Message); 196 | } 197 | finally { } 198 | } 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /Preact Api Consumer/ExampleForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Preact_Api_Consumer 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnLogEvent = new System.Windows.Forms.Button(); 32 | this.btnLogBackgroundSignal = new System.Windows.Forms.Button(); 33 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 34 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 35 | this.personNameTextbox = new System.Windows.Forms.TextBox(); 36 | this.uidTextbox = new System.Windows.Forms.TextBox(); 37 | this.emailTextbox = new System.Windows.Forms.TextBox(); 38 | this.groupBox3 = new System.Windows.Forms.GroupBox(); 39 | this.accountNameTextbox = new System.Windows.Forms.TextBox(); 40 | this.accountIdTextbox = new System.Windows.Forms.TextBox(); 41 | this.groupBox4 = new System.Windows.Forms.GroupBox(); 42 | this.eventNameTextbox = new System.Windows.Forms.TextBox(); 43 | this.groupBox5 = new System.Windows.Forms.GroupBox(); 44 | this.signalValueTextbox = new System.Windows.Forms.TextBox(); 45 | this.signalNameTextbox = new System.Windows.Forms.TextBox(); 46 | this.outputTextbox = new System.Windows.Forms.TextBox(); 47 | this.secretTextbox = new System.Windows.Forms.TextBox(); 48 | this.codeTextbox = new System.Windows.Forms.TextBox(); 49 | this.groupBox1.SuspendLayout(); 50 | this.groupBox2.SuspendLayout(); 51 | this.groupBox3.SuspendLayout(); 52 | this.groupBox4.SuspendLayout(); 53 | this.groupBox5.SuspendLayout(); 54 | this.SuspendLayout(); 55 | // 56 | // btnLogEvent 57 | // 58 | this.btnLogEvent.Location = new System.Drawing.Point(151, 69); 59 | this.btnLogEvent.Name = "btnLogEvent"; 60 | this.btnLogEvent.Size = new System.Drawing.Size(103, 25); 61 | this.btnLogEvent.TabIndex = 0; 62 | this.btnLogEvent.Text = "Log Event"; 63 | this.btnLogEvent.UseVisualStyleBackColor = true; 64 | this.btnLogEvent.Click += new System.EventHandler(this.btnLogEvent_Click); 65 | // 66 | // btnLogBackgroundSignal 67 | // 68 | this.btnLogBackgroundSignal.Location = new System.Drawing.Point(165, 69); 69 | this.btnLogBackgroundSignal.Name = "btnLogBackgroundSignal"; 70 | this.btnLogBackgroundSignal.Size = new System.Drawing.Size(89, 26); 71 | this.btnLogBackgroundSignal.TabIndex = 1; 72 | this.btnLogBackgroundSignal.Text = "Log Signal"; 73 | this.btnLogBackgroundSignal.UseVisualStyleBackColor = true; 74 | this.btnLogBackgroundSignal.Click += new System.EventHandler(this.btnLogBackgroundSignal_Click); 75 | // 76 | // groupBox1 77 | // 78 | this.groupBox1.Controls.Add(this.secretTextbox); 79 | this.groupBox1.Controls.Add(this.codeTextbox); 80 | this.groupBox1.Location = new System.Drawing.Point(12, 12); 81 | this.groupBox1.Name = "groupBox1"; 82 | this.groupBox1.Size = new System.Drawing.Size(535, 69); 83 | this.groupBox1.TabIndex = 2; 84 | this.groupBox1.TabStop = false; 85 | this.groupBox1.Text = "Credentials"; 86 | this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); 87 | // 88 | // groupBox2 89 | // 90 | this.groupBox2.Controls.Add(this.personNameTextbox); 91 | this.groupBox2.Controls.Add(this.uidTextbox); 92 | this.groupBox2.Controls.Add(this.emailTextbox); 93 | this.groupBox2.Location = new System.Drawing.Point(12, 87); 94 | this.groupBox2.Name = "groupBox2"; 95 | this.groupBox2.Size = new System.Drawing.Size(535, 69); 96 | this.groupBox2.TabIndex = 3; 97 | this.groupBox2.TabStop = false; 98 | this.groupBox2.Text = "Person"; 99 | // 100 | // personNameTextbox 101 | // 102 | this.personNameTextbox.Location = new System.Drawing.Point(353, 31); 103 | this.personNameTextbox.Name = "personNameTextbox"; 104 | this.personNameTextbox.Size = new System.Drawing.Size(159, 21); 105 | this.personNameTextbox.TabIndex = 2; 106 | this.personNameTextbox.Text = "Boba Fett"; 107 | // 108 | // uidTextbox 109 | // 110 | this.uidTextbox.Location = new System.Drawing.Point(188, 31); 111 | this.uidTextbox.Name = "uidTextbox"; 112 | this.uidTextbox.Size = new System.Drawing.Size(159, 21); 113 | this.uidTextbox.TabIndex = 1; 114 | this.uidTextbox.Text = "B28A950EF92B"; 115 | // 116 | // emailTextbox 117 | // 118 | this.emailTextbox.Location = new System.Drawing.Point(23, 31); 119 | this.emailTextbox.Name = "emailTextbox"; 120 | this.emailTextbox.Size = new System.Drawing.Size(159, 21); 121 | this.emailTextbox.TabIndex = 0; 122 | this.emailTextbox.Text = "bountyhunter@mandalorian.io"; 123 | this.emailTextbox.TextChanged += new System.EventHandler(this.textBox3_TextChanged); 124 | // 125 | // groupBox3 126 | // 127 | this.groupBox3.Controls.Add(this.accountNameTextbox); 128 | this.groupBox3.Controls.Add(this.accountIdTextbox); 129 | this.groupBox3.Location = new System.Drawing.Point(12, 162); 130 | this.groupBox3.Name = "groupBox3"; 131 | this.groupBox3.Size = new System.Drawing.Size(535, 69); 132 | this.groupBox3.TabIndex = 4; 133 | this.groupBox3.TabStop = false; 134 | this.groupBox3.Text = "Account"; 135 | // 136 | // accountNameTextbox 137 | // 138 | this.accountNameTextbox.Location = new System.Drawing.Point(188, 30); 139 | this.accountNameTextbox.Name = "accountNameTextbox"; 140 | this.accountNameTextbox.Size = new System.Drawing.Size(159, 21); 141 | this.accountNameTextbox.TabIndex = 1; 142 | this.accountNameTextbox.Text = "Corner Coffee Shop"; 143 | // 144 | // accountIdTextbox 145 | // 146 | this.accountIdTextbox.Location = new System.Drawing.Point(23, 30); 147 | this.accountIdTextbox.Name = "accountIdTextbox"; 148 | this.accountIdTextbox.Size = new System.Drawing.Size(159, 21); 149 | this.accountIdTextbox.TabIndex = 0; 150 | this.accountIdTextbox.Text = "54321"; 151 | // 152 | // groupBox4 153 | // 154 | this.groupBox4.Controls.Add(this.eventNameTextbox); 155 | this.groupBox4.Controls.Add(this.btnLogEvent); 156 | this.groupBox4.Location = new System.Drawing.Point(12, 237); 157 | this.groupBox4.Name = "groupBox4"; 158 | this.groupBox4.Size = new System.Drawing.Size(260, 100); 159 | this.groupBox4.TabIndex = 5; 160 | this.groupBox4.TabStop = false; 161 | this.groupBox4.Text = "Events"; 162 | // 163 | // eventNameTextbox 164 | // 165 | this.eventNameTextbox.Location = new System.Drawing.Point(23, 32); 166 | this.eventNameTextbox.Name = "eventNameTextbox"; 167 | this.eventNameTextbox.Size = new System.Drawing.Size(159, 21); 168 | this.eventNameTextbox.TabIndex = 1; 169 | this.eventNameTextbox.Text = "logged-in"; 170 | // 171 | // groupBox5 172 | // 173 | this.groupBox5.Controls.Add(this.signalValueTextbox); 174 | this.groupBox5.Controls.Add(this.signalNameTextbox); 175 | this.groupBox5.Controls.Add(this.btnLogBackgroundSignal); 176 | this.groupBox5.Location = new System.Drawing.Point(287, 237); 177 | this.groupBox5.Name = "groupBox5"; 178 | this.groupBox5.Size = new System.Drawing.Size(260, 101); 179 | this.groupBox5.TabIndex = 6; 180 | this.groupBox5.TabStop = false; 181 | this.groupBox5.Text = "Background Signals"; 182 | // 183 | // signalValueTextbox 184 | // 185 | this.signalValueTextbox.Location = new System.Drawing.Point(171, 32); 186 | this.signalValueTextbox.Name = "signalValueTextbox"; 187 | this.signalValueTextbox.Size = new System.Drawing.Size(83, 21); 188 | this.signalValueTextbox.TabIndex = 3; 189 | this.signalValueTextbox.Text = "500"; 190 | // 191 | // signalNameTextbox 192 | // 193 | this.signalNameTextbox.Location = new System.Drawing.Point(6, 32); 194 | this.signalNameTextbox.Name = "signalNameTextbox"; 195 | this.signalNameTextbox.Size = new System.Drawing.Size(159, 21); 196 | this.signalNameTextbox.TabIndex = 2; 197 | this.signalNameTextbox.Text = "emails-sent"; 198 | // 199 | // outputTextbox 200 | // 201 | this.outputTextbox.Location = new System.Drawing.Point(12, 346); 202 | this.outputTextbox.Multiline = true; 203 | this.outputTextbox.Name = "outputTextbox"; 204 | this.outputTextbox.ScrollBars = System.Windows.Forms.ScrollBars.Both; 205 | this.outputTextbox.Size = new System.Drawing.Size(534, 109); 206 | this.outputTextbox.TabIndex = 7; 207 | // 208 | // secretTextbox 209 | // 210 | this.secretTextbox.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::Preact_Api_Consumer.Properties.Settings.Default, "SecretKey", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); 211 | this.secretTextbox.Location = new System.Drawing.Point(188, 29); 212 | this.secretTextbox.Name = "secretTextbox"; 213 | this.secretTextbox.Size = new System.Drawing.Size(159, 21); 214 | this.secretTextbox.TabIndex = 1; 215 | this.secretTextbox.Text = global::Preact_Api_Consumer.Properties.Settings.Default.SecretKey; 216 | // 217 | // codeTextbox 218 | // 219 | this.codeTextbox.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::Preact_Api_Consumer.Properties.Settings.Default, "ProjectCode", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); 220 | this.codeTextbox.Location = new System.Drawing.Point(23, 29); 221 | this.codeTextbox.Name = "codeTextbox"; 222 | this.codeTextbox.Size = new System.Drawing.Size(159, 21); 223 | this.codeTextbox.TabIndex = 0; 224 | this.codeTextbox.Text = global::Preact_Api_Consumer.Properties.Settings.Default.ProjectCode; 225 | // 226 | // MainForm 227 | // 228 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 229 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 230 | this.ClientSize = new System.Drawing.Size(559, 461); 231 | this.Controls.Add(this.outputTextbox); 232 | this.Controls.Add(this.groupBox3); 233 | this.Controls.Add(this.groupBox2); 234 | this.Controls.Add(this.groupBox1); 235 | this.Controls.Add(this.groupBox4); 236 | this.Controls.Add(this.groupBox5); 237 | this.Font = new System.Drawing.Font("Tahoma", 8.25F); 238 | this.MaximumSize = new System.Drawing.Size(575, 500); 239 | this.MinimumSize = new System.Drawing.Size(575, 500); 240 | this.Name = "MainForm"; 241 | this.Text = "Preact Logging Test Client"; 242 | this.Load += new System.EventHandler(this.MainForm_Load); 243 | this.groupBox1.ResumeLayout(false); 244 | this.groupBox1.PerformLayout(); 245 | this.groupBox2.ResumeLayout(false); 246 | this.groupBox2.PerformLayout(); 247 | this.groupBox3.ResumeLayout(false); 248 | this.groupBox3.PerformLayout(); 249 | this.groupBox4.ResumeLayout(false); 250 | this.groupBox4.PerformLayout(); 251 | this.groupBox5.ResumeLayout(false); 252 | this.groupBox5.PerformLayout(); 253 | this.ResumeLayout(false); 254 | this.PerformLayout(); 255 | 256 | } 257 | 258 | #endregion 259 | 260 | private System.Windows.Forms.Button btnLogEvent; 261 | private System.Windows.Forms.Button btnLogBackgroundSignal; 262 | private System.Windows.Forms.GroupBox groupBox1; 263 | private System.Windows.Forms.TextBox secretTextbox; 264 | private System.Windows.Forms.TextBox codeTextbox; 265 | private System.Windows.Forms.GroupBox groupBox2; 266 | private System.Windows.Forms.GroupBox groupBox3; 267 | private System.Windows.Forms.TextBox emailTextbox; 268 | private System.Windows.Forms.TextBox uidTextbox; 269 | private System.Windows.Forms.GroupBox groupBox4; 270 | private System.Windows.Forms.GroupBox groupBox5; 271 | private System.Windows.Forms.TextBox personNameTextbox; 272 | private System.Windows.Forms.TextBox accountNameTextbox; 273 | private System.Windows.Forms.TextBox accountIdTextbox; 274 | private System.Windows.Forms.TextBox outputTextbox; 275 | private System.Windows.Forms.TextBox eventNameTextbox; 276 | private System.Windows.Forms.TextBox signalNameTextbox; 277 | private System.Windows.Forms.TextBox signalValueTextbox; 278 | } 279 | } 280 | 281 | --------------------------------------------------------------------------------