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

myapp.PieSelection.FlexPie_render = function (element, contentItem) {
    var pie = new c1.cba.FlexPie($(element), contentItem);
    var collectionView = new c1.cba.LightSwitchCollectionView(contentItem);
    pie.wjControl.itemsSource = collectionView;
    myapp.pie = pie.wjControl;
};

myapp.PieSelection.SelectedItemPosition_render = function (element, contentItem) {
    $("<select><option>Top</option><option>Bottom</option><option>Left</option><option>None</option><option>Right</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.pie.selectedItemPosition = $(this).val();
    });
};

myapp.PieSelection.SelectedItemOffset_render = function (element, contentItem) {
    $("<select><option>0</option><option>0.1</option><option>0.2</option></select>")
   .appendTo($(element))
   .change(function () {
       myapp.pie.selectedItemOffset = Number($(this).val());
   });
};

myapp.PieSelection.IsAnimated_render = function (element, contentItem) {
    $("<select><option>False</option><option selected>True</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.pie.isAnimated = $(this).val() === "True";
    });
};