C++:要使用什么类型的标识符?
C++ : What type of Identifier to be used?
我无法确定要在以下代码中使用的标识符类型。我从 Microsoft UWP blog
中获取了代码示例
但我似乎无法理解如何实现它?
所以请帮我把它弄好。谢谢
stackCount // is undefined in following code.
void StartPage::OnNavigatedTo(NavigationEventArgs^ e)
{
auto rootFrame = dynamic_cast<Windows::UI::Xaml::Controls::Frame^>(Window::Current->Content);
Platform::String^ myPages = "";
if (rootFrame == nullptr)
return;
for each (PageStackEntry^ page in rootFrame->BackStack)
{
myPages += page->SourcePageType.ToString() + "\n";
}
stackCount->Text = myPages; // stackCount is undefined here
if (rootFrame->CanGoBack)
{
// If we have pages in our in-app backstack and have opted in to showing back, do so
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility =
Windows::UI::Core::AppViewBackButtonVisibility::Visible;
}
else
{
// Remove the UI from the title bar if there are no pages in our in-app back stack
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility =
Windows::UI::Core::AppViewBackButtonVisibility::Collapsed;
}
}
假定 stackCount
是多行 TextBlock
,因为示例设置了 Text
属性。将其添加到您的 XAML 页面。
我无法确定要在以下代码中使用的标识符类型。我从 Microsoft UWP blog
中获取了代码示例但我似乎无法理解如何实现它? 所以请帮我把它弄好。谢谢
stackCount // is undefined in following code.
void StartPage::OnNavigatedTo(NavigationEventArgs^ e)
{
auto rootFrame = dynamic_cast<Windows::UI::Xaml::Controls::Frame^>(Window::Current->Content);
Platform::String^ myPages = "";
if (rootFrame == nullptr)
return;
for each (PageStackEntry^ page in rootFrame->BackStack)
{
myPages += page->SourcePageType.ToString() + "\n";
}
stackCount->Text = myPages; // stackCount is undefined here
if (rootFrame->CanGoBack)
{
// If we have pages in our in-app backstack and have opted in to showing back, do so
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility =
Windows::UI::Core::AppViewBackButtonVisibility::Visible;
}
else
{
// Remove the UI from the title bar if there are no pages in our in-app back stack
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility =
Windows::UI::Core::AppViewBackButtonVisibility::Collapsed;
}
}
假定 stackCount
是多行 TextBlock
,因为示例设置了 Text
属性。将其添加到您的 XAML 页面。