diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-20 19:43:15 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-20 19:43:15 +0300 |
| commit | 51afc4f6a17383e91a72c2ce060e82604d43c3a8 (patch) | |
| tree | c0aa029d9864fc8f03b69716a42eda5efe65ccd5 /Software/Visual_Studio/Tango.CodeGeneration | |
| parent | 2ea6653199844f5607d17a8912eb7a99e2471610 (diff) | |
| download | Tango-51afc4f6a17383e91a72c2ce060e82604d43c3a8.tar.gz Tango-51afc4f6a17383e91a72c2ce060e82604d43c3a8.zip | |
Working on new Machine Studio DB.
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
4 files changed, 73 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/ObservablesStaticCollectionsFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesStaticCollectionsFile.cs new file mode 100644 index 000000000..0e4e4bf3e --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesStaticCollectionsFile.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class ObservablesStaticCollectionsFile : Class + { + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index a9517f3b2..ef89bd682 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -70,6 +70,7 @@ <Compile Include="EntityCodeFile.cs" /> <Compile Include="EnumerationField.cs" /> <Compile Include="ObservablesContextCodeFile.cs" /> + <Compile Include="ObservablesStaticCollectionsFile.cs" /> <Compile Include="ProtoEnumFile.cs" /> <Compile Include="ProtoMessageFile.cs" /> <Compile Include="ProtoProperty.cs" /> @@ -114,11 +115,12 @@ <EmbeddedResource Include="Templates\ProtoMessageFile.cshtml" /> <EmbeddedResource Include="Templates\ProtoEnumFile.cshtml" /> <EmbeddedResource Include="Templates\EntityCodeFileJavaExtension.cshtml" /> + <EmbeddedResource Include="Templates\ObservablesStaticCollectionsFile.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/Templates/EntityCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml index 873668545..cb8760755 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml @@ -74,6 +74,7 @@ namespace Tango.BL.Entities { <div> @(prop.Name) = new @(prop.Type)(); + @(prop.Name).EnableCrossThreadOperations(); </div> } } diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesStaticCollectionsFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesStaticCollectionsFile.cshtml new file mode 100644 index 000000000..f6a4a8793 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesStaticCollectionsFile.cshtml @@ -0,0 +1,57 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// </auto-generated> +//------------------------------------------------------------------------------ + +using System.Collections.ObjectModel; +using System.ComponentModel; +using Tango.BL.Entities; + +namespace Tango.BL +{ + public partial class @(Model.Name) + { + @foreach (var prop in Model.Properties) + { + <div> + private @(prop.Type) _@(prop.Name.ToLower()); + /// <summary> + /// Gets or sets the @(prop.Name). + /// </summary> + public @(prop.Type) @(prop.Name) + { + get { return _@(prop.Name.ToLower()); } + set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); } + } + + private ICollectionView _@(prop.Name.ToLower())ViewSource; + /// <summary> + /// Gets or sets the @(prop.Name) View Source. + ///</summary> + public ICollectionView @(prop.Name)ViewSource + { + get { return _@(prop.Name.ToLower())ViewSource; } + set { _@(prop.Name.ToLower())ViewSource = value; RaisePropertyChanged(nameof(@(prop.Name)ViewSource)); } + } + </div> + } + + /// <summary> + /// Initialize collection sources. + /// </summary> + private void InitCollectionSources() + { + @foreach (var prop in Model.Properties) + { + <div> + @(prop.Name)ViewSource = CreateCollectionView(@(prop.Name)); + </div> + } + } + } +} |
