<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="Domain" %>
<%
    List<RoomTypeScene> AppScenes = ViewData["AppSceneControl"] as List<RoomTypeScene>;       
%>
<link type="text/css" rel="stylesheet" href="/Styles/app/control.css" />
<script type="text/javascript">

    function setScene(scene) {
        showLoading();
        $.ajax({
            url: RoomConfig.SceneUrl,
            data: { SceneID: scene },
            type: "POST",
            dataType: "JSON",
            success: function (r) {
                hideLoading();
                if (!r.IsSuccess) {
                    showTip(r.Message);
                }
            }
        });
    }

    $(function () {
        $("#sence dd a").click(function () {
            $("#sence dd").removeClass("active");
            $(this).parent().addClass("active");
            $("#sence dt").html($(this).attr("title") + "模式已开启");
            setScene($(this).attr("scene"));
        });
    })
</script>
<div id="cmain">
    <dl id="sence" class="cmain-list clearfix">
        <% foreach (var item in AppScenes)
           { 
        %>
        <dd>
            <a href="javascript:void(0)" style='background-image: url(../../<%= item.Icon %>);background-size: 100% 100%;'
                scene='<%=item.ID %>'>
                <% if (Request.Cookies["isCN"].Value.ToString() == "zh-cn")
                   { %>
                <span>
                    <%=item.Name %> </span>
                <% }
                   else
                   { %>
                <span>
                    <%=item.EnglishName %></span>
                <% } %>
            </a>
        </dd>
        <% } %>       
    </dl>
</div>
