<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ![](https://box.kancloud.cn/2016-03-18_56eb67c435fed.png) 熟悉Silverlight的朋友應該知道,Silverlight從1.0版本到現在的4.0版本,其功能性越來越強大,從下圖我們可以看出,Silverlight的應用模型的一個轉變過程,從Javascript到現在Trusted應用,我們目睹了Silverlight坎坷的演變過程,盡管現在仍舊存在不足之處,但是有了更多開發人員的支持和幫助,Silverlight一定會更好更強大。 ![](https://box.kancloud.cn/2016-03-18_56eb67c7c94bc.jpg) 在前幾篇中,我們通過簡單的實例詳細介紹了Silverlight Out of Browser應用開發基礎。為了下一篇的實例做準備,本篇,我們將補充介紹一些Silverlight Out of Browser應用開發知識點,? 1. 回顧Silverlight Out of Browser存取本地目錄API; 2. 學習Silverlight Out of Browser應用Debug調試; 3. 學習Silverlight Out of Browser的消息通知窗口API; **回顧Silverlight Out of Browser存取本地目錄API**,還記得在前面的文章我們已經介紹,Silverlight提供有現成的API,允許應用在OOB模式下訪問My...系列目錄,API調用方法很簡單,而OOB模式下文件訪問,應用可以支持System.IO引用空間中的操作類,例如File類,Directory類,Environment類,等等。 ![](https://box.kancloud.cn/2016-03-18_56eb67c7dc65a.jpg) ~~~ ??private?void?AddMusicToList() ??????????{ ???????????????var?path?=?Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); ???????????????lsMyMusics.Items.Clear(); ???????????????DirectoryInfo?myDirectory?=?new?DirectoryInfo(path); ???????????????foreach?(FileInfo?file?in?myDirectory.EnumerateFiles()) ???????????????{ ???????????????????lsMyMusics.Items.Add(file); ???????????????} ??????????} ~~~ 在下文中,我們將用到Silverlight默認API,讀取My Music目錄的音樂文件作為默認播放目錄。其代碼與上相似。 **Silverlight Out of Browser應用的調試方法(Debug)** 在使用Silverlight開發應用時,Debug是最常用的Visual Studio工具之一。大家可能對Silverlight基于Web瀏覽器的調試方法并不陌生,終歸ASP.NET應用開發調試已經為Silverlight打下了良好的基礎。而對于Silverlight的OOB是否通常支持Debug呢?答案是肯定的。 在創建項目時,默認的設置,是支持基于瀏覽器的應用的Debug。如果需要OOB應用支持脫離瀏覽器進行Debug,需要按照以下幾個步驟設置: 1. 首先需要設置Silverlight客戶端應用為“開始項目”, ![](https://box.kancloud.cn/2016-03-18_56eb67c7ea566.jpg) 2. 然后選擇客戶端應用“Properties”屬性欄,設置“Start Action”中的“Installed out-of-browser application”, ![](https://box.kancloud.cn/2016-03-18_56eb67c80deda.jpg) 3. 點擊保存后,重新F5調試應用,即可發現,應用將直接作為OOB模式啟動,不再進入Web瀏覽器中提示用戶安裝,這時就可以在代碼中設置斷點進行Debug了。 ![](https://box.kancloud.cn/2016-03-18_56eb67c822e93.jpg) 學習Silverlight Out of Browser的消息通知窗口API(Toast Notifications Windows) Toast Notifications Windows,又稱為Silverlight消息通知窗口,是Silverlight 4的一個新特性,該窗口目前僅限于Out of Browser應用使用。該消息窗口主要是提供臨時消息提示,在應用中可以起到讓用戶注意警示的作用。現在很多Windows應用都喜歡使用該窗口模式顯示廣告,更新提示等功能。 Silverlight的Notifications Windows目前有以下限制: 1. 窗口最大尺寸限制,最大僅支持寬400,高100的提示窗口; 2. 目前不支持Transparency窗口特效,WPF可以支持; 3. 為了區別其他窗口應用,Notifications Windows無窗口邊框; 在明白以上限制后,使用Silverlight API很輕松就能創建一個Toast Notifications窗口。其方法如下: 首先,在SilverlightOOBDemo中創建一個NotificationControl控件, ![](https://box.kancloud.cn/2016-03-18_56eb67c839290.jpg) 編輯NotificationControl控件,我們簡單的對該控件進行美化,使其看起來更加友好, ~~~ ??<UserControl?x:Class="SilverlightOOBDemo.NotificationControl" ??????xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ??????xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ??????xmlns:d="http://schemas.microsoft.com/expression/blend/2008" ??????xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ??????mc:Ignorable="d" ??????d:DesignHeight="300"?d:DesignWidth="400"> ?????? ??????<Grid?x:Name="LayoutRoot"?Background="White"> ?????????<Border?x:Name="Frame"?Width="300"?Height="100"?Background="LightYellow"> ?????????????<StackPanel?Orientation="Vertical"> ?????????????????<Border?Width="290"?Height="24"?CornerRadius="4"?Margin="2,4,2,4"> ?????????????????????<Border.Background> ?????????????????????????<LinearGradientBrush?StartPoint="0.5,0.0" ?????????????????????????EndPoint="0.5,1.0"> ?????????????????????????????<GradientStop?Offset="0.2"?Color="#FF1C68A0"?/> ?????????????????????????????<GradientStop?Offset="1.0"?Color="#FF54A7E2"?/> ?????????????????????????</LinearGradientBrush> ?????????????????????</Border.Background> ?????????????????????<Border.Effect> ?????????????????????????<DropShadowEffect?BlurRadius="4"?ShadowDepth="4" ?????????????????????????Opacity="0.4"?/> ?????????????????????</Border.Effect> ?????????????????????<TextBlock?Text="友情提示"?FontSize="12" ?????????????????????FontWeight="Bold"?Foreground="White"?Margin="4"?/> ?????????????????</Border> ?????????????????<StackPanel?Orientation="Horizontal"> ?????????????????????<Image?Source="/SilverlightOOBDemo;component/Images/Update.png"?Width="48"?Height="48" ?????????????????????Stretch="Fill"?Margin="4"?VerticalAlignment="Top"?/> ?????????????????????<TextBlock?Width="240"?Text="檢測到新的音樂文件,已經更新到播放列表。小廣告:我的博客http://jv9.cnblogs.com" ?????????????????????FontSize="11"?Foreground="#FF202020"?TextWrapping="Wrap" ?????????????????????Margin="4"?/> ?????????????????</StackPanel> ?????????????</StackPanel> ?????????</Border> ?????</Grid> </UserControl> ~~~ 然后回到OutofBrowserMainPage頁面,這里,我們在“關于”按鈕上,添加Click事件響應,使其被點擊后,彈出Notifications窗口。 ![](https://box.kancloud.cn/2016-03-18_56eb67c84aaf0.jpg) 首先創建notifyWindow實例, ~~~ ??#region?Private?Members ??????????Window?OOBWindow?=?Application.Current.MainWindow; ??????????NotificationWindow?notifyWindow?=?null; ??????????#endregion ?? ??????????#region?Constructor ??????????public?OutofBrowserMainPage() ??????????{ ??????????????InitializeComponent(); ?????????????notifyWindow?=?new?NotificationWindow(); ???????????? ??????????? ?????????} #endregion ~~~ 然后在Click事件中進行窗口激活: ~~~ ??????????private?void?aboutBtn_Click(object?sender,?RoutedEventArgs?e) ??????????{ ??????????????if?(null?==?notifyWindow) ??????????????????MessageBox.Show("通告窗口僅能運行在OOB模式下,請安裝Silverlight應用到本地。"); ?????????????if?(true?==?App.Current.IsRunningOutOfBrowser) ??????????????{ ??????????????????if?(notifyWindow.Visibility?==?Visibility.Visible) ??????????????????????notifyWindow.Close(); ?????????????????NotificationControl?myNotify?=?new?NotificationControl(); ?????????????????notifyWindow.Width?=?300; ?????????????????notifyWindow.Height?=?100; ?????????????????notifyWindow.Content?=?myNotify; ?????????????????notifyWindow.Show(10000); ?????????????} ?????????} ~~~ 在上面代碼中,我們創建了一個新的Notification窗口實例,然后使用Show(毫秒),使其顯示在客戶端,最終顯示效果如下: ![](https://box.kancloud.cn/2016-03-18_56eb67c8579c3.jpg) 今天的內容暫時到這里了,下一篇,我們將綜合使用這些Silverlight OOB應用開發技巧實現一個完整應用實例, Silverlight Out of Browser音樂播放器。 [本篇源代碼下載](http://www.silverlightchina.net/resource/code/SilverlightOOBDemo0726.zip) 歡迎大家加入"專注Silverlight" 技術討論群: 32679955(六群) 23413513(五群) 32679922(四群) 100844510(三群) 37891947(二群) 22308706(一群)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看