silverlight   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了silverlight 判断窗口打开大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

  编辑NotificationControl控件,我们简单的对该控件进行美化,使其看起来更加友好,    1  < UserControl  x:Class ="SilverlightOOBDemo.NotificationControl"  2      xmlns ="http://scheR_802_11845@as.microsoft.com/winfx/2006/xaml/presentation"  3 
 

编辑NotificationControl控件,我们简单的对该控件进行美化,使其看起来更加友好,

 

 1  < UserControl  x:Class ="SilverlightOOBDemo.NotificationControl" @H_607_35@  2      xmlns ="http://scheR_802_11845@as.microsoft.com/winfx/2006/xaml/presentation" @H_607_35@  3      xmlns:x ="http://scheR_802_11845@as.microsoft.com/winfx/2006/xaml" @H_607_35@  4      xmlns:d ="http://scheR_802_11845@as.microsoft.com/expression/blend/2008" @H_607_35@  5      xmlns:mc ="http://scheR_802_11845@as.openxmlformats.org/markup-compatibility/2006" @H_607_35@  6      mc:Ignorable ="d" @H_607_35@  7      d:DesignHeight ="300"  d:DesignWidth ="400" > @H_607_35@  8      @H_607_35@  9       < Grid  x:Name ="LayoutRoot"  BACkground ="White" > @H_607_35@ 10           < Border  x:Name ="Frame"  Width ="300"  Height ="100"  BACkground ="LightYellow" > @H_607_35@ 11               < StackPanel  Orientation ="Vertical" > @H_607_35@ 12                   < Border  Width ="290"  Height ="24"  CornerRadius ="4"  Margin ="2,4,2,4" > @H_607_35@ 13                       < Border.BACkground > @H_607_35@ 14                           < LinearGradientBrush  StartPoint ="0.5,0.0" @H_607_35@ 15                          EndPoint ="0.5,1.0" > @H_607_35@ 16                               < GradientStop  Offset ="0.2"  Color ="#FF1C68A0"   /> @H_607_35@ 17                               < GradientStop  Offset ="1.0"  Color ="#FF54A7E2"   /> @H_607_35@ 18                           </ LinearGradientBrush > @H_607_35@ 19                       </ Border.BACkground > @H_607_35@ 20                       < Border.Effect > @H_607_35@ 21                           < DropShadowEffect  BlurRadius ="4"  ShadowDepth ="4" @H_607_35@ 22                          Opacity ="0.4"   /> @H_607_35@ 23                       </ Border.Effect > @H_607_35@ 24                       < TextBlock  Text ="友情提示"  FontSize ="12" @H_607_35@ 25                      FontWeight ="Bold"  Foreground ="White"  Margin ="4"   /> @H_607_35@ 26                   </ Border > @H_607_35@ 27                   < StackPanel  Orientation ="Horizontal" > @H_607_35@ 28                       < Image  source ="/SilverlightOOBDemo;component/Images/update.png"  Width ="48"  Height ="48" @H_607_35@ 29                      Stretch ="Fill"  Margin ="4"  VerticalAlignment ="Top"   /> @H_607_35@ 30                       < TextBlock  Width ="240"  text ="检测到新的音乐文件,已经更新到播放列表。小广告:我的博客http://jv9.cnblogs.com" @H_607_35@ 31                      FontSize ="11"  Foreground ="#FF202020"  textwrapping ="Wrap" @H_607_35@ 32                      Margin ="4"   /> @H_607_35@ 33                   </ StackPanel > @H_607_35@ 34               </ StackPanel > @H_607_35@ 35           </ Border > @H_607_35@ 36       </ Grid > @H_607_35@ 37  </ UserControl > @H_607_35@ 38 

 

 

然后回到OutofBrowserMainPage页面,这里,我们在“关于”按钮上,添加Click事件响应,使其被点击后,弹出Notifications窗口。

silverlight 判断窗口打开

 

首先创建notifyWindow实例,

 

 1  #region  Private Members @H_607_35@  2          Window OOBWindow  =  Application.Current.MainWindow;@H_607_35@  3          NotificationWindow notifyWindow  =   null ;@H_607_35@  4           #endregion @H_607_35@  5  @H_607_35@  6           #region  constructor @H_607_35@  7           public  OutofBrowserMainPage()@H_607_35@  8          {@H_607_35@  9              initializeComponent();@H_607_35@ 10              notifyWindow  =   new  NotificationWindow();@H_607_35@ 11             @H_607_35@ 12            @H_607_35@ 13          }@H_607_35@ 14  #endregion

 

 

然后在Click事件中进行窗口激活:

 1           private   void  aboutBtn_Click( object  sender, routedEventArgs E)@H_607_35@  2          {@H_607_35@  3               if  ( null   ==  notifyWindow)@H_607_35@  4                  messageBox.Show( " 通告窗口仅能运行在OOB模式下,请安装Silverlight应用到本地。 " );@H_607_35@  5  @H_607_35@  6               if  ( true   ==  App.Current.IsRunningOutOfBrowser)@H_607_35@  7              {@H_607_35@  8                   if  (notifyWindow.Visibility  ==  Visibility.VisiblE)@H_607_35@  9                      notifyWindow.Close();@H_607_35@ 10  @H_607_35@ 11                  NotificationControl myNotify  =   new  NotificationControl();@H_607_35@ 12                  notifyWindow.Width  =   300 ;@H_607_35@ 13                  notifyWindow.Height  =   100 ;@H_607_35@ 14                  notifyWindow.Content  =  myNotify;@H_607_35@ 15                  notifyWindow.Show( 10000 );@H_607_35@ 16          @R_618_8787@@H_607_35@ 17                @H_607_35@ 18          }

 

 

在上面@L_262_7@中,我们创建了一个新的Notification窗口实例,然后使用Show(毫秒),使其显示在客户端,最终显示效果如下:

silverlight 判断窗口打开

 

 

今天的内容暂时到这里了,@L_450_13@,我们将综合使用这些Silverlight OOB应用开发技巧实现一个完整应用实例, Silverlight Out of Browser音乐播放器。

 

本篇源代码下载

大佬总结

以上是大佬教程为你收集整理的silverlight 判断窗口打开全部内容,希望文章能够帮你解决silverlight 判断窗口打开所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。