标签:des blog http 使用 os io for ar
本文章的基础是:新建 WinCE7.0 下的 Silverlight 工程(http://blog.csdn.net/91program/article/details/36675607)HRESULT MainPage::InitializeComponent() { HRESULT hr = E_FAIL; m_clickDelegate = NULL; FindName(L"LayoutRoot", &m_pLayoutRoot); FindName(L"Gird_Layer_Source", &m_pGird_Layer_Source); if (m_pLayoutRoot && m_pGird_Layer_Source) { hr = S_OK; } return hr; }
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WinEmbeddedHelloWorld" x:Class="WinEmbeddedHelloWorld.MainPage" Width="800" Height="480"> <Grid x:Name="LayoutRoot" Background="Black"> <Grid x:Name="Gird_Layer_Source" Margin="0,0,0,0"> </Grid> </Grid> </UserControl>
HRESULT App::RegisterUserControls() { HRESULT hr = S_OK; static PFN_XRCUC_REGISTER pfn[] = { &MainPage::Register, &SecondPage::Register, }; for (int i=0; i<_countof(pfn) && SUCCEEDED(hr); i++) { hr = pfn[i](); if (FAILED(hr)) { RETAILMSG(1,(L"RegisterUserControls failed.")); } } return hr; } // RegisterUserControls
IXRGridPtr gpMainLayer = NULL;
HRESULT App::CreateHost(XRWindowCreateParams* pCreateParams) { XRPtr<IXRCustomUserControl> pControl; HRESULT hr = E_FAIL; hr = m_pApplication->CreateObject(__uuidof(MainPage),&pControl); if (SUCCEEDED(hr)) { hr = m_pApplication->CreateHostFromElementTree(pControl, pCreateParams, &m_pVisualHost); } IXRApplication *pApp = NULL; App::GetApplication(&pApp); IXRCustomUserControl *p1 = (IXRCustomUserControl *)pControl; MainPage *pMainPage = dynamic_cast<MainPage *>(p1); gpMainLayer = pMainPage->m_pGird_Layer_Source; // 记录显示的基础 Grid pMainPage = NULL; return hr; }
HRESULT App::OnStartup() { HRESULT hr = S_OK; IXRFrameworkElementPtr pRoot; hr = m_pVisualHost->GetRootElement(&pRoot); if (SUCCEEDED(hr)) { // TODO: Add one time initialization code here. } // Leo 测试页面显示, 即页面切换(从 MainPage 切换到 SecondPage) if(NULL != gpMainLayer) { XRPtr<SecondPage> pSwitchPage = NULL; IXRUIElementCollection *pChildList = NULL; gpMainLayer->GetChildren(&pChildList); if(NULL == pChildList) { return NULL; } { HRESULT hr = m_pApplication->CreateObject(__uuidof(SecondPage),&pSwitchPage); if(SUCCEEDED(hr) && NULL != pSwitchPage) { // pSwitchPage->OnLoad(); pChildList->Add(pSwitchPage,NULL); } } } return hr; } // OnStartup
<UserControl 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" x:Class="WinEmbeddedHelloWorld.SecondPage" d:DesignWidth="640" d:DesignHeight="480" Width="800"> <Grid x:Name="LayoutRoot" Background="Green"> <Button Height="38" HorizontalAlignment="Left" Margin="65,54,0,0" VerticalAlignment="Top" Width="177" Content="Second Page"/> <Button Height="38" HorizontalAlignment="Left" Margin="65,117,0,0" VerticalAlignment="Top" Width="177" Content="Origin Prj"/> </Grid> </UserControl>
Silverlight For WinEmbedded 的页面切换实现,布布扣,bubuko.com
Silverlight For WinEmbedded 的页面切换实现
标签:des blog http 使用 os io for ar
原文地址:http://blog.csdn.net/91program/article/details/38705923