aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/App_Start/WebApiConfig.cs
blob: 73265328c7566d165188b854e03ba595e05abf51 (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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Tango.Web.Formatters;

namespace Tango.MachineService
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
            name: "API Default",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });

            config.Formatters.Insert(0, new ProtoBufFormatter());
            //config.Formatters.Insert(1, new JsonNetFormatter(new JsonSerializerSettings()
            //{
            //    PreserveReferencesHandling = PreserveReferencesHandling.All,
            //}));
        }
    }
}
/span>Convert.ToDouble(values[0]); double elementWidth = System.Convert.ToDouble(values[1]); double segmentLength = System.Convert.ToDouble(values[2]); double result = (segmentLength / jobLength) * elementWidth; return double.IsInfinity(result) ? 0d : result; } else { return 0d; } } else { return 0d; } } catch { return 0d; } } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }