本文整理汇总了C#中Windows.UI.Xaml.Controls.Page.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Page.GetType方法的具体用法?C# Page.GetType怎么用?C# Page.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Controls.Page
的用法示例。
在下文中一共展示了Page.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PageState
private Windows.Foundation.Collections.IPropertySet PageState(Page page)
{
if (page == null)
{
throw new ArgumentNullException(nameof(page));
}
return NavigationService.Suspension.GetPageState(page.GetType()).Values;
}
示例2: _textBox_TextChanged
private void _textBox_TextChanged(object sender, TextChangedEventArgs e)
{
_page = _page ?? _textBox.Ancestor<Page>();
var field = _page.GetType().GetTypeInfo().GetDeclaredField("Bindings");
var bindings = field?.GetValue(_page);
var update = bindings?.GetType().GetRuntimeMethod("Update", new Type[] { });
//update?.Invoke(bindings, null);
}
示例3: NavigationHelper
/// <summary>
/// Initializes a new instance of the <see cref="NavigationHelper"/> class.
/// </summary>
/// <param name="page">A reference to the current page used for navigation.
/// This reference allows for frame manipulation and to ensure that keyboard
/// navigation requests only occur when the page is occupying the entire window.</param>
public NavigationHelper(Page page)
{
Page = page;
// When this page is part of the visual tree make two changes:
// 1) Map application view state to visual state for the page
// 2) Handle hardware navigation requests
Page.Loaded += (sender, e) =>
{
KernelResolver.Current.Get<INavigationMediator>().RaisePageLoaded(Page.GetType());
#if WINDOWS_PHONE_APP
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
#else
// Keyboard and mouse navigation only apply when occupying the entire window
if (this.Page.ActualHeight == Window.Current.Bounds.Height &&
this.Page.ActualWidth == Window.Current.Bounds.Width)
{
// Listen to the window directly so focus isn't required
Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=
CoreDispatcher_AcceleratorKeyActivated;
Window.Current.CoreWindow.PointerPressed +=
this.CoreWindow_PointerPressed;
}
#endif
};
// Undo the same changes when the page is no longer visible
Page.Unloaded += (sender, e) =>
{
#if WINDOWS_PHONE_APP
Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
#else
Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -=
CoreDispatcher_AcceleratorKeyActivated;
Window.Current.CoreWindow.PointerPressed -=
this.CoreWindow_PointerPressed;
#endif
};
}
示例4: Update
public static void Update(Page p, string s)
{
p.Frame.Navigate(p.GetType(), s);
}
示例5: SignIn
//.........这里部分代码省略.........
//#if WINDOWS_PHONE_APP
// await
// App.MobileService.GetTable<User>()
// .InsertAsync(new User
// {
// AuthExpired = false,
// NewUser = true,
// DeviceIdent = App.DeviceIdent,
// SnapchatAuthToken = App.SnapChatManager.AuthToken,
// SnapchatUsername = App.SnapChatManager.Username
// });
//#endif
// return;
try
{
if (string.IsNullOrEmpty(CurrentUsername) || string.IsNullOrEmpty(CurrentPassword))
{
var dialog =
new MessageDialog(App.Loader.GetString("InvalidCredentialsBody"), App.Loader.GetString("InvalidCredentialsHeader"));
await dialog.ShowAsync();
return;
}
#if WINDOWS_PHONE_APP
// Tell UI we're Signing In
StatusBar.GetForCurrentView().ProgressIndicator.Text = App.Loader.GetString("SigningIn");
await StatusBar.GetForCurrentView().ProgressIndicator.ShowAsync();
#endif
ProgressModalVisibility = Visibility.Visible;
ProgressModalIsVisible = true;
// Try and log into SnapChat
await App.SnapChatManager.Endpoints.AuthenticateAsync(CurrentUsername, CurrentPassword);
// This is unnecessary here and slows down the sign in process significantly. xoxo, Matt
/*try
{
await App.SnapChatManager.UpdateAllAsync(() => { }, App.Settings);
}
catch (InvalidHttpResponseException exception)
{
if (exception.Message == "Unauthorized")
{
var dialog = new MessageDialog(App.Loader.GetString("UnauthorizedBody"), App.Loader.GetString("UnauthorizedHeader"));
dialog.ShowAsync();
}
}*/
#if WINDOWS_PHONE_APP
// Register device for Push Notifications
await
App.MobileService.GetTable<User>()
.InsertAsync(new User
{
AuthExpired = false,
NewUser = true,
DeviceIdent = App.DeviceIdent,
SnapchatAuthToken = App.SnapChatManager.AuthToken,
SnapchatUsername = App.SnapChatManager.Username
});
#endif
}
catch (InvalidCredentialsException)
{
var dialog =
new MessageDialog(App.Loader.GetString("InvalidCredentialsBody"), App.Loader.GetString("InvalidCredentialsHeader"));
dialog.ShowAsync();
}
catch (InvalidHttpResponseException exception)
{
var dialog =
new MessageDialog(String.Format("{0} \n {1}.", App.Loader.GetString("InvalidHttpBody"), exception.Message),
App.Loader.GetString("InvalidHttpHeader"));
dialog.ShowAsync();
}
finally
{
// Tell UI we're not Signing In no mo'
#if WINDOWS_PHONE_APP
StatusBar.GetForCurrentView().ProgressIndicator.Text = String.Empty;
StatusBar.GetForCurrentView().ProgressIndicator.HideAsync();
#endif
ProgressModalVisibility = Visibility.Collapsed;
ProgressModalIsVisible = false;
}
if ( App.SnapChatManager.Account == null ||
!App.SnapChatManager.Account.Logged ||
!App.SnapChatManager.IsAuthenticated())
{
#if WINDOWS_PHONE_APP
CurrentPassword = "";
//App.CurrentFrame.Navigate(typeof(StartPage), "removeBackStack");
#endif
return;
}
App.CurrentFrame.Navigate(nextPage == null ? typeof(MainPage) : nextPage.GetType(), "removeBackStack");
}
示例6: Navigate
public void Navigate(Page destination, string parameter = null)
{
Page page = MyFrame?.Content as Page;
var @switch = new Dictionary<Type, Action> {
{ typeof(HomePage), () => {
if (page?.GetType() != typeof(HomePage))
{
MainPageViewModel.PageTitle = "Home";
MyFrame?.Navigate(typeof(HomePage));
}
} },
{ typeof(ProfilePage), () =>
{
if (page?.GetType() != typeof(ProfilePage))
{
MainPageViewModel.PageTitle = "Profile";
if (parameter != null)
{
int id = Convert.ToInt32(parameter);
UserId = id;
MyFrame?.Navigate(typeof(ProfilePage));
UserIdHistory.Add(id);
}
}
} },
{ typeof(FollowerPage), () =>
{
if (page?.GetType() != typeof(FollowerPage))
{
MainPageViewModel.PageTitle = "Followers";
if (parameter != null)
{
int id = Convert.ToInt32(parameter);
UserId = id;
MyFrame?.Navigate(typeof(FollowerPage));
UserIdHistory.Add(id);
}
}
} },
{ typeof(FollowingPage), () =>
{
if (page?.GetType() != typeof(FollowingPage))
{
MainPageViewModel.PageTitle = "Following";
if (parameter != null)
{
int id = Convert.ToInt32(parameter);
UserId = id;
MyFrame?.Navigate(typeof(FollowingPage));
UserIdHistory.Add(id);
}
}
} },
{ typeof(SearchPage), () =>
{
if (page?.GetType() != typeof(SearchPage))
{
MainPageViewModel.PageTitle = parameter;
MyFrame?.Navigate(typeof(SearchPage), parameter);
}
} },
{ typeof(PlaylistPage), () =>
{
if (page?.GetType() != typeof(PlaylistPage))
{
MainPageViewModel.PageTitle = "Playlist";
MyFrame?.Navigate(typeof(PlaylistPage));
}
} },
{ typeof(PlaylistViewPage), () =>
{
if (page?.GetType() != typeof(PlaylistViewPage))
{
MainPageViewModel.PageTitle = "Playlist";
MyFrame?.Navigate(typeof(PlaylistViewPage), parameter);
}
} }
};
@switch[destination.GetType()]();
if (ActualWidth < 720 && SplitViewMenu.IsPaneOpen)
{
SplitViewMenu.IsPaneOpen = false;
}
}