Silverlight学习笔记(2)-安装Silverlight到本地

OutOfBrowser.xaml

<Button x:Name="button" Click="button_Click" Width=100 Height=30></Button>

 

OutOfBrowser.xaml.cs

public OutOfBrowser()

{

InitializeComponent();

this.Loaded+=new RoutedEventHandler(OutOfBrowser_Loaded);

}

 

void OutOfBrowser_Loaded(object sender,RoutedEventArgs e)

{

InitButton();

App.Current.InstallStateChanged+=new EventHandler(Current_InstallStateChanged);

}

 

void Current_InstallStateChanged(object sender,EventArgs e)

{

InitButton();

}

 

private void button_Click(object sender,RoutedEventArgs e)

{

if(!App.Current.IsRunningOutOfBrowser&& App.Current.InstallState==InstallState.NotInstalled)

       App.Current.Install();

else

      MessageBox.Show("请右键卸载!");

}

 

 

private void InitButton()

{

         if(App.Current.IsRunningOutOfBrowser)

        button.Content=”卸载”;

else

        button.Content=”安装”;

}

右键单击解决方案中的Properties,选择打开,在打开的菜单中选择Silverlight,选中允许在浏览器外运行应用程序,然后单击浏览器外设置按钮,在打开的窗口中设置安装后要显示的窗口标题,高度和宽度,以及快捷名称和下载说明,设置完成后保存一下,会看到在Properties中生成了一个OutOfBrowserSettings.xml文件,文件中会显示刚才我们配置的一些信息。

然后运行就可以安装了!

转载于:https://www.cnblogs.com/jasmine_xm/archive/2010/03/23/1692729.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值