一.silverlight与silverlight中可以利用委托(delegate)来刷新frame.Refresh()

1.在子类中定义委托捕捉关闭事件按钮

         public delegate void onCloseClick(object sender, RoutedEventArgs e);
public onCloseClick onclose;
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
if (onclose != null)
{
onclose(sender, e);
}
this.Visibility = Visibility.Collapsed;
}

2.在frame所在的页面中利用委托来调用frame.refresh()方法

 List<Button> listButton = ShowOpenPanelConfig(tb);
Child_YJCBS yjcb = new Child_YJCBS();
OPPanel op = EasySL.Controls.Window.ShowOpPanel("一键出表", yjcb, this.floatePanel, txtMsgInfo);
op.onclose += (s, e) => { ContentFrame.Refresh(); };
yjcb.onclose += (s, e) =>
{
op.Visibility = Visibility.Collapsed; ContentFrame.Refresh();
};

二、利用aspx中的cookie来控制sl中的定时器
1.在frame所在的页面中定义计时器

  private void TimeInitData()
{
if (myDispatcherTimer != null)
myDispatcherTimer.Stop();
//创建计时器
myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
//创建间隔时间
myDispatcherTimer.Interval = new TimeSpan(, , , );
//创建到达间隔时间后需执行的函数
myDispatcherTimer.Tick += (ss, ee) =>
{
this.ContentFrame.Refresh();
String[] cookies = HtmlPage.Document.Cookies.Split(';');
foreach (String cookie in cookies)
{
String[] keyValues = cookie.Split('=');
{
if (keyValues[].Trim() == "FirCookieKey")
{
myDispatcherTimer.Stop();
}
}
} };
myDispatcherTimer.Start();
}

2.在aspx页面中创建cookie并设置cookie的过期时间

  if (isSuccess)
{
Response.Cookies.Clear();
HttpCookie MyCookie = new HttpCookie("FirCookieKey");
MyCookie.Value = "NewCookieValue";
MyCookie.Expires =DateTime.Now.Add(TimeSpan.FromMinutes(0.2));
HttpContext.Current.Response.Cookies.Add(MyCookie);
Server.Transfer("PreviewReport.aspx");
//Page.Response.Write("<script language=javascript>alert(\" 插入成功!\");</script>");
}

注意:以上设置的cookie过期时间为12秒,而sl是已5秒中的加载一次,

aspx利用cookie值来停止silverlight中的计时器的更多相关文章

  1. 利用cookie实现浏览器中多个标签页之间的通信

    原理: cookie是浏览器端的存储容器,而且它是多页面共享的,利用cookie多页面共享的特性,可以实现多个标签页的通信. 比如: 一个标签页发送消息(将发送的消息设置到cookie中),一个标签页 ...

  2. 【原创】js中利用cookie实现记住密码功能

    在登录界面添加记住密码功能,我首先想到的是在java后台中调用cookie存放账号密码,大致如下: HttpServletRequest request HttpServletResponse res ...

  3. SpringMVC(六):@RequestMapping下使用@RequestHeader绑定请求报头的属性值、@CookieValue绑定请求中的Cookie值

    备注:我本地浏览器的报头(Request Header)信息如下: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image ...

  4. js中利用cookie实现记住密码功能

    在登录界面添加记住密码功能,代码如下: //设置cookie var passKey = '4c05c54d952b11e691d76c0b843ea7f9'; function setCookie( ...

  5. Servlet中保存的cookie值读取不到

    在设计登录时记住密码功能时,很多时候回使用cookie,在Servlet中保存cookie时,再次访问登录页面,没有读取到保存的cookie值,代码如下: 1 Cookie idCookie = ne ...

  6. Jmeter中传递cookie值

    场景:用户登陆后会本地会保存cookie,cookie是用来跟服务端验证此用户已经登陆过的重要信息,但是如何获取并在其他请求时将此cookie传递给服务器呢? 在线程组下面之直接添加HTTP Cook ...

  7. 【Python web自动化】之读取配置文件参数,利用cookie返回值进行跳过验证码进行登录操作

    当进行Python的Web自动化时,会涉及到验证码问题,该如何跳过执行呢,下面请看代码: 1.首先新建配置文件*.ini格式 config.ini [db] #基础地址: baseurl = http ...

  8. 利用Entity Framework修改指定字段中的值

    利用Entity Framework修改指定字段中的值一般我们编辑某些模型的时候会用到类似这样的代码: [HttpPost] public ActionResult Edit(Article mode ...

  9. 在php中修改cookie值遇到的奇怪问题

    本想修改cookie的值比较简单,结果测试发现并不是. 刚开始实现cookie修改的思路:先删除以前的cookie值,再创建一个新的. setcookie('name',value,time()-1) ...

随机推荐

  1. LeetCode35 Search Insert Position

    题目: Given a sorted array and a target value, return the index if the target is found. If not, return ...

  2. 一个对称加密、解密的方法C#工具类

    封装了一个对称加解密的类,用私钥和密钥加解密 using System; using System.Collections.Generic; using System.Text; using Syst ...

  3. UVa OJ 10071

    Problem B Back to High School Physics Input: standard input Output: standard output A particle has i ...

  4. recent.css常用的页面初始化样式

    <style> @charset "utf-8"; body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form ...

  5. 【Python千问 2】Python核心编程(第二版)-- 欢迎来到Python世界

    1.1 什么是Python 继承了传统编译语言的强大性和通用性,同时也借鉴了简单脚本和解释语言的易用性. 1.2 起源 来源于某个项目,那些程序员利用手边现有的工具辛苦工作着,他们设想并开发了更好的解 ...

  6. oracle数据库例外处理与视图

    pl/sql例外处理 例 当输入编号没有时的例外处理 declare --定义 v_ename emp.ename%type; begin -- select ename into v_ename f ...

  7. Umbraco(5)-Creating Master Template Part 1(翻译文档)

    原文地址:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/umbraco5-creating-master-template-par ...

  8. 剑指Offer43 n个骰子点数概率

    /************************************************************************* > File Name: 43_Dics.c ...

  9. Tensorflow之安装

    1.fellow the instruction of https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/ge ...

  10. OpenShare:前所未有的开放性

    客户总是面临一个选择:开放的企业门户产品 vs 封闭的企业门户产品 市场上大多数企业门户产品是自成一体的其实也就是封闭的,他们不能和企业目录集成,不能和Exchange集成,不能和SAP集成,不能和L ...