六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

桌面端的移動計算(4)

[摘要]Launching an Application有很多原因使你要從一個桌面程序啟動設備上的一個應用程序。在下面情況下,你可以使用這個技術:· 安裝一...
Launching an Application
有很多原因使你要從一個桌面程序啟動設備上的一個應用程序。在下面情況下,你可以使用這個技術:

· 安裝一個新版本的應用程序。簡單地拷貝CAB文件到設備上,然后在設備上運行CAB安裝程序來提供安裝。這項技術被經常用在你想自動發布和安裝應用程序更新的情況下。

注意 另一個相似的發法是自動話桌面端的安裝過程,使用ActiveSync內置的功能。

· 在安裝了新版本應用程序后重起你的移動應用程序。

· 開始一個設備應用程序處理新更新的數據,在更新了文本或者XML文件后。

RAPI示例程序如圖4。


Figure 4. The Launch Application tab of the RAPI demo program

OpenNETCF.Desktop.Communication命名空間RAPI類提供CreateProcess方法來啟動一個設備文件。你希望啟動的設備應用程序作為該方法的第一個參數。你可以傳遞一個命令行給應用程序,作為第二個參數。

btnLaunchPerform按鈕的點擊事件演示了CreateProcess方法。

[VC#.NET]
private void btnLaunchPerform_Click(object sender, System.EventArgs e)
{

// Perform the launch.
try
{
if (txtLaunchFile.Text == "")
{
MessageBox.Show("You must provide a file to launch.",
"No File Provided");
}
else { myrapi.CreateProcess(txtLaunchFile.Text, txtLaunchCommand.Text); MessageBox.Show("Your file has been launched.", "Launch Success"); } } // Handle any errors that might occur. catch (Exception ex) { MessageBox.Show("The following error occurred while launching the
file -" + ex.Message, "Launch Error"); } }[VB.NET]Private Sub btnLaunchPerform_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnLaunchPerform.Click ' Perform the launch. Try If (txtLaunchFile.Text = "") ThenMessageBox.Show("You must provide a file to launch.", _ "No File Provided"); } else "No File Provided"); } else { myrapi.CreateProcess(txtLaunchFile.Text, txtLaunchCommand.Text); MessageBox.Show("Your file has been launched.", "Launch Success"); } } // Handle any errors that might occur. catch (Exception ex) { MessageBox.Show("The following error occurred while launching the
file -" + ex.Message, "Launch Error"); } }[VB.NET]Private Sub btnLaunchPerform_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnLaunchPerform.Click ' Perform the launch. Try If (txtLaunchFile.Text = "") Then MessageBox.Show("You must provide a file to launch.", _ "No File Provided") Exit Sub End If myrapi.CreateProcess(txtLaunchFile.Text, txtLaunchCommand.Text) MessageBox.Show("Your file has been launched.", "Launch Success") ' Handle any errors that might occur. Catch ex As Exception MessageBox.Show("The following error occurred while launching the file
-" & ex.Message, _ "Launch Error") End Try End Sub接下來我們將進入最后一個RAPI有關的主題:獲得系統信息。在下面的部分你將看到,RAPI類提供了一些方法用來得到連接設備的詳細信息。Retrieving System Information得到指定的設備系統信息使你的程序能夠在下面幾個方面交付內容或改變功能:· 連接設備上使用的處理器,當應用程序上傳一個包含指定處理器的文件的CAB文件到設備上時。注意 這項技術最常用的環境是當你發布應用程序到早期版本的Pocket PC設備上,例如基于ARM處理器的Windows Mobile設備。· 運行在連接設備上的操作系統版本,根據處理器類型使用相應文件進行更新。· 連接設備的電源狀態,經常用于在使用者進入區域前,警告他們的設備運行于低電量狀態下。· 連接設備的內存狀態,用于檢測數據是否可以下載,如果用戶下載了未被授權的應用程序或者其他內存相關函數,或者判斷你是否有足夠的空間安裝應用程序的更新。這部分操作的演示界面見圖5。Figure 5. The Device Information tab of the RAPI demo programRAPI類提供了四個方法來得到這些信息,GetDeviceSystemInfo (處理器類型), GetDeviceVersion (操作系統版本), GetDeviceSystemPowerStatus (電源狀態) 和 GetDeviceMemoryStatus (內存).BtnInfoRetrieve按鈕的點擊事件示范了這些方法。[VC#.NET]private void btnInfoRetrieve_Click(object sender, System.EventArgs e){ string info; MEMORYSTATUS ms; SYSTEM_INFO si; SYSTEM_POWER_STATUS_EX sps; OSVERSIONINFO vi; // Retrieve the system information. myrapi.GetDeviceSystemInfo(out si); // Retrieve the device OS version number. myrapi.GetDeviceVersion(out vi); // Retrieve the device power status. myrapi.GetDeviceSystemPowerStatus(out sps); // Retrieve the device memory status. myrapi.GetDeviceMemoryStatus(out ms); // Format the retrieved information. info = "The connected device has an "; switch (si.wProcessorArchitecture) { case ProcessorArchitecture.Intel: info += "Intel processor.\n"; break; case ProcessorArchitecture.MIPS: info += "MIPS processor.\n"; break; case ProcessorArchitecture.ARM: info += "ARM processor.\n"; break; default: info = "unknown processor type.\n"; break; } info += "OS version: " + vi.dwMajorVersion + "." +
vi.dwMinorVersion + "." + vi.dwBuildNumber + "\n"; if (sps.ACLineStatus == 1) { info += "On AC power: YES\n"; } else { info += "On AC power: NO \n"; } info += "Battery level: " + sps.BatteryLifePercent + "%\n"; info += "Total memory: " + String.Format("{0:###,###,###}",
ms.dwTotalPhys) + "\n"; // Display the results. lblInfo.Text = info; }[VB.NET]Private Sub btnInfoRetrieve_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnInfoRetrieve.Click Dim info As String Dim ms As New MEMORYSTATUS Dim si As New SYSTEM_INFO Dim sps As New SYSTEM_POWER_STATUS_EX Dim vi As New OSVERSIONINFO ' Retrieve the system information. myrapi.GetDeviceSystemInfo(si) ' Retrieve the device OS version number. myrapi.GetDeviceVersion(vi) ' Retrieve the device power status. myrapi.GetDeviceSystemPowerStatus(sps) ' Retrieve the device memory status. myrapi.GetDeviceMemoryStatus(ms) ' Format the retrieved information. info = "The connected device has an " Select Case si.wProcessorArchitecture Case ProcessorArchitecture.Intel info += "Intel processor." & vbCrLf Case ProcessorArchitecture.MIPS info += "MIPS processor." & vbCrLf Case ProcessorArchitecture.ARM info += "ARM processor." & vbCrLf Case Else info = "unknown processor type." & vbCrLf End Select info += "OS version: " & vi.dwMajorVersion & "." & vi.dwMinorVersion
& "." & vi.dwBuildNumber & vbCrLf info += "On AC power: " & IIf(sps.ACLineStatus = 1, "YES", "NO")
& vbCrLf info += "Battery level: " & sps.BatteryLifePercent & "%" & vbCrLf info += "Total memory: " & String.Format("{0:###,###,###}",
ms.dwTotalPhys) & vbCrLf ' Display the results. lblInfo.Text = info End Sub到這里我們如果將桌面應用程序加入到你的移動解決方案和關于Remote API的介紹就要告以段落了。我建議你花一些時間來檢驗OpenNETCF.Desktop.Communication命名空間提供的其他的功能。記住,那才是所有的操作,OpenNETCF命名空間為你的應用程序提供了多種類的操作。Back on the Road又是一個新的月份了。春天已經來到了每個角落,我要帶著我的滑水板和Pocket PC前往陽光充足的Florida。在我的下一篇文章里,我們將檢驗關于移動開發者更多的操作。



主站蜘蛛池模板: 三级亚洲 | 四虎在线精品 | 婷婷综合在线观看丁香 | 午夜黄色大片 | 欧美一页 | 日本不卡视频一区二区三区 | 日韩在线高清视频 | 午夜a级理论片在线播放 | 婷婷激情六月 | 日本精品网站 | 色18姝姝 | 亚洲国产成人资源在线桃色 | 午夜影院404| 沈樵在线观看福利 | 欧美婷婷综合 | 日韩丝袜亚洲国产欧美一区 | 在线观看亚洲一区二区 | 亚洲成a人v| 天天操天天干天天爽 | 欧美一级高清片在线 | 日韩黄色免费 | 中文国产成人久久精品小说 | 亚综合| 亚洲精品老司机福利在线播放 | 欧美伊人久久大香线蕉在观 | 三级三级三三级a级全黄 | 亚洲第一在线 | 亚洲国产精品久久卡一 | 日本三级香港三级三级人!妇久 | 天天射天天干天天舔 | 亚洲video| 午夜视频在线看 | 亚洲永久网站 | 日韩精品一区二区三区中文 | 婷婷激情六月 | 星辰影院在线观看高清免费观看 | 亚洲综合在线最大成人 | 特级中国aaa毛片 | 性久久久久久久 | 午夜久久久久久网站 | 日本一区二区三区免费高清在线 |