Ext.Net系列:二Event之DirectEvent 示例2(Delay)

     此示例演示事件延时。通过设置属性Delay值可以使事件延时执行。Delay表示延时的毫秒数,默认为20毫秒
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DelayEvent.aspx.cs" Inherits="Events_DirectEvents_DelayEvent" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>延时</title> 
    <script runat="server">
        protected void DelayEvent(object sender, DirectEventArgs e)
        {
            X.Msg.Notify("老虞说", "你好").Show();
        } 
    </script>
    <script type="text/javascript">
    var beforeMthod=function(element,extraParams)
    {
        var date=new Date();
         Ext.Msg.alert('时间',
         "提交时间:"+Ext.getCmp("LocalTimeLabel").getText()+"<br/>"+
         "当前时间:"+TimeDemo(date));
      
    }
    function TimeDemo(date){
       var d, s ="";
       var c = ":";
       if(date)
         d =date;
       else
         d=new Date();  
       s += d.getHours() + c;
       s += d.getMinutes() + c;
       s += d.getSeconds() + c;
       s += d.getMilliseconds();
       return(s);
 }

    
    </script>
</head>
<body>
<!--
 Delay 延时毫秒数
-->
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <ext:Button ID="Button3" runat="server" Text="提交">
        <DirectEvents>
            <Click Delay="5000" OnEvent="DelayEvent" CleanRequest="false" Before="beforeMthod"> 
            </Click>
        </DirectEvents>
        <Listeners>
            <Click Handler="#{TaskManager1}.stopAll();"  /> 
        </Listeners>
    </ext:Button> 
    <ext:TaskManager ID="TaskManager1" runat="server">
        <Tasks>
            <ext:Task>
                <Listeners>
                    <Update Handler="#{LocalTimeLabel}.setText(TimeDemo());" />
                </Listeners>
            </ext:Task>
        </Tasks>
    </ext:TaskManager>
    <ext:Label ID="LocalTimeLabel" runat="server">
    </ext:Label>
    </form>
</body>
</html>
Technorati 标签: Ext.Net

你可能感兴趣的:(Ext.Net系列:二Event之DirectEvent 示例2(Delay))