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

myapp.gauges = [];
myapp.GaugeUsingRanges.LinearGauge_render = function (element, contentItem) {
    var gauge = new c1.cba.LinearGauge($(element), contentItem);
    myapp.gauges.push(gauge.wjControl);
};

myapp.GaugeUsingRanges.BulletGraph_render = function (element, contentItem) {
    var gauge = new c1.cba.BulletGraph($(element), contentItem);
    myapp.gauges.push(gauge.wjControl);
};

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

myapp.GaugeUsingRanges.ShowRanges_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.showRanges = val;
        })
    });
};