Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 945AE18F1D for ; Wed, 6 Apr 2016 09:27:18 +0000 (UTC) Received: (qmail 74969 invoked by uid 500); 6 Apr 2016 09:27:18 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 74892 invoked by uid 500); 6 Apr 2016 09:27:18 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 73832 invoked by uid 99); 6 Apr 2016 09:27:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Apr 2016 09:27:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 45120E983A; Wed, 6 Apr 2016 09:27:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: dblotsky@apache.org To: commits@cordova.apache.org Date: Wed, 06 Apr 2016 09:27:26 -0000 Message-Id: <4c1b79a404ee44e58e9d367007c035a3@git.apache.org> In-Reply-To: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> References: <0ea60741dd3e40f489f34a02f10641c5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/51] [partial] docs commit: Adding both Chinese versions. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/tizen/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/tizen/index.md b/www/docs/zh-cn/6.x/guide/platforms/tizen/index.md new file mode 100644 index 0000000..f8ba672 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/tizen/index.md @@ -0,0 +1,118 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Tizen 平臺指南 +--- + +# Tizen 平臺指南 + +本指南介紹了如何設置您的 SDK 開發環境部署科爾多瓦運行 Tizen 作業系統的設備的應用程式。 + +## 要求和支援 + +Tizen SDK 需要 Linux Ubuntu 10.04/10.10/11.04/11.10 (32 位) 或 Windows XP SP3/7 (32 位)。 + +開發人員應使用 `cordova` 實用程式 Tizen SDK 的結合。 命令列介面資訊,請參閱如何安裝它,添加專案,然後生成和部署專案。 + +## 安裝 SDK + +從[tizen.org][1]下載 Tizen SDK. + + [1]: https://developer.tizen.org/sdk + + + +## 在 SDK 中打開的專案 + +1. 推出 Tizen Eclipse IDE。 + +2. 選擇**檔 → 導入 → Tizen Web 專案**: + + ![][2] + +3. 按**下一步**. + +4. 請確保選中了**選擇根目錄**。 + +5. 請確保選中了**複製到工作區中的專案**。 + +6. 按**流覽**並選擇科爾多瓦 Tizen `samples` 專案目錄 (如 `/cordova-basic` ): + + ![][3] + +7. 按**完成**。您的專案現在應該將其導入並出現在**專案資源管理器**視圖中: + + ![][4] + + [2]: {{ site.baseurl }}/static/img/guide/platforms/tizen/import_project.png + [3]: {{ site.baseurl }}/static/img/guide/platforms/tizen/import_widget.png + [4]: {{ site.baseurl }}/static/img/guide/platforms/tizen/project_explorer.png + +重新生成專案,在**專案資源管理器**視圖中按右鍵並選擇**生成專案**: + +![][5] + + [5]: {{ site.baseurl }}/static/img/guide/platforms/tizen/build_project.png + +如*hello.wgt*的小部件包檔應在專案的根目錄中生成。 + +## 部署到模擬程式 + +用滑鼠右鍵按一下**專案資源管理器**視圖中的專案並選擇**運行作為 → Tizen Web 模擬器應用程式**: + +![][6] + + [6]: {{ site.baseurl }}/static/img/guide/platforms/tizen/runas_web_sim_app.png + +## 將部署到設備 + +* 請確保目標設備正常啟動、 連接和配置。必須正確設置其**日期和時間**設置。 + +* 使用**連接資源管理器**視圖選擇的應用程式部署目標:**視窗顯示視圖 → 連接資源管理器**. + + ![][7] + +* 用滑鼠右鍵按一下該專案在**專案資源管理器**視圖,然後選擇**運行作為 → Tizen Web 應用程式**: + + ![][8] + + [7]: {{ site.baseurl }}/static/img/guide/platforms/tizen/connection_explorer.png + [8]: {{ site.baseurl }}/static/img/guide/platforms/tizen/runas_web_app.png http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/ubuntu/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/ubuntu/index.md b/www/docs/zh-cn/6.x/guide/platforms/ubuntu/index.md new file mode 100644 index 0000000..75e7ab5 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/ubuntu/index.md @@ -0,0 +1,97 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Ubuntu 平臺指南 +--- + +# Ubuntu 平臺指南 + +## 初始版本 + +歡迎來到科爾多瓦 Ubuntu 平臺支援的初始版本。 此版本中,重點是在 Ubuntu 的系統上開發和使用概述中討論的跨平臺工作流。 這包括將 Ubuntu 平臺添加到您的專案,添加標準科爾多瓦外掛程式,以及建設和運行的 Ubuntu 平臺的應用程式。 + +### Ubuntu SDK + +您還可能想要安裝 Ubuntu QtCreator 開發環境。 請參閱[developer.ubuntu.com][1]為更多的資訊。 (QtCreator SDK 不是需要將 Ubuntu 平臺支援添加到應用程式科爾多瓦。) + + [1]: http://developer.ubuntu.com + +### Ubuntu 運行時平臺 + +Ubuntu 是眾所周知的其桌面環境 (用於筆記本電腦、 Pc 和此類)。 Ubuntu 觸摸延伸到手機和平板電腦上的 Ubuntu 作業系統。 Ubuntu 運行時平臺有不同的 CPU 體系結構 (x 86,armhf,等.)。 必須適當地編譯外掛程式和應用程式代碼。 對此廣泛領域的支援正在迅速演變在 Ubuntu 中。 + +### 最新資訊 + +科爾多瓦 app 支援 Ubuntu 運行時平臺的最新資訊,請參閱[wiki.ubuntu.com/Cordova][2]. + + [2]: http://wiki.ubuntu.com/Cordova + +## 發展平臺要求 + +此初始發行版本的開發平臺應該是 Ubuntu 桌面。Ubuntu 13.10 (代號 '曖昧') 或更高版本需要享受完整的支援的功能集。 + +你可以安裝科爾多瓦非 Ubuntu 使用在系統上 (故宮),但重要的能力,在這個時候只提供通過 Ubuntu debian 套裝軟體。 + +## 科爾多瓦安裝 + +添加到您的 Ubuntu 系統 Ubuntu 科爾多瓦[個人包存檔][3]: + + [3]: https://launchpad.net/~cordova-ubuntu/+archive/ppa + + $ sudo add-apt-repository ppa:cordova-ubuntu/ppa + $ sudo apt-get update + + +安裝科爾多瓦 cli 包 (和它的依賴項): + + $ sudo apt-get install cordova-cli + + +## 專案工作流 + +### 創建一個專案 + +創建一個應用程式在 `hello` 目錄的顯示名稱是 `HelloWorld` : + + $ cordova create hello com.example.hello HelloWorld + + +### 移動到專案目錄 + + $ cd hello + + +### 添加 Ubuntu 平臺 + + $ cordova platform add ubuntu + + +### Ubuntu 的生成 + + $ cordova build ubuntu + + +### 運行應用程式 + + $ cordova run ubuntu + + +### 添加觀景窗外掛程式 + + $ cordova plugin add cordova-plugin-camera \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/index.md b/www/docs/zh-cn/6.x/guide/platforms/win8/index.md new file mode 100644 index 0000000..709057f --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/index.md @@ -0,0 +1,234 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows 平臺指南 +--- + +# Windows 平臺指南 + +本指南介紹如何設置您的 SDK 開發環境來構建和部署應用程式科爾多瓦為 Windows 8、 Windows 8.1、 Windows Phone 8.1 和 Windows 10 通用應用程式平臺。 它演示如何使用 shell 工具來生成和生成應用程式,或跨平臺科爾多瓦 CLI 討論了在命令列介面。 (見比較這些發展選項的概述)。本節還演示了如何修改科爾多瓦在 Visual Studio 中的應用程式。 無論你採取哪種方法,您需要安裝 Visual Studio SDK,如下所述。 + +有關如何升級現有的 Windows 8 科爾多瓦專案的資訊,請參閱升級 Windows 8。 + +視窗電話 8 (wp8) 住宿作為一個獨立的平臺,有關詳細資訊,請參閱 Windows Phone 8 平臺指南。 + +在 Windows 上運行的科爾多瓦 WebViews 依賴互聯網資源管理器中 10 (Windows 8.0) 和互聯網資源管理器中 11 (Windows 8.1 和 Windows Phone 8.1) 作為他們的渲染引擎,因此作為一個實際問題你可以使用 IE 的功能強大的調試器來測試並不調用科爾多瓦 Api 的任何 web 內容。 Windows Phone 開發者博客上可比的 WebKit 瀏覽器支援 IE 如何提供[有益的指導][1]。 + + [1]: http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10.aspx + +## 要求和支援 + +若要開發 Windows 平臺的應用程式需要: + +* 最低 4 gb 的 RAM 的 Windows 8.1,32 或 64 位機器 (*家裡*、*臨*,或*企業*版)。 + +* Windows 8.0、 8.1 或 10、 32 或 64 位*回家*,*臨*,或*企業*版,以及[Visual Studio 2012 速成版][2]或視覺工作室 2013 年。 視覺工作室 2015年是不能夠構建 Windows 8.0 的應用程式。 + + [2]: http://www.visualstudio.com/downloads + +為 Windows 8.0 和 8.1 (包括 Windows Phone 8.1) 開發的應用程式: + +* Windows 8.1 或 Windows 10、 32 或 64 位*回家*,*臨*,或*企業*版,以及[Visual Studio 2013 速成版][2]或更高。 Windows 8.1 企業評估版是可從[Microsoft 開發人員網路][3]. + +* 為 Windows Phone 模擬器,Windows 8.1 (64) 專業版或更高,和一個處理器,支援[用戶端 HYPER-V 和第二級別位址翻譯 (板)][4]。 Windows 8.1 企業評估版是可從[Microsoft 開發人員網路][3]. + +* [Windows 視覺工作室 2013 年][5](明示或更高)。 + + [3]: http://msdn.microsoft.com/en-US/evalcenter/jj554510 + [4]: https://msdn.microsoft.com/en-us/library/windows/apps/ff626524(v=vs.105).aspx#hyperv + [5]: http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-8 + +為 Windows 10 開發的應用程式: + +* Windows 8.1 或 Windows 10 技術預覽 2,32 位或 64 位,以及[視覺工作室 2015 RC][6]或更高。 + + [6]: http://www.visualstudio.com/preview + +應用程式相容性是由應用程式針對作業系統決定的。 應用程式是主動相容但不是厚此薄彼-相容,所以針對 Windows 8.1 應用程式不能運行在 8.0,但為 8.0 建造一個應用程式可以運行在 8.1。 + +按照說明在[windowsstore.com][7]提交到 Windows 應用商店應用程式。 + + [7]: http://www.windowsstore.com/ + +為 Windows 開發科爾多瓦的應用程式,您可以使用 pc 機運行 Windows,但你也可能發展在 Mac 上運行的虛擬機器環境或到雙啟動 Windows 8.1 分區使用新兵訓練營。 請查閱這些資源來設置在 Mac 上所需的 Windows 開發環境: + +* [VMWare Fusion][8] + +* [Parallels Desktop][9] + +* [Boot Camp][10] + + [8]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945426 + [9]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945424 + [10]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945423 + +## 使用科爾多瓦外殼工具 + +如果你想要將與 SDK 一起使用科爾多瓦的 Windows 居中外殼工具,你有兩個基本選擇: + +* 他們從本地訪問生成的 CLI 的專案代碼。他們是在`平臺/windows/`目錄後添加`windows`平臺如下所述。 + +* 從單獨的分發在[cordova.apache.org][11]下載它們。 科爾多瓦分佈包含單獨的檔案,為每個平臺。 一定要擴大相應的存檔,`科爾多瓦 windows`在這種情況下,在一個空的目錄內。 有關批次處理實用程式可用`包/bin`目錄中。 (參閱**自述**檔,如果需要更詳細的說明)。 + + [11]: https://www.apache.org/dist/cordova/platforms/ + +這些外殼工具允許您創建、 構建和運行 Windows 應用程式。 附加的命令列介面,可以跨所有平臺的外掛程式功能的資訊,請參閱使用 Plugman 管理外掛程式。 + +## 安裝 SDK + +安裝任何版本的[Visual Studio][2]匹配要求上面列出的版本。 + +![][12] + + [12]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_installSDK.png + +為 Windows 10,Visual Studio 安裝程式沒有安裝工具來構建通用的 Windows 應用程式的選項。 你必須確保,此選項是在安裝時選擇安裝所需的 SDK。 + +## 創建一個新專案 + +在這一點上,要創建一個新的專案你可以選擇之間跨平臺 CLI 工具的命令列介面或一組特定的 Windows 外殼工具所述。 下面的 CLI 方法生成新的`你好`專案目錄中命名*HelloWorld*應用程式: + + > cordova create hello com.example.hello HelloWorld + > cd hello + > cordova platform add windows + + +下面是相應的較低級別殼工具方法: + + C:\path\to\cordova-windows\package\bin\create.bat C:\path\to\new\hello com.example.hello HelloWorld + + +本專案的目標 Windows 8.1 作為預設的目標作業系統。 你可以選擇目標 8.0 或 10.0 (見下文的"配置目標 Windows 版本") 為所有的生成,或你在每次生成目標特定于特定的版本。 + +## 生成專案 + +如果您使用 CLI 在發展中,專案目錄的頂級 `www` 目錄中包含的原始程式碼檔。運行任一專案目錄重新生成該應用程式中: + + > cordova build + > cordova build windows # do not rebuild other platforms + > cordova build windows --debug # generates debugging information + > cordova build windows --release # signs the apps for release + + +下面是相應的較低級別殼工具方法: + + C:\path\to\project\cordova\build.bat --debug + C:\path\to\project\cordova\build.bat --release + + +`clean`命令可以説明搜捕中準備的下一個目錄 `build` : + + C:\path\to\project\cordova\clean.bat + + +## 配置目標 Windows 版本 + +由預設的`生成`命令將生成兩個包: Windows 8.0 和 Windows Phone 8.1。 升級到版本 8.1 以下配置設置必須添加到設定檔 (`config.xml`的 Windows 套裝程式). + + + + +一旦你添加此設置`生成`命令將開始生產 Windows 8.1 和 Windows Phone 8.1 包。 + +### --appx 參數 + +您可能會決定你想要建立的針對特定作業系統的應用程式的特定版本 (例如,您可能有設置您想要針對 Windows 10,但您想要構建 Windows Phone 8.1)。 要做到這一點,你可以使用`--appx`參數: + + > cordova build windows -- --appx=8.1-phone + + +生成系統將忽略 config.xml 目標 Windows 版本中設置的偏好,並嚴格為 Windows Phone 8.1 生成套裝軟體。 + +`--appx`國旗有效值為`8.1-win`、 `8.1-phone`和`uap`(對於 Windows 10 通用應用程式)。 這些選項也適用于`cordova run`命令。 + +### 目標 Windows 版本的注意事項 + +Windows 10 科爾多瓦的應用程式 (和一般的 HTML 應用程式) 支援一種新的"遠端"模式。 這種模式使應用程式更多的自由與尊重使用 DOM 操作和常見的 web 模式,例如使用內聯腳本,但如此通過減少的功能集時提交給公共 Windows 應用商店,可使用您的應用程式。 有關 Windows 10 和遠端模式的詳細資訊,請查看[科爾多瓦為 Windows 10][13]文檔。 + + [13]: win10-support.md.html + +使用遠端模式時,開發人員被鼓勵申請內容安全政策 (CSP) 到他們的應用程式,以防止腳本注入攻擊。 + +## 部署應用程式 + +要部署 Windows 套裝程式: + + > cordova run windows -- --win # explicitly specify Windows as deployment target + > cordova run windows # `run` uses Windows package by default + + +要將 Windows Phone 包部署: + + > cordova run windows -- --phone # deploy app to Windows Phone 8.1 emulator + > cordova run windows --device -- --phone # deploy app to connected device + + +可以使用**cordova run windows --list**來查看所有可用的目標和**cordova run windows --target=target_name \-- -|-phone**,在特定的設備或模擬器上運行的應用程式 (例如,`cordova run windows --target="Emulator 8.1 720P 4.7 inch" -- --phone`). + +您還可以使用**科爾多瓦運行 — — 説明**查看附加的生成和運行選項。 + +## 在 SDK 中打開的專案和部署應用程式 + +一旦你建立科爾多瓦應用程式,如上文所述,可以在 Visual Studio 打開它。 各種`生成`命令生成一個 Visual Studio 解決方案 (*.sln*) 檔。 檔資源管理器來修改在 Visual Studio 專案中打開的檔: + +![][14] + + [14]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_openSLN.png + +`CordovaApp`元件顯示解決方案中, 和其`www`目錄包含基於 web 的原始程式碼,包括`index.html`主頁: + +![][15] + + [15]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk.png + +Visual Studio 主功能表下面的控制項允許您測試或部署應用程式: + +![][16] + + [16]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_deploy.png + +選擇**本地電腦**,請按綠色箭頭運行 Visual Studio 在同一機器上安裝的應用程式。一旦你這樣做,應用程式將出現在 Windows 8 應用程式清單: + +![][17] + + [17]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_runApp.png + +每次您重新生成應用程式,在介面中可用的版本被刷新。 + +一旦可用應用程式清單中,按住**CTRL**鍵,同時選擇該應用程式允許您用別針把它到主畫面: + +![][18] + + [18]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_runHome.png + +請注意,是否你打開的應用程式在虛擬機器環境中,您可能需要按一下在角落裡或兩側的窗戶,切換應用程式或訪問附加功能: + +![][19] + + [19]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_run.png + +或者,選擇**模擬器**部署選項以查看該應用程式,就好像它在平板設備上運行: + +![][20] + + [20]: {{ site.baseurl }}/static/img/guide/platforms/win8/win8_sdk_sim.png + +與不同的桌面部署,此選項允許您類比平板電腦的定位,位置,和改變其網路設置。 + +**注**: 有關如何在您的工作流中使用科爾多瓦的命令列工具或 SDK 建議查閱概述。 科爾多瓦 CLI 依賴于跨平臺原始程式碼通常覆蓋 SDK 所使用的特定于平臺的檔。 如果你想要使用 SDK 來修改專案,使用較低級別外殼工具作為 CLI 的替代方法。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/packaging.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/packaging.md b/www/docs/zh-cn/6.x/guide/platforms/win8/packaging.md new file mode 100644 index 0000000..7f0c913 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/packaging.md @@ -0,0 +1,117 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows 包裝 +--- + +# Windows 包裝 + +你可以瞭解更多關於簽署和包裝在[MSDN](https://msdn.microsoft.com/en-us/library/hh446593(v=vs.85).aspx)上的應用 Windows 商店應用程式. + +為了能夠正確打包和簽名 Windows 應用程式有是所需的幾件事: + + * 簽章憑證 + * 身份細節匹配提供的簽章憑證 + +在 Windows 專案標識的詳細資訊保存在名為 package.appxmanifest 的檔。此檔是自動填滿每次科爾多瓦應用程式的構建。身份保留 3 重要欄位。 + + * Name + * Publisher + * Version + +可以從**config.xml**設置*NAme*和*Version*。*Publisher*可以作為生成的參數提供,或可以在**build.json**檔上設置。 + +![]({{ site.baseurl }}/static/img/guide/platforms/win8/packaging.png) + +從任一 CLI 或通過 build.json 檔,可以提供簽名的證書。證書相關 CLI 的標誌是: + + * `--packageCertificateKeyFile` : 一旦創建了簽章憑證包,可以使用此參數,將該證書與應用程式相關聯。此標誌將檔路徑作為參數。 如。 `> cordova build -- --packageCertificateKeyFile="platforms\windows\CordovaApp_TemporaryKey.pfx"` + * `--packageThumbprint` : 包指紋用於驗證封裝證書金鑰檔的真實性。 創建證書金鑰檔時,將向最終使用者提供此值。 如。 `> cordova build -- --packageCertificateKeyFile="platforms\windows\CordovaApp_TemporaryKey.pfx" --packageThumbprint="ABCABCABCABC123123123123"` + +或者,這些值可以使用指定組建組態檔 (build.json) 使用 CLI (-buildConfig)。一個示例組建組態檔: + + { + "windows": { + "debug": { + "packageCertificateKeyFile": "platforms\\windows\\CordovaApp_TemporaryKey.pfx" + }, + "release": { + "packageCertificateKeyFile": "c:\\path-to-key\\keycert.pfx", + "packageThumbprint": "ABCABCABCABC123123123123", + "publisherId": "CN=FakeCorp.com, L=Redmond, S=Washington, C=US" + } + } + } + + +此外,它還支援以混合和匹配的命令列參數和 build.json 檔中的參數。從命令列參數的值將會得到優先。 + +# 如何創建證書金鑰和標誌科爾多瓦 windows 應用程式 + +需要分發和安裝 Windows 應用商店應用程式簽名的。 當你部署套裝程式版本,這一過程將由 Visual Studio 通常進行處理。 我們要做 tmhis 沒有 Visual Studio 創建我們自己的證書。 + +用於創建證書,我們需要使用[makecert.exe](https://msdn.microsoft.com/en-us/library/ff548309(v=vs.85).aspx)公用程式 此工具附帶 Windows SDK,可以發現下`%ProgramFiles(x86) %\Windows Kits\8.1\bin\x64`或`%ProgramFiles(x86) %\Windows Kits\8.1\bin\x86`. + +我們需要做的第一件事是創建為簽署我們的應用程式的根鍵。 + +`makecert.exe -n "CN=FakeCorp.com" -r -eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" -e "01/01/2020" -h 0 -sv FakeCorp.com.pvk FakeCorp.com.cer` + +要理解什麼金鑰做,這裡是參數做了簡要說明: + + * -n"CN=FakeCorp.com": 這是[X.509](http://en.wikipedia.org/wiki/X.509)證書主題名稱。在這個例子中它是**C**處理逐漸顯露出來**N**ame=FakeCorp.com。 + * -r: 創建[自簽章憑證](http://en.wikipedia.org/wiki/Self-signed_certificate). + * -eku #EKU_VAL #: 逗號分隔的增強型金鑰用法 Oid。 + * 1.3.6.1.5.5.7.3.3 表示該證書是有效的代碼簽名。始終指定此值以限制證書的用途。 + * 1.3.6.1.4.1.311.10.3.13 指示證書尊重一生簽署。 通常情況下,如果簽名是時間戳記,只要證書是在點有效時間戳記的時候,該簽名仍然有效即使在證書過期。 這 EKU 部隊要過期而不管簽名是否加蓋時間戳記的簽名。 + * -e"2020/1/1": 設置證書的過期日期。 + * -h 0: 將此證書下面的樹的最大高度設置為 0,以防止證書被用於作為憑證授權單位 (CA) 可以頒發其他證書。 + * -sv FakeCorp.com.pvk: 輸出 PVK 檔。Windows 使用 PVK 檔來存儲用於代碼簽名的私密金鑰。 + * FakeCorp.com.cer: 輸出證書檔。CER 檔用於存儲 X.509 憑證。 + +在第一次運行金鑰之後, 在螢幕上就會彈出輸入私人密碼: + +![]({{ site.baseurl }}/static/img/guide/platforms/win8/createprivatekeywindow.png) + +一旦創建了 pvk 和 cer 檔,我們需要從這些證書創建一個 pfx 檔。 Pfx (個人交換格式) 檔包含各種加密資訊,如證書、 根憑證授權單位,憑證連結和私密金鑰。 進行包裝證書,我們將使用一種工具叫[pvk2pfx](https://msdn.microsoft.com/en-us/library/ff550672(v=vs.85).aspx)。 此工具附帶 Windows SDK,可以發現下 `%ProgramFiles(x86)%\Windows Kits\8.1\bin\x64` 或`%ProgramFiles(x86)%\Windows Kits\8.1\bin\x86`. + +`pvk2pfx -pvk FakeCorp.com.pvk -pi pvkPassword -spc FakeCorp.com.cer -pfx FakeCorp.com.pfx -po pfxPassword` + +地點: + + * pvk: 輸入 pvk 檔案名稱 + * pi: pvk 密碼 + * spc: 輸入證書檔案名 + * pfx: 輸出 pfx 檔案名稱 + * 大埔: pfx 密碼;pvk 密碼如果不提供相同 + +如果我們提供此 pfx 檔到 build.json 檔中,我們將會有以下錯誤:"金鑰檔可能受密碼保護。 要更正此問題,請嘗試手動導入證書到當前使用者的個人憑證存儲區。"。 為了將其導入我們必須使用[certutil](https://technet.microsoft.com/en-us/library/ee624045(v=ws.10).aspx)從 admin 提示符: + +`certutil -user -p PASSWORD -importPFX FakeCorp.com.pfx` + +地點: + + * user: 指定"當前使用者"個人存儲區 + * p: pfx 檔密碼 + * importPfx: pfx 檔的名稱 + +一旦安裝完畢下, 一步是將 packageThumbprint 和 packageCertificateKeyFile 添加到 build.json。 為了找到 packageThumbprint,搜索的公開我們已經與證書關聯: + +`powershell -Command " & {dir -path cert:\LocalMachine\My | where { $_.Subject -like \"*FakeCorp.com*\" }}"` + +一旦這些最後的值提供。科爾多瓦應該成功打包和簽名應用程式。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/plugin.md b/www/docs/zh-cn/6.x/guide/platforms/win8/plugin.md new file mode 100644 index 0000000..6799d8d --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/plugin.md @@ -0,0 +1,211 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows 外掛程式 +--- + +# Windows 外掛程式 + +此部分提供了如何在 Windows 應用商店應用程式中實現一個使用的外掛程式的詳細資訊。之前讀這篇文章,請參閱應用程式外掛程式外掛程式的結構和其共同的 JavaScript 介面的概述。 這一節繼續顯示示例*回聲*外掛程式從科爾多瓦 web 視圖的本機平臺和背部進行通信。 + +很重要的是要注意 Windows 支援直接在 JAVAscript 中,這意味著發展中國家的 '本土' 的部分,只需要在特殊情況下發展。 + +## 在 JavaScript 中創建一個 Windows 外掛程式 + +這些指令是要創建一個純 JavaScript 外掛程式。理解這一點對於理解如何添加本機/託管位至關重要。 + +Windows 科爾多瓦外掛程式是本質上是一個薄包裝周圍現有 WinJS 提供的功能,但假設你會想要定義為多個設備你 JS 通用介面,你通常會提供 API 的 1 JS 檔。 + + // inside file echoplugin.js + var EchoPlugin = { + // the echo function calls successCallback with the provided text in strInput + // if strInput is empty, it will call the errorCallback + echo:function(successCallback, errorCallback, strInput) { + cordova.exec(successCallback,errorCallback,"EchoPlugin","echo",[strInput]); + } + } + + +## 在 Windows 上的裡面科爾多瓦 exec。 + +Cordova.exec 函數以不同的方式定義的每個平臺上,這是因為每個平臺都有它自己的應用 js 代碼和本機包裝代碼之間進行通信的方式。 但在 Windows 中,有沒有本地的包裝,所以 exec 調用有一致性。 就像你可以直接在 EchoPlugin.echo,你 js 只有外掛程式工作: + + // inside file echoplugin.js ( this is what NOT to do if you want to reuse the JS API cross platform ) + var EchoPlugin = { + echo:function(successCallback,errorCallback,strInput) { + if(!strInput || !strInput.length) { + errorCallback("Error, something was wrong with the input string. =>" + strInput); + } + else { + successCallback(strInput + "echo"); + } + } + } + + +這將可能會做工精細,但是它意味著您將需要為不同的平臺,不同版本的 echoPlugin.js,可能你可以在你的實現中有不一致的問題。 作為最佳實踐,我們決定模仿 cordova.exec 上窗戶,裡面的本機 API,所以我們可以運行相同的 JS 代碼,並不需要重寫一遍為平臺,和也利用檢查,任何參數或其他常見的代碼,由開發人員在其他平臺上工作的人員提供。 + +## 科爾多瓦 exec 代理 + +在 Windows 上,科爾多瓦提供一個代理,您可以使用來註冊一個物件,它將處理所有的 cordova.exec 調用的 API。 + +例如如果你想要為加速度感應器 API 提供實現,你會這樣做: + +cordova.commandProxy.add ("加速度"{開始: function() {/ / 你代碼在這裡......}/ /......,其餘的在這裡的 API}) ; + +所以在我們的例子中,我們將假設中 echoplugin.js 的代碼處理跨平臺相關,JavaScript,和我們可以只編寫 Windows 的代理 + + // in file echopluginProxy.js + cordova.commandProxy.add("EchoPlugin",{ + echo:function(successCallback,errorCallback,strInput) { + if(!strInput || !strInput.length) { + errorCallback("Error, something was wrong with the input string. =>" + strInput); + } + else { + successCallback(strInput + "echo"); + } + } + }); + + +外掛程式定義 + +如果我們希望我們的外掛程式的使用者能夠輕鬆地安裝我們的外掛程式,我們需要定義根據 PlugMan 是如何定義的外掛程式。 更多關於這在[外掛程式規範][1] + + [1]: plugin_ref_spec.md.html#Plugin%20Specification + + + + + + + + + + + + + + + + + + + + +這給了我們 Windows JavaScript 外掛程式,使用一個通用的檔 (echoplugin.js) 和使用代理伺服器提供實施 (echopluginProxy.js) 的 Windows 只有部分工作。 我們怎麼做將本機/託管代碼添加到這? 好吧我們要開始相同,唯一的區別將在 echopluginProxy 方法中我們做裡面。 + +# WinJS 如何訪問本機/託管代碼 + +在 Windows 中,WinJS 編寫的應用程式都能夠與本機代碼進行交互,這間的 op 是供 Windows 運行時元件。 細節很多,和本指南只會掩蓋基本知識。 Microsoft 提供了更多的資訊[在這裡][2]. + + [2]: http://msdn.microsoft.com/en-us/library/windows/apps/hh441569.aspx + +當您創建您的 Windows 運行時元件,任何類被定義為 '公共 ref 類密封' 被認為是 '可啟動班',將可從 JavaScript 調用。 + + // in your header file .h + namespace EchoRuntimeComponent + { + public ref class EchoPluginRT sealed + { + public: + static Platform::String^ Echo(Platform::String^ input); + } + } + + // in the implementation file .cpp + using namespace EchoRuntimeComponent; + using namespace Platform; + + Platform::String^ EchoPluginRT::Echo(Platform::String^ input) + { + if(input->IsEmpty()) + { + return "Error: input string is empty."; + } + else + { + return input->ToString() + "echo"; + } + } + + +現在為了讓我們來調用本機代碼,我們使用的命名空間、 類名和 lowerCamelCase 我們正在調用的方法。 + +var res = EchoRuntimeComponent.EchoPluginRT.echo("boom") ;我們將這移動到我們的 echopluginProxy.js 檔,得到這個: + + // in file echopluginProxy.js + cordova.commandProxy.add("EchoPlugin",{ + echo:function(successCallback,errorCallback,strInput) { + var res = EchoRuntimeComponent.EchoPluginRT.echo(strInput); + if(res.indexOf("Error") == 0) { + errorCallback(res); + } + else { + successCallback(res); + } + } + }); + + +就是這樣,我們在 Apache Cordova Windows 中有使用端到端 c + + 支援 js 調用外掛程式 ! + +# 技術的一些注意事項: + +* 回檔通常是非同步所以馬上調用回檔可能預計不會由調用方。 在實踐中,如果電話不是非同步,你應該至少使用 javascript 超時強制被稱為非同步回檔。 +* 可啟動的類可以做各種各樣的太棒了,像在調度,非同步回檔,通過您自己的物件類型、 陣列、 集合、 重載的方法和更多的事件。 我建議你做你的家庭作業。 +* 如果你堅持共同的 Windows Phone 8.0 和 Windows SDK API 呼叫,你將能夠在 Windows Phone 8.0 Apache 科爾多瓦外掛程式中使用相同的運行時元件 (本機或託管的位)。 ~ 敬請期待這一職務。 + +# 定義你的外掛程式 + +現在,我們有一個工作的外掛程式,我們需要重新審視從早些時候的外掛程式定義,所以我們可以將其發佈。 我們現在可以作為一種框架添加運行時元件。 注意 WindowsRuntimeComponent 的輸出類型可以是.winmd 或.dll + + + + + + + + + + + + + + + + + + + + + +就是這樣,你現在有一個可分發的外掛程式,你可以與世界分享 ! 要注意,將框架添加到 Windows 科爾多瓦專案支援最近才加入,所以您將需要確保模具當前你科爾多瓦的一件事。 科爾多瓦 cli 和科爾多瓦 plugman 支援添加刪除本機支援的外掛程式。 + +> cordova plugin add com.risingj.echoplugin + +或 + +> plugman install --platform windows --plugin com.risingj.echoplugin --project . + +https://github.com/purplecabbage/cordova-runtimecomp-echoplug \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/tools.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/tools.md b/www/docs/zh-cn/6.x/guide/platforms/win8/tools.md new file mode 100644 index 0000000..fb367ee --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/tools.md @@ -0,0 +1,43 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows 8 的命令列工具 +--- + +# Windows 8 的命令列工具 + +`cordova`命令列實用程式是一個高級別的工具,允許您在一次跨幾個平臺生成的應用程式。 舊版本的科爾多瓦框架提供了特定于每個平臺的命令列工具集。 若要使用它們作為 CLI 的替代,您需要從[cordova.apache.org][1]下載此版本的科爾多瓦。 下載檔案中包含單獨的檔案,為每個平臺。 展開您想要的目標平臺。 這裡描述的工具,通常可用在頂級 `bin` 目錄中,否則為諮詢**自述**檔,瞭解有關更多詳細的指示。 + + [1]: http://cordova.apache.org + +低級命令列介面,它使外掛程式的資訊,請參閱使用 Plugman 到管理外掛程式。有關概述,請參見應用程式外掛程式。 + +## Windows 8 + +Windows 8 的命令列工具僅支援創建新專案。必須從 cmd 或 powershell 的提示符下運行命令。 + +## 創建一個專案 + +運行 `create` 命令使用以下參數: + +* 您新的科爾多瓦 Windows 8 專案的路徑 + +* 之後反向域風格公約的包名稱。這將成為預設 Namespace。 + +* 專案名稱 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/upgrade.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/upgrade.md b/www/docs/zh-cn/6.x/guide/platforms/win8/upgrade.md new file mode 100644 index 0000000..3beb23e --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/upgrade.md @@ -0,0 +1,62 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 升級 Windows 8 +--- + +# 升級 Windows 8 + +本指南演示如何修改 Windows 8 專案從科爾多瓦的舊版本進行升級。 大多數這些說明適用于與舊集的前面的命令列工具創建的專案 `cordova` CLI 實用程式。 資訊,請參閱命令列介面如何更新的 CLI 版本。 + +## 升級至 4.0.0 從 3.1.0 或更高版本 + +為創建的科爾多瓦 CLI 的專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行`cordova platform update windows8`. + +對於不使用 CLI 科爾多瓦創建的專案,請運行: + + bin\update + + +## 升級到 3.1.0 + +在科爾多瓦 3.1.0 引入了對 Windows 8 的科爾多瓦 CLI 支援。若要升級,我們建議創建新的科爾多瓦 CLI 專案和所有必要的資產轉移。 + +## 從 2.8.0 升級到 2.9.0 + +下面的命令應當從內進行 Visual Studio 可以肯定任何專案引用是更新刪除。 + +1. 刪除 `cordova-2.8.0.js` 從專案的 `www` 目錄。 + +2. 添加 `cordova.js` 檔從源到專案中的 `www` 目錄。(請注意該檔不再包含在檔案名中的版本號)。 + +3. 生成和測試 ! + +## 從 2.7.0 升級到 2.8.0 + +下面的命令應當從內進行 Visual Studio 可以肯定任何專案引用是更新刪除。 + +1. 刪除 `cordova-2.7.0.js` 從專案的 `www` 目錄。 + +2. 添加 `cordova.js` 檔從源到專案中的 `www` 目錄。(請注意該檔不再包含在檔案名中的版本號)。 + +3. 生成和測試 ! \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/upgrading.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/upgrading.md b/www/docs/zh-cn/6.x/guide/platforms/win8/upgrading.md new file mode 100644 index 0000000..9c4813f --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/upgrading.md @@ -0,0 +1,62 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 升級 Windows 8 +--- + +# 升級 Windows 8 + +本指南演示如何修改 Windows 8 專案從科爾多瓦的舊版本進行升級。 大多數這些說明適用于與舊集的前面的命令列工具創建的專案 `cordova` CLI 實用程式。 命令列介面資訊,請參閱如何更新的 CLI 版本。 + +## 從 3.1.0 升級到 3.2.0 + +為創建的科爾多瓦 CLI 的專案: + +1. 更新 `cordova` CLI 版本。請參閱命令列介面。 + +2. 運行`cordova platform update windows8`. + +對於不使用 CLI 科爾多瓦創建的專案,請運行: + + bin\update + + +## 升級到 3.1.0 + +在科爾多瓦 3.1.0 引入了對 Windows 8 的科爾多瓦 CLI 支援。若要升級,我們建議創建新的科爾多瓦 CLI 專案和所有必要的資產轉移。 + +## 從 2.8.0 升級到 2.9.0 + +下面的命令應當從內進行 Visual Studio 可以肯定任何專案引用是更新刪除。 + +1. 刪除 `cordova-2.8.0.js` 從專案的 `www` 目錄。 + +2. 添加 `cordova.js` 檔從源到專案中的 `www` 目錄。(請注意該檔不再包含在檔案名中的版本號)。 + +3. 生成和測試 ! + +## 從 2.7.0 升級到 2.8.0 + +下面的命令應當從內進行 Visual Studio 可以肯定任何專案引用是更新刪除。 + +1. 刪除 `cordova-2.7.0.js` 從專案的 `www` 目錄。 + +2. 添加 `cordova.js` 檔從源到專案中的 `www` 目錄。(請注意該檔不再包含在檔案名中的版本號)。 + +3. 生成和測試 ! \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/win8/win10-support.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/win8/win10-support.md b/www/docs/zh-cn/6.x/guide/platforms/win8/win10-support.md new file mode 100644 index 0000000..778d604 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/win8/win10-support.md @@ -0,0 +1,123 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows 10 的科爾多瓦 +--- + +# Windows 10 的科爾多瓦 + +也許你可以改稱之為"科爾多瓦 10 視窗"。 Windows 10 已經重新設計使科爾多瓦支援到 web,並得到擋你路的平臺安全限制其 HTML 和 JavaScript 應用程式平臺。 + +## 開始使用 Windows 10 + +添加 Windows 10 支援您的應用程式非常簡單,將您的 Windows 目標平臺版本設置為 10.0: + + + + + +當您建立與這兩個設置這些首選項時,將建成僅限單個.appx (和.appxupload)。 他們將至少需要 Windows 10。 + +### 瞭解遠端與本地模式模式 + +遠端模式是 Windows 10 HTML 應用程式的 Windows 平臺的新功能。 在 Windows 8 和 8.1,HTML 應用程式在 Windows 10 工作中什麼所謂的"本地模式"。 在本地模式下,HTML 應用程式具有完全訪問本機 Windows API 表面和能力。 為了防止腳本注入攻擊,這可能會導致洩漏由於惡意程式碼的個人可識別資訊,本地模式不允許內聯腳本,需要開發人員執行 DOM 操作,這樣做內顯式上下文 (`MSApp.execUnsafeLocalFunction`). + +遠端模式消除了這些要求,這使得它可以使用未修改的庫像 jQuery 或 AngularJS 直接在代碼中,沒有發生任何變化。 要這樣做,它將刪除您聲明某些功能時證明您在 Windows 應用商店的應用程式的能力。 刪除的這些功能通常不會阻止進入特定的功能,但它可能需要使用不同的 Api 或戰術組合。 + +### 遠端方式對功能的影響 + +部署到 Windows 應用商店應用程式遠端模式時,下列功能不可用: + + * 企業認證 (`enterpriseAuthentication`) + * 共用的使用者證書 (`sharedUserCertificates`) + * 文件庫 (`documentsLibrary`) + * 音樂庫 (`musicLibrary`) + * 圖片庫 (`picturesLibrary`) + * 視頻庫 (`videosLibrary`) + * 卸除式存放裝置 (`removableStorage`) + * 互聯網端 (`internetClientServer`)-請注意, `internetClient`仍允許 + * 私人網路絡用戶端/伺服器 (`privateNetworkClientServer`) + +每個庫限制可能要求使用者與檔案系統通過一個[檔選取器](https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.pickers.fileopenpicker.aspx)交互工作周圍。 這樣可以防止惡意注入的代碼任意訪問檔案系統。 + +通過使用不使用能力檢查 API 或經紀通過標準的互聯網溝通管道,如`XMLHttpRequest`或 Web 通訊端通信,必須解決與網路相關的限制。 + +企業身份驗證和共用使用者證書功能是專門針對企業方案。 這些功能支援私營/企業啟用的應用程式商店,所以如果你正在打算將其部署到內部部署機制的應用程式,您仍然可以支援這些。 然而,他們不支援遠端模式在公共 Windows 應用商店的應用程式。 當你建立針對 Windows 10,如果這些功能之一檢測到您的應用程式清單中時,將顯示警告。 + +## 引用 + +### config.xml 首選項 + +#### windows-target-version, windows-phone-target-version + + + + + +*至少一個是必需的。* + +這些首選項確定 Windows 或 Windows Phone 你想要的目標應用程式套裝軟體的版本。 + +**有效的值** + + * `10.0`,`UAP`: 為 Windows 10 通用的應用程式平臺構建 + * `8.1`: 生成 Windows 8.1 或 Windows Phone 8.1 + * `8.0`: 構建 windows 8.0。 對於 Windows Phone 無效 (改用**wp8**科爾多瓦平臺) + +**方案** + +如果你只針對 Windows 10,你只需要 config.xml 檔中有一個單一`windows 目標版本`設置。 + +#### WindowsDefaultUriPrefix + + + + +此首選項標識是否想要您的應用程式作為其啟動 URI 為目標的**局部上下文**或**遠端上下文**。 當生成 Windows 10,預設值是遠端上下文 (`ms-appx-web: / /`). + +為了有一個本地模式應用程式,不受遠端模式能力的限制,您必須將此首選項設置為`ms-appx://`和不聲明任何``元素與遠端 Uri。 + +**有效的值** + + * `ms-appx://`(預設為 Windows 8.0,8.1): 本地上下文中運行的起始頁 + * `ms-appx-web://`(預設為 Windows 10): 遠端上下文中運行的起始頁 + +#### {SDK}-MinVersion,{SDK} MaxVersionTested + +*可選* + + + + + + + +這些首選項確定哪些生態系統 (包括但不是限於 Windows 通用、 Windows Mobile 或 Xbox) 和它們的最小/最大版本都相容。 他們仍然需要平臺都支援通用的應用程式平臺 (所以 Windows 10 作為基礎的作業系統)。 然而,這些可能表明應用程式是意識到可能只在某些設備 (如遊戲流在 Xbox 上) 可用的特定功能。 + +**有效的值** + +有三個部分的每個值: **SDK**、**版本限制**和**版本價值**。 通過與`Windows`或`微軟`開始和結束`-MinVersion`或`-MaxVersionTested`中檢測到這些首選項: + + * **SDK**定義什麼專門的平臺,你想要的目標。 預設值是`Windows.Universal`。 有效值為這些 AppxManifest 架構,在`包/Depednencies/TargetPlatform`元素中定義。 + * 的 **版本限制** 定義應用程式相容性規則。 例如,如果 `-MinVersion` 設置為 10.1.0.0,然後至少 10.1.0.0 的相應的 sdk 並不支援的作業系統版本不能載入它。 + * `-MinVersion`指定 SDK 所需的最低的版本 + * `-MaxVersionTested`指定的最高測試版本的 sdk。 如果發佈了新版本的相應的 sdk,它將運行在相容模式下為指定的版本。 + * **版本值**是 major.minor.build.qfe 的整數 4 元組形式**. + +如果你 config.xml 檔中指定這些類型沒有偏好,然後將預設選擇 Windows.Universal 10.0.0.0 版本。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp7/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp7/index.md b/www/docs/zh-cn/6.x/guide/platforms/wp7/index.md new file mode 100644 index 0000000..a4f7401 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp7/index.md @@ -0,0 +1,110 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows Phone 7 平臺指南 +--- + +# Windows Phone 7 平臺指南 + +本指南介紹如何設置您的 SDK 開發環境部署科爾多瓦的 Windows Phone 7 設備的應用程式。 應用程式也使用相同的 Api,但 7 缺乏的一些 IE10 的高級功能上 Windows Phone 8 可用的版本的 Windows Phone 8 設備上運行。 Windows Phone 8 應用程式*不*在 Windows Phone 7 設備上運行。 + +適用于這兩個版本的更多詳細的平臺特定資訊如下所示: + +* [升級 Windows Phone](../wp8/upgrading.html) +* Windows Phone 外掛程式 +* [Windows Phone 的命令列工具](../wp8/tools.html) + +上面的命令列工具請參閱科爾多瓦 3.0 以前的版本。關於當前介面的資訊,請參閱命令列介面。 + +## 系統要求 + +使用 Windows 7 或 Windows 8 (Pro) 或 Windows Vista sp2。需要的 SDK 的 Windows 64 位版本 (x64)。Pro 版被推薦運行的設備模擬程式。 + +註冊和支付為[Windows Phone 開發中心][1]帳戶,如果你想要在實際設備上安裝應用程式或將其提交給市場的地方。 + + [1]: http://dev.windowsphone.com/en-us/publish + +**注意**: 在虛擬機器中運行 SDK 可能提出了挑戰。閱讀[在 Mac 上的 Windows Phone][2]開發解決方案的見解。 + + [2]: http://aka.ms/BuildaWP8apponaMac + +## 安裝 SDK 和科爾多瓦 + +下載並安裝[Windows Phone SDK][3]. + + [3]: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570/ + +下載並解壓縮[科爾多瓦][4]的最新副本。 您需要工作 `lib\windows-phone-8\wp7` 子目錄中, `lib\windows-phone-8\wp8` 包含科爾多瓦的視窗電話 8 版本。 + + [4]: http://phonegap.com/download + +複製 `CordovaWP7_x_x_x.zip` 檔到 `\My Documents\Visual +Studio 2012\Templates\ProjectTemplates\` 目錄。 + +## 建築範本 + +**注意**: 如果跳過這一步 `lib\windows-phone` 的目錄已經包含 `CordovaWP7_x_x_x.zip` 檔。 + +為了簡化開發過程,科爾多瓦,將捆綁一個腳本來生成 Visual Studio 範本。 這些允許您迅速生成科爾多瓦的應用程式,如果有必要,您可以修改它們。 以下步驟顯示如何生成它。 + +### 運行該批次檔來創建和安裝範本 + +根的回購協定包含 `createTemplates.bat` 檔。 按兩下此檔將生成兩個 `.zip` 檔: `CordovaWP7_x_x_x.zip` 和 `CordovaWP8_x_x_x.zip` ,其中*x.x.x*是的當前版本號。 若要使用這些檔很容易在 Visual Studio 中的,複製它們到 `My Documents\Visual Studio +2012\Templates\ProjectTemplates\` 子目錄。 然後,可以創建新的**Apache 科爾多瓦 Windows Phone_ 應用程式從 Visual Studio __File → 新專案**功能表。 + +如果您從命令列運行該批次檔,還可以調用同一個參數,以便自動安裝: + + > createTemplates.bat-安裝 + + +## 設立了一個新的專案 + +* 打開 Visual Studio 表示為 Windows Phone 和選擇**新的專案**. + +* 選擇**CordovaWP7**。版本編號顯示在範本描述。 + +* 為該專案的名稱,並選擇**確定**. + +## 審查的專案結構 + +`www`目錄功能 `html` , `js` ,和 `css` 子目錄和任何其他資源要求您的應用程式。 任何附加內容需要的 Visual Studio 專案的一部分,必須將它設置為內容。 + +下面的示例結構表示一個 2.3.0 專案,但可能已安裝的版本而異: + +![][5] + + [5]: {{ site.baseurl }}/static/img/guide/platforms/wp8/projectStructure.png + +## 為該設備生成專案 + +在測試之前您的設備上的應用程式,必須註冊該設備。 有關如何部署和測試 Windows Phone 7 上的詳細資訊,請參考[微軟的文檔][6]。 這些都是基本的步驟: + + [6]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402565(v=vs.105).aspx + +* 請確保您的電話連接,並且螢幕處於解鎖狀態。 + +* 在 Visual Studio 中,從頂部的下拉式功能表中選擇**設備**。 + +* 按主要的下拉式功能表中,若要啟動調試,旁邊的綠色**播放**按鈕,否則鍵入**F5**. + +![][7] + + [7]: {{ site.baseurl }}/static/img/guide/platforms/wp7/wpd.png + +此時,你完了。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp8/home.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp8/home.md b/www/docs/zh-cn/6.x/guide/platforms/wp8/home.md new file mode 100644 index 0000000..226958c --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp8/home.md @@ -0,0 +1,27 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: WP8 Guides +--- + +# WP8 Guides + +* [Windows Phone 8 Platform Guide](index.html) +* [Windows Phone 8 Plugins](plugin.html) +* [Upgrading Windows Phone 8](upgrade.html) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp8/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp8/index.md b/www/docs/zh-cn/6.x/guide/platforms/wp8/index.md new file mode 100644 index 0000000..89eec4a --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp8/index.md @@ -0,0 +1,198 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows Phone 8 平臺指南 +--- + +# Windows Phone 8 平臺指南 + +本指南介紹如何設置您的 SDK 開發環境部署科爾多瓦的 Windows Phone 設備的應用程式。 它側重于 Windows Phone 8,但提供如何支援 Windows Phone 7 的附加詳細資訊。 + +該示例演示如何使用任一特定的 Windows Phone 外殼程式工具來生成和生成的應用程式,或者跨平臺科爾多瓦 CLI 討論在命令列介面。 (見的概述的這些發展工作流比較)。此部分還顯示了如何打開科爾多瓦的應用程式,以便您可以在 Visual Studio 中修改他們。 無論你採取哪種方法,您需要安裝 Windows Phone SDK,如下所述。 + +見到 Windows Phone 平臺特定的詳細資訊如下: + +* [Windows Phone 8 外掛程式](plugin.html) +* [升級 Windows Phone 8](upgrade.html) + +對於 Windows Phone 8 平臺,科爾多瓦 web 視圖依賴于互聯網資源管理器中 10 作為自己的渲染引擎,因此作為一個實際問題你可以使用 IE10 的功能強大的調試器來測試並不調用科爾多瓦 Api 的任何 web 內容。 Windows Phone 開發者博客如何支援 IE10 和可比較的 WebKit 瀏覽器提供[有益的指導][1]。 + + [1]: http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10.aspx + +## 要求和支援 + +您需要以下各項: + +* 64 位版本的 Windows 8 Pro,安裝盤或*ISO*磁片影像檔。 評估版是[Microsoft 開發人員網路][2]上可用。 Pro 版有必要運行設備模擬程式。 + +* [Windows Phone SDK][3]. + +* 要通過命令列與 Windows Phone 8.0 SDK 部署,必須安裝[Visual Studio 2012 更新 2][4] 。 + + [2]: http://msdn.microsoft.com/en-US/evalcenter/jj554510 + [3]: http://www.microsoft.com/en-us/download/details.aspx?id=35471 + [4]: https://support.microsoft.com/en-us/kb/2797912 + +為了開發科爾多瓦的 Windows Phone 設備的應用程式,您可以使用運行 Windows 的電腦,但你也可能發展的 mac,通過運行一個虛擬機器環境或者通過使用新兵訓練營雙啟動 Windows 的分區。 請查閱這些資源以設置在 Mac 上所需的 Windows 開發環境: + +* **VMWare 融合**: 要設置了 Windows 8 的虛擬機器,按照[Microsoft 開發人員網路][5],所提供的說明,然後請參閱配置 VMWare 融合的虛擬環境運行 SDK 捆綁的模擬器的準備工作資訊。 + +* **桌面的相似之處**: 若要設置 Windows 8 虛擬機器,按照[Microsoft 開發人員網路][6],所提供的說明,然後請參閱配置平行桌面虛擬環境運行 SDK 捆綁的模擬器的準備工作資訊。 + + [5]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945426 + [6]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945424 + + + +* **新兵訓練營**: 要設置了 Windows 8 的分區,請按照操作[Microsoft 開發人員網路][7]所提供的安裝說明. + + [7]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945423 + +如果您在 PC 上開發,其處理器必須支援虛擬化 (英特爾*VT-x* ) 和[第二級別位址翻譯 (板式)][8]。 請查閱[英特爾的支援的處理器的清單][9]。 虛擬化是通常預設禁用的所以您需要在您的 BIOS 設置中啟用它。 PC 應該有至少 6.5 GB 的可用硬碟空間和 4 GB 的 RAM。 + + [8]: http://en.wikipedia.org/wiki/Second_Level_Address_Translation + [9]: http://ark.intel.com/Products/VirtualizationTechnology + +## 使用科爾多瓦外殼工具 + +如果您想要使用科爾多瓦的 Windows Phone 居中外殼工具與 SDK 一起,你有兩個基本選項: + +* 本地訪問它們生成的 CLI 的專案代碼中。他們是可用在 `platforms/wp8/cordova` 目錄在您添加後 `wp8` 平臺如下所述。 + +* 從單獨的分發在[cordova.apache.org][10]下載它們。 科爾多瓦分佈包含單獨的檔案,為每個平臺。 一定要展開相應的存檔, `cordova-wp8\wp8` 在這種情況下,在一個空的目錄內。 有關批次處理實用程式可用在頂級 `bin` 目錄。 (參閱**自述**檔,如果有必要作更詳細的指示)。 + + [10]: http://cordova.apache.org + +這些外殼工具允許您創建、 構建和運行 Windows Phone 應用程式。 額外的命令列介面,可以跨所有平臺的外掛程式功能的資訊,請參閱使用 Plugman 到管理外掛程式。 指導如何開發外掛程式和 Windows Phone 8 外掛程式特定于 Windows Phone 平臺的詳細資訊,請參閱應用程式外掛程式。 + +## 安裝 SDK + +從[dev.windowsphone.com][11]的**下載**區域安裝最新版本的 Windows Phone SDK。 你也可以安裝更多最近的模擬程式更新程式封裝。 + + [11]: https://dev.windowsphone.com/en-us/downloadsdk + +![][12] + + [12]: {{ site.baseurl }}/static/img/guide/platforms/wp8/wp8_downloadSDK.png + +## 創建一個新專案 + +在這一點上,要創建一個新的專案你可以選擇之間跨平臺 CLI 工具的命令列介面或的一組特定的 Windows Phone 殼工具中所述。 在原始程式碼目錄中,這裡是從 CLI 的方法: + + > cordova create hello com.example.hello HelloWorld + > cd hello + > cordova platform add wp8 + + +下面是相應的低級別 shell 工具方法: + + C:\path\to\cordova-wp8\bin\create.bat C:\path\to\new\hello com.example.hello HelloWorld + + +## 生成專案 + +如果您在開發中使用 CLI,專案目錄的頂級 `www` 目錄中包含的原始程式碼檔。運行任一內要重新生成應用程式的專案目錄: + + > cordova build + > cordova build wp8 # do not rebuild other platforms + + +如果您使用特定的 Windows Phone 外殼工具在發展中,還有不同的做法。 一旦您生成專案時,預設的應用程式的源是可用在 `projects\wp8\www` 子目錄。 隨後命令都可用在 `cordova` 子目錄中同一級別的。 + +`build`命令清除專案檔案並重新生成應用程式。第一個示例將生成調試資訊,和第二個標誌發佈的應用程式: + + C:\path\to\project\cordova\build.bat --debug + C:\path\to\project\cordova\build.bat --release + + +`clean`命令可以説明沖洗中準備的下一個目錄 `build` : + + C:\path\to\project\cordova\clean.bat + + +## 部署到模擬程式 + +在這一點上,您可以使用 `cordova` 實用程式 CLI 應用程式部署到模擬程式從命令列: + + > cordova emulate wp8 + + +否則使用備用殼介面: + + C:\path\to\project\cordova\run + + +預設情況下, `run` 腳本調用的模擬器的標誌,並為其接受附加生成標誌, `--debug` 提供的預設值: + + C:\path\to\project\cordova\run --emulator --debug + C:\path\to\project\cordova\run --emulator --release + C:\path\to\project\cordova\run --emulator --nobuild + + +在啟動模擬器設備圖像與安裝的應用程式。 從主畫面,導航到要啟動**HelloWorld**應用程式的應用程式面板。這顯示了應用程式啟動與它閃屏,其次是它的主介面: + +![][13] + + [13]: {{ site.baseurl }}/static/img/guide/platforms/wp8/wp8_emulator.png + +設備的螢幕頂部右邊模擬程式的基本控制項允許您以縱向和橫向方向之間切換。 **>**按鈕將打開更多的控制項,使您可以測試更複雜的取向和手勢: + +![][14] + + [14]: {{ site.baseurl }}/static/img/guide/platforms/wp8/wp8_emulator_orient.png + +這些先進的控制項還允許您修改該設備的位置或類比的運動序列: + +![][15] + + [15]: {{ site.baseurl }}/static/img/guide/platforms/wp8/wp8_emulator_loc.png + +## 將部署到設備 + +在測試之前您設備上的應用程式,必須註冊該設備。 有關如何部署和測試 Windows Phone 8 上的詳細資訊,請參考[微軟的文檔][16]。 此外,還要確保手機連接到電腦,和螢幕處於解鎖狀態。 + + [16]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402565.aspx + +然後運行下面的 CLI 命令,要在設備上運行的應用程式: + + > cordova run wp8 + + +它對應于此較低級別 shell 命令: + + C:\path\to\project\cordova\run --device + + +或者,如果你工作在 Visual Studio 中, **Windows Phone 設備**從功能表中選擇下拉在頂部,然後按綠色**播放**按鈕附近,否則鍵入**F5**. + +## 修改在 SDK 中的專案 + +一旦你建立科爾多瓦的應用程式,如上文所述,您可以使用 SDK 打開它。 各種 `build` 命令會生成一個 Visual Studio 解決方案 (*.sln*) 檔。 打開要修改在 Visual Studio 專案的檔。 基於 web 的原始程式碼,該代碼是在專案內可用 `www` 目錄。 以及其他工具 SDK 提供,下面的功能表控制項使您可以啟動該應用程式在 Windows Phone 模擬器中: + +![][17] + + [17]: {{ site.baseurl }}/static/img/guide/platforms/wp8/wp8_vs.png + +如何在您的工作流中使用科爾多瓦的命令列工具或 SDK 的建議諮詢的概述。 科爾多瓦 CLI 依賴于跨平臺原始程式碼通常會覆蓋使用 SDK 的特定于平臺的檔。 如果你想要在 SDK 內工作,使用較低級別外殼工具作為 CLI 的替代方法。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp8/parallels.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp8/parallels.md b/www/docs/zh-cn/6.x/guide/platforms/wp8/parallels.md new file mode 100644 index 0000000..65247dc --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp8/parallels.md @@ -0,0 +1,44 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: 配置 512mb +--- + +# 配置 512mb + +這一節演示如何在 Mac 上配置的相似之處桌面,以便您可以使用科爾多瓦生成 Windows Phone 應用程式。 + +[Microsoft 開發人員網路][1]提供有關如何運行 Windows 的相似之處的桌面下的一般說明。 之後安裝 Windows,請執行以下步驟: + + [1]: http://msdn.microsoft.com/en-US/library/windows/apps/jj945424 + +1. 在桌面的相似之處內, 選擇您已經準備好的 Windows 8 磁片映射並選擇**設置**. + +2. 選擇的**一般 → Cpu**選項。指定*兩個*Cpu。指定至少 2 GB 的記憶體,即使它不屬於建議的範圍: + + ![][2] + +3. 要能運行 Windows 8 虛擬機器中的設備模擬程式圖像,選擇**優化**選項並啟用**嵌套的虛擬化**. + + ![][3] + + [2]: {{ site.baseurl }}/static/img/guide/platforms/wp8/parallel_cpu_opts.png + [3]: {{ site.baseurl }}/static/img/guide/platforms/wp8/parallel_optimize_opts.png + +一旦你完成這些步驟,你是準備好安裝 Windows Phone SDK。請參閱 Windows Phone 8 平臺指南的詳細資訊。 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp8/plugin.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp8/plugin.md b/www/docs/zh-cn/6.x/guide/platforms/wp8/plugin.md new file mode 100644 index 0000000..17e01d7 --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp8/plugin.md @@ -0,0 +1,199 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows Phone 8 外掛程式 +--- + +# Windows Phone 8 外掛程式 + +此部分提供了如何在 Windows Phone 平臺上實現本機外掛程式代碼的詳細資訊。 之前讀這篇文章,請參閱外掛程式開發指南外掛程式的結構和其共同的 JavaScript 介面的概述。 這一節繼續表明通信從科爾多瓦 web 視圖的本機平臺和後面的示例*回聲*外掛程式。 + +在 Windows Phone 上的科爾多瓦編寫外掛程式需要科爾多瓦的體系結構的一個基本的瞭解。 科爾多瓦 WP8 組成的 `WebBrowser` ,承載應用程式的 JavaScript 代碼和管理本機 API 呼叫。 您可以擴展 C# `BaseCommand` 類 ( `WPCordovaClassLib.Cordova.Commands.BaseCommand` ),其中附帶了大部分的你需要的功能: + +1. 選擇您的專案,並按一下滑鼠右鍵,選擇**添加 → 新專案......**如果您願意,您可以添加它到 `Plugins` 資料夾。 + +2. 選擇**類**和命名為 `Echo.cs` 。 這類名稱必須*完全*匹配你叫什麼指定的服務作為 `cordova.exec()` 的 JavaScript 一邊打電話。 + +3. 包括基類,這些類執行: + + 使用 WPCordovaClassLib.Cordova ;使用 WPCordovaClassLib.Cordova.Commands ;使用 WPCordovaClassLib.Cordova.JSON ; + + +4. 擴展您的類從 `BaseCommand` : + + 公共類回聲: BaseCommand {/ /......} + + +5. 添加 `echo` 可從 JavaScript 調用的方法: + + 公共類回聲: BaseCommand {公共 void 回聲 (字串選項) {/ / JS 可調用外掛程式的所有方法必須都有此簽名 ! + / / 公共返回 void,1 參數是一個字串}} + + +請參閱可用的外掛程式來重寫方法的[BaseCommand.cs][1]類。 例如,該外掛程式可以捕獲 '暫停' 和 '恢復' 事件。 + + [1]: https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/Commands/BaseCommand.cs + +## 命名空間 + +不合格的命令的預設命名空間為: + + namespace Cordova.Extension.Commands + { + // ... + } + + +如果你想要指定您自己的命名空間,則需要完全限定打電話到 `cordova.exec` 。例如,如果您想要定義您的類 C# 像這樣: + + namespace com.mydomain.cordovaExtensions + { + public class Echo : BaseCommand + { + // ... + } + } + + +JavaScript 會需要調用 `exec` 像這樣: + + cordova.exec (贏、 失敗,"com.mydomain.cordovaExtensions.Echo",......); + + +## 解釋在 C 中的參數 + +中討論的示例中應用程式外掛程式,你的外掛程式接收的資料是一個字串,但如果你想要傳遞的字串陣列嗎? 假設 JavaScript `cordova.exec` 調用指定像這樣: + + cordova.exec (贏了,失敗了,"回聲"、"回聲"、 ["輸入的字串"]) ; + + +值 `options` 的字串傳遞給 `Echo.echo` 方法是 JSON: + + "[\"input string\"]" + + +所有 JavaScript `exec` 參數被傳遞到 C# 中之前, 是 JSON 編碼和所以需要解碼: + + string optVal = JsonHelper.Deserialize(options)[0]; + // optVal now has the value of "input string" + + +## 通過結果從 C# 對 JavaScript + +`BaseCommand`類提供的方法將資料傳遞到 JavaScript 回檔處理常式。如果你只是想要信號沒有附帶結果的成功,你可以簡單地調用: + + DispatchCommandResult(); + // calls back with an empty plugin result, considered a success callback + + +若要傳遞回來的資料,你需要調用 `DispatchCommandResult` 以不同的方式: + + DispatchCommandResult (新 PluginResult (PluginResult.Status.OK,"一切都按計劃,這是一個傳遞給成功處理的結果")) ; + + +使用一個已編碼的 JSON 字串的結構化的物件資料傳遞回 JavaScript: + + DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "{result:\"super awesome!\"}")); + + +要發出錯誤的信號,請致電 `DispatchCommandResult` 與 `PluginResult` 物件,其狀態是 `ERROR` : + + DispatchCommandResult (新 PluginResult (PluginResult.Status.ERROR,"回波信號錯誤")) ; + + +## 處理序列化錯誤 + +您的論點,在解釋時 `try` / `catch` 塊可説明遮罩掉壞的輸入。這種模式將出現在整個科爾多瓦 C# 代碼: + + string optVal = null; + + try + { + optVal = JsonHelper.Deserialize(options)[0]; + } + catch(Exception) + { + // simply catch the exception, we handle null values and exceptions together + } + + if (optVal == null) + { + DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); + } + else + { + // ... continue on to do our work + } + + +## 外掛程式使用壽命 + +外掛程式需要長時間運行的請求,如媒體重播、 聽眾,保持內部狀態應執行的背景活動 `onReset` 方法來清理這些活動。 當 CordovaView webbrowser 控制項導航到新的一頁或刷新,重新載入 JavaScript 運行方法。 + + // defined in WPCordovaClassLib.Cordova.Commands.BaseCommand + public virtual void OnReset() { } + + +## 外掛程式 XML + +下面演示如何使用 `plugin.xml` 檔來指定外掛程式的原始程式碼檔在 Windows Phone 平臺上。 請參閱應用程式外掛程式概述和外掛程式規範有關可用選項的詳細資訊。 + +* ``元素定義了所有外掛程式資源如*.cs*, *.xaml*, *.xaml.cs*,圖像資產和*.dll*檔的。 + +* ``元素定義元素注入到一個設定檔。此示例將外掛程式添加到該平臺的 `config.xml` 檔: + + + + + + + + + 本示例將添加到連絡人功能 `WMAppManifest.xml` 檔: + + + + + + +## 調試外掛程式 + +使用 Visual Studio 調試器來調試外掛程式的 C# 元件。您可以在您的類所公開的方法中的任何設置一個中斷點。 + +JavaScript 更難在 Windows Phone 上進行調試。您需要使用 `console.log` 來輸出外掛程式的狀態,或告知自己的錯誤。 + +## 常見的陷阱 + +* 要小心不要將從 JavaScript 的參數傳遞給本機方面難以作為 JSON 反序列化的。 大多數設備平臺期望的參數傳遞給 `cordova.exec()` 必須是一個陣列,如下所示: + + cordova.exec (勝利、 失敗,"ServiceName"、"方法名稱"["這是一個字串"、 54,{文字: '麻煩'}]) ; + + + 這可能會導致對 C# 進行解碼一個過於複雜的字串值: + + "[\"this is a string\", 54, { literal:'trouble' }]" + + + 相反,考慮將*所有*參數都轉換為字串之前調用 `exec()` ,和每個單獨解碼: + + cordova.exec(win, fail, "ServiceName", "MethodName", ["this is a string", "54", "{literal:'trouble'}"]); + string[] optValues = JsonHelper.Deserialize(options); + + +* 通常,最好要在調用之前檢查參數,在 JavaScript 中的 `exec()` 。 這樣做允許您重新使用更多的代碼和各種本機實現拉從外掛程式的不必要的功能。 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/6.x/guide/platforms/wp8/tools.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/6.x/guide/platforms/wp8/tools.md b/www/docs/zh-cn/6.x/guide/platforms/wp8/tools.md new file mode 100644 index 0000000..36fbb9a --- /dev/null +++ b/www/docs/zh-cn/6.x/guide/platforms/wp8/tools.md @@ -0,0 +1,97 @@ +--- +license: > + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +title: Windows Phone 的命令列工具 +--- + +# Windows Phone 的命令列工具 + +`cordova`命令列實用程式是一個高級別的工具,允許您在一次跨幾個平臺生成的應用程式。 舊版本的科爾多瓦框架提供了特定于每個平臺的命令列工具集。 若要使用它們作為 CLI 的替代,您需要從[cordova.apache.org][1]下載此版本的科爾多瓦。 下載檔案中包含單獨的檔案,為每個平臺。 展開您想要的目標平臺。 這裡描述的工具,通常可用在頂級 `bin` 目錄中,否則為諮詢**自述**檔,瞭解有關更多詳細的指示。 + + [1]: http://cordova.apache.org + +低級命令列介面,它使外掛程式的資訊,請參閱使用 Plugman 到管理外掛程式。有關概述,請參見應用程式外掛程式。 + +## Windows Phone + +Windows Phone 的命令列工具支援創建、 構建和運行的新專案。必須從 cmd 或 powershell 的提示符下運行命令。 + +WP8 回購現在包括用於生成 WP7 + WP8 代碼的應用程式。回購為每個具有的子目錄: `wp7/` 和`wp8/`. + +## 創建一個專案 + +有 2 種方法去有關創建一個新的 Apache 科爾多瓦 WP7 或 WP8 應用程式。 + +### 運行該批次檔來創建和安裝範本 + +* 根的回購協定包含 `createTemplates.bat` 檔。 按兩下它產生兩個 `.zip` 檔: `CordovaWP7_x_x_x.zip` 和 `CordovaWP8_x_x_x.zip` ,其中*x.x.x*表示的當前版本號。 若要方便地使用這些檔在 Visual Studio 中的,複製它們到 `My Documents\Visual Studio +2012\Templates\ProjectTemplates\` 。 然後,可以從 Visual Studio 中創建新的 Apache 科爾多瓦 Windows Phone 應用程式**檔 → 新建專案**功能表。 + +* 如果您從命令列運行該批次檔,還可以調用同一個參數,以便自動安裝 + +運行該腳本: + + > createTemplates.bat-安裝 + + +### 在命令列上使用創建腳本 + +運行 `create` 命令,指定的現有路徑的專案、 反向域式包識別碼和應用程式的顯示名稱。 下面是 Windows Phone 7 和 8 的語法: + + >.\wp7\bin\create PathToNewProject [ PackageName ] [ AppName ] + >.\wp8\bin\create PathToNewProject [ PackageName ] [ AppName ] + + >PathToNewProject : The path to where you wish to create the project + >PackageName : The namespace for the project (default is Cordova.Example) + >AppName : The name of the application (default is CordovaWP8AppProj or CordovaWP7AppProj) + + >examples: + >.\wp7\bin\create C:\path\to\my_new_project + >.\wp8\bin\create C:\path\to\my_new_project io.cordova.example CordovaWP8App + + +啟動 Visual Studio 和打開解決方案檔 (.sln) 中 (C:\path\to\my\_new\_project) + +生成並運行它 + +## 建設專案 (清潔,然後生成) + +* 調試 + + $ C:\path\to\my\_new\_project\cordova\build-調試 + +* 釋放 + + $ C:\path\to\my\_new\_project\cordova\build — — 釋放 + +## 運行應用程式 + +使用下列*可選*的參數運行運行命令 + +* 目標規範。這包括 `--emulator` , `--device` ,或`--target=`. + +* 生成規范。這包括 `--debug` , `--release` ,或`--nobuild`. + + $ C:\path\to\my\_new\_project\cordova\run \[目標\] \[生成\] + +預設情況下 `run` 命令調用與 `--emulator --debug` 如果不提供了標誌。 + +## 清洗 + + $ C:\path\to\my_new_project\cordova\clean \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org