Silverlight的OOB特性

Out Of Brower 传输层协议使用带外数据(out-of-band,OOB)来发送一些重要的数据,如果通信一方有重要的数据需要通知对方时,协议能够将这些数据快速地发送到对方.为了发送这些数据,协议一般不使用与普通数据相同的通道,而是使用另外的通道.linux系统的套接字机制支持低层协议发送和接受带外数据.但是TCP协议没有真正意义上的带外数据.为了发送重要协议,TCP提供了一种称为紧急模式(urgent mode)的机制.TCP协议在数据段中设置URG位,表示进入紧急模式.接收方可以对紧急模式采取特殊的处理.很容易看出来,这种方式数据不容易被阻塞,可以通过在我们的服务器端程序里面捕捉SIGURG信号来及时接受数据或者使用带OOB标志的recv函数来接受.   Intel主动管理技术 (Intel AMT) 就是使用的OOB.   

Out Of Brower   

是微软SilverLight一项新技术的一个特性 SliverLight 可以独立浏览器而访问系统特定文件 目录 和一般的桌面程序一样 可以最大化 最小化 拖动 消息弹出窗口 安装 快捷方式 等.

下面列举一个Silverlight OOB的Demo,该Demo包括安装、检测更新、系统托盘、调用Com组件打开Word等

View Code
1 using System;
2  using System.Collections.Generic;
3 using System.Linq;
4 using System.Net;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Documents;
8 using System.Windows.Input;
9 using System.Windows.Media;
10 using System.Windows.Media.Animation;
11 using System.Windows.Shapes;
12 using System.Runtime.InteropServices.Automation;
13
14 namespace SilverlightApplicationDemo
15 {
16 public partial class MainPage : UserControl
17 {
18 public MainPage()
19 {
20 InitializeComponent();
21 App.Current.CheckAndDownloadUpdateAsync();
22 Loaded += new RoutedEventHandler(MainPage_Loaded);
23 App.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);
24 webb.Source = new Uri("http://www.bing.com");
25 //webb.NavigateToString("<b>Hello World</b>");
26 webb.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webb_LoadCompleted);
27 }
28
29 void webb_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
30 {
31 //系统托盘
32 NotificationWindow notify = new NotificationWindow();
33 notify.Width = 400;
34 notify.Height = 100;
35 TextBlock tb = new TextBlock();
36 tb.Text = "load complete";
37 tb.FontSize = 24;
38 notify.Content = tb;
39 notify.Show(3000);
40 }
41
42 void Current_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
43 {
44 //检测更新
45 if (e.UpdateAvailable)
46 {
47 MessageBox.Show("An Update has been installed To see the updates please ecit and restart tne application!");
48 }
49 }
50
51 void MainPage_Loaded(object sender, RoutedEventArgs e)
52 {
53 if (App.Current.InstallState == InstallState.Installed)
54 {
55 InstallContainer.Visibility = Visibility.Collapsed;
56 }
57 }
58
59 private void installbtn_Click(object sender, System.Windows.RoutedEventArgs e)
60 {
61 // 安装
62 App.Current.Install();
63 }
64
65 private void LaunchBtn_Click(object sender, System.Windows.RoutedEventArgs e)
66 {
67 // 调用Com组件打开Word
68 dynamic word = AutomationFactory.CreateObject("Word.Application");
69 word.Visible = true;
70 dynamic doc = word.Documents.Add();
71 string insertText = TextRegion.Text;
72 dynamic range = doc.Range(0,0);
73 range.Text = insertText;
74 }
75 }
76 }
源代码下载地址:https://files.cnblogs.com/yujian/SilverlightApplicationDemo.rar
原文地址:https://www.cnblogs.com/yujian/p/2084792.html