aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj4
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/TangoWebClientv2CodeFile.cs30
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml59
3 files changed, 92 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
index 4c2793367..41413f4bd 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
@@ -90,6 +90,7 @@
<Compile Include="ObservablesAdapterFile.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Property.cs" />
+ <Compile Include="TangoWebClientv2CodeFile.cs" />
<Compile Include="TangoWebClientCodeFile.cs" />
</ItemGroup>
<ItemGroup>
@@ -125,11 +126,12 @@
<EmbeddedResource Include="Templates\TangoWebClientCodeFile.cshtml" />
<EmbeddedResource Include="Templates\EntityDTOCodeFile.cshtml" />
<EmbeddedResource Include="Templates\EntityInheritedDTOCodeFile.cshtml" />
+ <EmbeddedResource Include="Templates\TangoWebClientv2CodeFile.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/TangoWebClientv2CodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/TangoWebClientv2CodeFile.cs
new file mode 100644
index 000000000..421655d07
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/TangoWebClientv2CodeFile.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ public class TangoWebClientv2CodeFile : Class
+ {
+ public class ControllerAction
+ {
+ public String Name { get; set; }
+ public String Request { get; set; }
+ public String Response { get; set; }
+ }
+
+ public String Namespace { get; set; }
+ public String ControllerName { get; set; }
+ public String LoginRequest { get; set; }
+ public String LoginResponse { get; set; }
+
+ public List<ControllerAction> Actions { get; set; }
+
+ public TangoWebClientv2CodeFile()
+ {
+ Actions = new List<ControllerAction>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml
new file mode 100644
index 000000000..cfcc89716
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml
@@ -0,0 +1,59 @@
+@{
+ Tango.CodeGeneration.TangoWebClientv2CodeFile model = Model as Tango.CodeGeneration.TangoWebClientv2CodeFile;
+}
+using System;
+using System.Threading.Tasks;
+using Tango.Web;
+
+namespace @(model.Namespace)
+{
+ /// <summary>
+ /// Represents a machine service @(model.ControllerName) web client.
+ /// </summary>
+ /// <seealso cref="Tango.Web.TangoWebClient" />
+ public abstract class @(model.Name) : TangoWebClientV2<@(model.LoginRequest), @(model.LoginResponse)>
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
+ /// </summary>
+ /// <param name="address">The service address.</param>
+ /// <param name="token">Existing token.</param>
+ public @(model.Name)(String address, String token) : base(address, "@(model.ControllerName)", token)
+ {
+
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
+ /// </summary>
+ /// <param name="address">The service address.</param>
+ public @(model.Name)(String address) : this(address, null)
+ {
+
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
+ /// </summary>
+ /// <param name="cloned">Other instance.</param>
+ public @(model.Name)(@(model.Name) cloned) : base(cloned)
+ {
+
+ }
+
+ @foreach (var action in model.Actions)
+ {
+ <div>
+ /// <summary>
+ /// Executes the @(action.Name) action and returns @(action.Response).
+ /// </summary>
+ /// <returns></returns>
+ public Task<@(action.Response)> @(action.Name)(@(action.Request) request)
+ {
+ return Post<@(action.Request), @(action.Response)>("@(action.Name)", request);
+ }
+
+ </div>
+ }
+ }
+} \ No newline at end of file