<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="Real_Time_Display.aspx.cs" Inherits="Neclog_3_0.Real_Time_Display" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">
        function SelectAllCheckboxes(spanChk) {
            var xState = spanChk.checked;
            var theBox = spanChk;
            elm = theBox.form.elements;
            for (i = 0; i < elm.length; i++)
                if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
                    if (elm[i].checked != xState)
                        elm[i].click();
                }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class='divtable'>
        <asp:HiddenField ID="hdnWidth" runat="server" />
        <asp:HiddenField ID="hdnHeight" runat="server" />
        <asp:HiddenField ID="hdnRecordKeyId" runat="server" />
        <div class='form-box'>
            <div class="box box-success">
                <div class="box-header with-border">
                    <div class='row'>
                        <div class='col-md-10'>
                            <asp:Label ID="lblTitle" runat="server" class="box-title"></asp:Label>
                        </div>
                    </div>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <div class="form-horizontal">
                    <div class="box-body">
                        <asp:UpdatePanel runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="form-group">
                                    <div id="dvScreenWidth" visible="false"></div>
                                    <asp:Label runat="server" Text="Instrument" class="col-sm-2 control-label"></asp:Label>
                                    <div class="col-sm-3">
                                        <asp:HiddenField ID="hdnInstrumentActiveChannels" Value="0" runat="server" />
                                        <asp:DropDownList runat="server" ID="ddlInstrumentName" CssClass="form-control" OnSelectedIndexChanged="ddlInstrumentName_SelectedIndexChanged" AutoPostBack="true">
                                        </asp:DropDownList>

                                    </div>
                                    <div class="col-sm-4">
                                        <asp:Label ID="lblMessage" runat="server" Text="" class="control-label" ForeColor="Red"></asp:Label>
                                    </div>
                                </div>
                                <asp:Panel ID="pnlRealTimeData" runat="server" CssClass="form-group">
                                    <div class="form-group">
                                        <div class="col-sm-3">

                                            <asp:GridView CssClass="table table-striped table-bordered table-hover" Width="99%" ID="grdRealTime" AutoGenerateColumns="false" runat="server">
                                                <Columns>
                                                    <asp:TemplateField>
                                                        <HeaderTemplate>
                                                            <asp:CheckBox ID="chkAll" onclick="javascript:SelectAllCheckboxes(this);" Checked="true"
                                                                runat="server" ToolTip="Select/Deselect All"></asp:CheckBox>
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="chkRecordId" Checked="true" runat="server"></asp:CheckBox>
                                                        </ItemTemplate>
                                                        <ItemStyle HorizontalAlign="Center" Width="10px" />
                                                        <HeaderStyle HorizontalAlign="Center" Width="10px" />
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="ParameterName" HeaderText="Channel" ItemStyle-Width="70%" ItemStyle-Height="25px" ItemStyle-HorizontalAlign="left" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="true" />
                                                    <asp:BoundField DataField="ParameterRealValue" HeaderText="Value" ItemStyle-Width="30%" ItemStyle-Height="25px" ItemStyle-HorizontalAlign="left" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="true" />
                                                </Columns>
                                            </asp:GridView>

                                        </div>
                                        <asp:Panel ID="pnlChart" runat="server" Visible="false" class="col-sm-9">
                                            <div class="form-group">
                                                <div class="col-sm-12">
                                                    <asp:HiddenField ID="hdnAxisY_Minimum" runat="server" />
                                                    <asp:HiddenField ID="hdnAxisY_Miximum" runat="server" />
                                                    <asp:HiddenField ID="hdnAxisY1_Minimum" runat="server" />
                                                    <asp:HiddenField ID="hdnAxisY1_Miximum" runat="server" />
                                                    <div class="col-sm-0 control-label">
                                                        LL
                                                    </div>
                                                    <div class="col-sm-2">
                                                        <asp:TextBox ID="txtLowerLimit" onkeypress="return onlyNumbers(event, this);" runat="server" CssClass="form-control" />
                                                    </div>
                                                    <div class="col-sm-0">
                                                        &nbsp;
                                                    </div>
                                                    <div class="col-sm-0 control-label">
                                                        UL
                                                    </div>
                                                    <div class="col-sm-2">
                                                        <asp:TextBox ID="txtUpperLimit" runat="server" onkeypress="return onlyNumbers(event, this);" CssClass="form-control" />
                                                    </div>
                                                    <div class="col-sm-0">
                                                        &nbsp;
                                                    </div>
                                                    <div class="col-sm-0 control-label" style="visibility: hidden;">
                                                        No of Plots
                                                    </div>
                                                    <div class="col-sm-1">
                                                        <asp:TextBox ID="txtNoOfPlots" runat="server" onkeypress="return onlyNumbers(event, this);" Text="60" CssClass="form-control" Visible="false" />
                                                    </div>
                                                    <div class="col-sm-2" style="visibility: hidden;">
                                                        <asp:DropDownList runat="server" ID="ddlYAxisType" CssClass="form-control">
                                                            <asp:ListItem Text="Primary" Value="0" />
                                                            <asp:ListItem Text="Secondary" Value="1" />
                                                        </asp:DropDownList>
                                                    </div>
                                                    <div class="col-sm-1">
                                                        <asp:Button ID="btnRefreshGraph" OnClick="btnRefreshGraph_Click" CssClass="myButton" Text="Refresh" runat="server" ToolTip="Refresh" />&nbsp;
                                                    </div>
                                                    <div class="col-sm-0">
                                                        &nbsp;
                                                    </div>
                                                    <div class="col-sm-1">
                                                        <asp:Button ID="btnReset" OnClick="btnReset_Click" Text="Reset" CssClass="myButton" runat="server" ToolTip="Reset" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-sm-12">
                                                    <div id="divChart" runat="server" style="width: 100%; height: 100vh">
                                                        <asp:Chart ID="Chart1" runat="server" EnableViewState="True"></asp:Chart>
                                                    </div>
                                                </div>
                                            </div>
                                        </asp:Panel>
                                    </div>
                                </asp:Panel>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="ddlInstrumentName" EventName="SelectedIndexChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                        <asp:UpdatePanel runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Timer ID="tmrRealTimeData" Interval="30000" Enabled="false" OnTick="tmrRealTimeData_Tick" runat="server"></asp:Timer>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="tmrRealTimeData" EventName="Tick" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
