aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityDTOCodeFile.cshtml
blob: 7992aeb86bff8c9bea5a5b525557f6adeff42e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@{ 
    Tango.CodeGeneration.EntityDTOCodeFile model = Model as Tango.CodeGeneration.EntityDTOCodeFile;
}
//------------------------------------------------------------------------------
// <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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;

namespace Tango.BL.DTO
{
    @if (model.Description != null)
    {
        <div>
        /// <summary>
        /// @(model.Description)
        /// </summary>
        </div>
    }
    public abstract class @(model.Name) : ObservableEntityDTO<@(model.InheritedType), @(model.ObservableType)>
    {
        @foreach (var prop in model.Properties)
        {
          <div>
            /// <summary>
            /// @(prop.Description)
            /// </summary>
            public @(prop.Type) @(prop.Name) { get; set; }

          </div>
        }
    }
}
span class="k">using RealTimeGraphX.Renderers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RealTimeGraphX { public class GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> where XDataPoint : GraphDataPointBase where YDataPoint : GraphDataPointBase where TDataSeries : class, IGraphDataSeries { public enum RendererType { Scrolling, Erase, } private List<KeyValuePair<int, Action>> _steps; private IGraphController<TDataSeries, XDataPoint, YDataPoint> _controller; private int _data_series_counter = 100; public GraphControllerBuilder() { _steps = new List<KeyValuePair<int, Action>>(); } public GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> SetRenderer(RendererType renderer, TimeSpan refreshRate) { return AddStep(0, () => { if (renderer == RendererType.Scrolling) { _controller.ConnectOutput(new GraphScrollingRenderer<TDataSeries, XDataPoint, YDataPoint>() { RefreshRate = refreshRate }); } else { _controller.ConnectOutput(new GraphEraseRenderer<TDataSeries, XDataPoint, YDataPoint>() { RefreshRate = refreshRate }); } }); } public GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> SetRange(YDataPoint minimumY, YDataPoint maximumY, XDataPoint maximumX, bool autoY = false) { return AddStep(1, () => { _controller.Range.MinimumY = minimumY; _controller.Range.MaximumY = maximumY; _controller.Range.MaximumX = maximumX; _controller.Range.AutoY = autoY; }); } public GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> SetPainter<T>() where T : IGraphPainter<TDataSeries> { return AddStep(2, () => { _controller.Output.ThrowIfNull("No renderer was set."); _controller.Output.ConnectOutput(Activator.CreateInstance<T>()); }); } public GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> AddSeries(TDataSeries series) { return AddStep(_data_series_counter++, () => { _controller.AddDataSeries(series); }); } protected GraphControllerBuilder<TDataSeries, XDataPoint, YDataPoint> AddStep(int index, Action action) { _steps.Add(new KeyValuePair<int, Action>(index, action)); return this; } protected void CommitSteps() { foreach (var step in _steps.ToList().GroupBy(x => x.Key).Select(g => g.First()).OrderBy(x => x.Key)) { step.Value(); } } public IGraphController<TDataSeries, XDataPoint, YDataPoint> Build() { _controller = new GraphController<TDataSeries, XDataPoint, YDataPoint>(); CommitSteps(); return _controller; } } }