/// <reference path="../GeneratedArtifacts/viewModel.js" />
/// <reference path="../Scripts/wijmo.cba.js" />

myapp.gauges = [];
myapp.RadialGaugeAutoScaling.RadialGauge_render = function (element, contentItem) {
    var gauge = new c1.cba.RadialGauge($(element), contentItem);
    myapp.gauges.push(gauge.wjControl);
};

myapp.RadialGaugeAutoScaling.StartAngle_render = function (element, contentItem) {
    $("<select><option>0</option><option>90</option><option>180</option><option>270</option><option>360</option></select>")
    .appendTo($(element))
    .change(function () {
        var val = Number($(this).val());
        $.each(myapp.gauges, function (index, gauge) {
            gauge.startAngle = val;
        })
    });
};

myapp.RadialGaugeAutoScaling.SweepAngle_render = function (element, contentItem) {
    $("<select><option>90</option><option>180</option><option>270</option><option>360</option></select>")
    .appendTo($(element))
    .change(function () {
        var val = Number($(this).val());
        $.each(myapp.gauges, function (index, gauge) {
            gauge.sweepAngle = val;
        })
    });
};

myapp.RadialGaugeAutoScaling.AutoScale_render = function (element, contentItem) {
    $("<select><option>True</option><option>False</option></select>")
    .appendTo($(element))
    .change(function () {
        var val = ($(this).val() === "True");
        $.each(myapp.gauges, function (index, gauge) {
            gauge.autoScale = val;
        })
    });
};
