I. Silverlight and Silverlight can use delegates (delegate) to refresh Frame.refresh ()
1. Defining a delegate Snap Close event button in a subclass
1 Public Delegate voidOncloseclick (Objectsender, RoutedEventArgs e);2 PublicOncloseclick OnClose;3 Private voidCancelbutton_click (Objectsender, RoutedEventArgs e)4 {5 if(OnClose! =NULL)6 {7 OnClose (sender, E);8 }9 This. Visibility =visibility.collapsed;Ten}
2. Invoke the Frame.refresh () method using a delegate in the page where the frame is located
list<button> Listbutton = showopenpanelconfig (TB); New Child_yjcbs (); = EasySL.Controls.Window.ShowOpPanel (" one key out of table "this. Floatepanel, Txtmsginfo) ; + = (s, e) = = {Contentframe.refresh (); }; + = (s, e) = = visibility.collapsed; Contentframe.refresh (); };
View Code
Second, use the cookie in ASPX to control the timer in SL
1. Define a timer on the page where frame is located
1 Private voidTimeinitdata ()2 {3 if(Mydispatchertimer! =NULL)4 mydispatchertimer.stop ();5 //Create a timer6Mydispatchertimer =NewSystem.Windows.Threading.DispatcherTimer ();7 //Create interval time8Mydispatchertimer.interval =NewTimeSpan (0,0,0,5);9 //functions to be executed after the arrival interval has been createdTenMydispatchertimer.tick + = (ss, ee) = = One { A This. Contentframe.refresh (); -string[] cookies = HtmlPage.Document.Cookies.Split (';'); - foreach(String Cookieinchcookies) the { -string[] KeyValues = cookie. Split ('='); - { - if(keyvalues[0]. Trim () = ="Fircookiekey") + { - mydispatchertimer.stop (); + } A } at } - - }; - Mydispatchertimer.start (); -}
2. Create a cookie in the ASPX page and set the expiration time of the cookie
1 if(issuccess)2 {3 Response.Cookies.Clear ();4HttpCookie MyCookie =NewHttpCookie ("Fircookiekey");5Mycookie.value ="Newcookievalue";6Mycookie.expires =datetime.now.add (Timespan.fromminutes (0.2));7 HttpContext.Current.Response.Cookies.Add (MyCookie);8Server.Transfer ("previewreport.aspx");9 //Page.Response.Write ("<script language=javascript>alert (\" Insert Success!\ ");</script>");Ten}
Note: The cookie expiration time set above is 12 seconds, and SL is loaded once in 5 seconds,