XAML Browser Application,最开始叫xapp,后来在Sept CTP中叫wba,是美國微軟公司所提出的新技術,以XAML作為使用者介面(UI)之描述,寄宿(hosted)在瀏覽器(IE web browser sandbox)中執行的程式。XBAP可以取代ActiveX、Java Applet、Flash等功能,有人稱之為下一代的ActiveX(next-generation ActiveX)。XAML Browser Application的副檔名是.xbap

環境設定

编辑

在執行XBAP之前,必須先設定:

  • .NET Framework 3.0 Runtime
  • Windows SDK for .NET Framework 3.0
  • Visual Studio 2005 extensions for .NET Framework 3.0(November 2006 CTP)

特點

编辑
  • XBAPS更易於與DHTML結合。
  • XBAPS一旦使用寬鬆XAML(loose XAML)或使用IFRAME,必執行於安全的沙盒(secure sandbox)。
  • XBAPS可以使用WPF(Windows Presentation Foundation)的98.2%的功能。
  • XBAPS必須執行於iFrame之下。
  • XBAPS必須執行於DocumentObject應用程式之下,利用querystring溝通。
  • XBAPS目前僅支援IE6或IE7。

安全性

编辑
  • XBAP程式無法使用檔案系統(file system)。
  • XBAP程式無法呼叫對話視窗(dialog)。
  • XBAP程式如同DHTML,是網路直接安装執行,可能遇到安全性问题,所以XBAP程序必須具備内嵌數位簽名。<ManifestKeyFile>指定签字用的证书文件名,<ManifestCertificateThumbprint>指定證明文件摘要。
  • XBAP中只允許通過HTTP和SOAP訪問Web Services

規劃

编辑

XAML与HTML一样是flow layout,Grid類似HTML中的Table,使整個頁面的顯示方式變成網格式区域。微軟還推荐使用StackPanel,DockPanel等继承自Panel的規劃方式,Panel在使用上的類似HTML的{{<}}DIV{{>}}{{<}}\DIV{{>}}。

導航

编辑

NavigationService

编辑

WPF提供了一個最重要的頁面導航物件NavigationService,可用來調整頁面之用。NavigationService物件提供有下列功能:

  • public void Navigate(Uri source)
  • public void Refresh()
  • public void StopLoading()
  • public void GoBack()
  • public void GoForward()
  • public void AddBackEntry()
  • public void RemoveBackEntry()
  • public static NavigationService GetNavigationService(DependencyObject dependencyObject);

structured navigation

编辑

structured navigation可用於處理頁面與頁面之間的資料共享。WPF支援PageFunction這樣的頁面標籤。

<PageFunction
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x=" (页面存档备份,存于互联网档案馆)"
   xmlns:sys="clr-namespace:System;assembly=mscorlib" 
   x:Class="StructuredNavigationSample.TestPageFunction"
   x:TypeArguments="sys:String"
   Title="Test for Page Function" WindowWidth="250" WindowHeight="150">
   ......
</PageFuntion>

範例

编辑

3D動畫置入iframe:

<iframe height="130"
 width="130"
 src="3d_animation.xaml" />

將XBAP置入iframe:

<html>
<head>
<body>
<iframe name="Iframe1" src="%fullpathtoyourgadgetdirectory%\TestBrowserApp.xbap" ></iframe>
</body>
</html>

差異

编辑

WinFX Windows Application和WinFX Web Browser Application有些微的差別,在.xaml檔案中,Browser Application中,預設起始页的根元素(root element)为Page;Windows Application中,預設起始页的根元素为Window。另外,Window class无法在Browser Application中使用,因為IE浏览器中的WPF程序是在部分信任的沙箱(sandbox)内執行。

<Page x:Class="XAMLBrowserApplication1.Page1"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x=" (页面存档备份,存于互联网档案馆)"
   WindowTitle="Hello world" WindowWidth="560" WindowHeight="400"
   Title="Page1"
   >
 <Grid>
 </Grid>
</Page>

參見

编辑

外部連結

编辑

📚 Artikel Terkait di Wikipedia

局部变量

束为之。它们的区别:静态局部变量只可被一个函数访问(function scope), 静态全局变量 可被所有函数访问(global scope)。 #include <iostream> using namespace std; void test() { // var是一个静态局部变量 static

柯尔莫哥洛夫-斯米尔诺夫检验

978-0-470-45461-9 Stephens, M.A. (1979) Test of fit for the logistic distribution based on the empirical distribution function, Biometrika, 66(3), 591-5. Kolmogorov

F♯

single-argument functions there is syntactic sugar (pattern matching function): let rec factorial = function | 0 -> 1 | n -> n * factorial (n - 1) /// Using fold and

Nm (Unix)

global_function 0000000000000033 T global_function2 0000000000000045 T non_mangled_function 0000000000000050 T main 在使用了C++编译器时,输出是不同的: $nm -n test.o 0000000000000000

Objdump

global_function 0000000000004018 g DO .bss 0000000000000004 global_var 这里指定了实际地址对应的动态符号。这里的global_var的地址是0x0000000000004018。 接着执行如下命令: $ objdump -t test.so

JQuery

$(function() { $('img').on('click', function() { // 处理页面中任何img元素上的click事件。 }); }); jQuery命令通常返回一个jQuery对象,因此命令可以链接: $('div.test').add('p.quote')

JavaScriptMVC

: function(){ this.find("ol").append("New Todo"); } }); 在控制器中也可以處理 OpenAjax 事件,例如: $.Controller('TodosController',{ "main.test subscribe": function(ev

可變參數函數

test("a");// 结果:["a"] test("a", 1);// 结果:["a", 1] test("a", 1, function(){});// 结果:["a", 1, function (){}] 可变参数模板 可变参数宏 Variadic function (页面存档备份,存于互联网档案馆)