Silverlight自动更新的代码

一段SL中自动更新程序的代码,随手记一下。

 


 

private void Application_Startup(object sender, StartupEventArgs e) 

{ 

         this.CheckAndDownloadUpdateAsync(); 

         this.RootVisual = new MainPage(); 

} 

public App() 

{ 

            this.Startup += this.Application_Startup; 

            this.Exit += this.Application_Exit; 

            this.UnhandledException += this.Application_UnhandledException; 

            this.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted); 

            InitializeComponent(); 

            

} 


void App_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e) 

 { 

            if (e.UpdateAvailable) { 

                MessageBox.Show("There are new updates downloaded. Please restart!"); 

            } 

   } 



 

你可能感兴趣的:(SilverLight)