本文整理匯總了C#中BackPressedEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# BackPressedEventArgs類的具體用法?C# BackPressedEventArgs怎麽用?C# BackPressedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BackPressedEventArgs類屬於命名空間,在下文中一共展示了BackPressedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e) {
var rootFrame = Window.Current.Content as Frame;
if (rootFrame != null && rootFrame.CanGoBack) {
rootFrame.GoBack();
e.Handled = true;
}
}
示例2: HardwareButtons_BackPressed
async void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (this.Frame.SourcePageType.FullName == "StatusUp.MainPage")
{
e.Handled = true;
// Create the message dialog and set its content
var messageDialog = new MessageDialog("Close Application?");
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
messageDialog.Commands.Add(new UICommand(
"Yes",
new UICommandInvokedHandler(this.CommandInvokedHandler)));
messageDialog.Commands.Add(new UICommand(
"No",
new UICommandInvokedHandler(this.CommandInvokedHandler)));
// Set the command that will be invoked by default
messageDialog.DefaultCommandIndex = 0;
// Set the command to be invoked when escape is pressed
messageDialog.CancelCommandIndex = 1;
// Show the message dialog
try
{
messageDialog.ShowAsync();
}
catch { }
}
}
示例3: HardwareButtons_BackPressed
protected void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
e.Handled = true;
//We need this to handle backpress in ViewModels
if (this.DataContext is BaseViewModel)
(this.DataContext as BaseViewModel).GoBack();
}
示例4: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
e.Handled = true;
if (CurrentPage == VLCPage.MainPageHome)
e.Handled = false;
GoBack_Specific();
}
示例5: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (Frame.CanGoBack) {
e.Handled = true;
Frame.GoBack();
}
}
示例6: HardwareButtons_BackPressed
void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e) {
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame != null && rootFrame.CanGoBack) {
rootFrame.Navigate(typeof(PollutionReportPage));
e.Handled = true;
}
}
示例7: HardwareButtons_BackPressed_DetailPage
async void HardwareButtons_BackPressed_DetailPage(object sender, BackPressedEventArgs e)
{
e.Handled = true;
if (string.IsNullOrEmpty(ViewModel.Tasks.Title))
{
NavigateHelper.NavigateToPage(typeof(MainPage));
return;
}
//此處最好進行一個判斷,是更新還是新增操作,然後進行相關的數據庫操作
Task taskNeedAwait = null;
FrameTransitionParam param = new FrameTransitionParam();
if (this.IsNavigateForUpdate)//true表示更新
{
// 修改的數據
param.UpdateTasks = ViewModel.Tasks;
taskNeedAwait = ViewModel.UpdateTasks();
}
else//false 表示新增
{
param.NewTasks = ViewModel.Tasks;
taskNeedAwait = ViewModel.AddTasks();
}
// 在跳轉前取消注冊
HardwareButtons.BackPressed -= HardwareButtons_BackPressed_DetailPage;
NavigateHelper.NavigateToPageWithParam(typeof(MainPage), param);
await taskNeedAwait;
}
示例8: HardwareButtonsOnBackPressed
private void HardwareButtonsOnBackPressed(object sender, BackPressedEventArgs backPressedEventArgs)
{
if (ViewModel.IsSignInPageVisible)
{
var storyboard = (Storyboard)Resources["SignInModalHideStoryboard"];
if (storyboard == null) return;
storyboard.Begin();
ViewModel.GoBackToStartCommand.Execute(null);
backPressedEventArgs.Handled = true;
}
if (ViewModel.IsRegisterPageVisible)
{
var storyboard = (Storyboard)Resources["RegistrationModalHideStoryboard"];
if (storyboard == null) return;
storyboard.Begin();
ViewModel.GoBackToStartCommand.Execute(null);
backPressedEventArgs.Handled = true;
}
if (ViewModel.IsCaptchaPageVisible)
{
var storyboard = (Storyboard)Resources["CaptchaModalHideStoryboard"];
if (storyboard == null) return;
storyboard.Begin();
ViewModel.GoBackToStartCommand.Execute(null);
backPressedEventArgs.Handled = true;
}
}
示例9: OnBackPress
private void OnBackPress(object sender, BackPressedEventArgs e)
{
e.Handled = true;
if (Frame.CanGoBack)
Frame.GoBack();
}
示例10: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (Frame.BackStackDepth == 0)
{
Application.Current.Exit();
}
}
示例11: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (!e.Handled)
{
e.Handled = true;
Task t = BackButtonPressed();
}
}
示例12: HardwareButtons_BackPressed
void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (appBarToggleButton.IsChecked == true)
{
appBarToggleButton.IsChecked = false;
e.Handled = true;
}
}
示例13: HardwareButtons_BackPressed
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (InstanceMessageService.RootFrame != null && InstanceMessageService.RootFrame.CanGoBack)
{
e.Handled = true;
InstanceMessageService.RootFrame.GoBack();
}
}
示例14: OnBackPressed
public void OnBackPressed(object sender, BackPressedEventArgs e)
{
if (Frame.CanGoBack)
{
e.Handled = true;
Frame.GoBack();
}
}
示例15: HardwareButtons_BackPressed
void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
if (VideoViewComboBox.IsDropDownOpen)
{
VideoViewComboBox.IsDropDownOpen = false;
e.Handled = true;
}
}