/// <summary> /// Backs the pressed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="BackPressedEventArgs"/> instance containing the event data.</param> public async void BackPressed(object sender, BackPressedEventArgs e) { // Handles any Back button presses. e.Handled = true; switch (Vars.WhatSocialNetwork) { case 0: { if (AllSocial0.CanGoBack) { AllSocial0.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 1: { if (AllSocial1.CanGoBack) { AllSocial1.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 2: { if (AllSocial2.CanGoBack) { AllSocial2.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 3: { if (AllSocial3.CanGoBack) { AllSocial3.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 4: { if (AllSocial4.CanGoBack) { AllSocial4.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } } }
/// <summary> /// Handles the Loaded event of the MainPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void MainPage_Loaded(object sender, RoutedEventArgs e) { HardwareButtons.BackPressed += BackPressed; SIDEBAR.Visibility = Visibility.Collapsed; Info.Visibility = Visibility.Collapsed; iconRotation.Begin(); SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) => { switch (Vars.WhatSocialNetwork) { case 0: { if (AllSocial0.CanGoBack) { AllSocial0.GoBack(); a.Handled = true; } break; } case 1: { if (AllSocial1.CanGoBack) { AllSocial2.GoBack(); a.Handled = true; } break; } case 2: { if (AllSocial2.CanGoBack) { AllSocial2.GoBack(); a.Handled = true; } break; } case 3: { if (AllSocial3.CanGoBack) { AllSocial3.GoBack(); a.Handled = true; } break; } case 4: { if (AllSocial4.CanGoBack) { AllSocial4.GoBack(); a.Handled = true; } break; } } }; SelectNetwork(0); }
/// <summary> /// Handles the Click event of the BACK control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private async void BACK_Click(object sender, RoutedEventArgs e) { switch (Vars.WhatSocialNetwork) { case 0: { if (AllSocial0.CanGoBack) { AllSocial0.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 1: { if (AllSocial1.CanGoBack) { AllSocial1.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 2: { if (AllSocial2.CanGoBack) { AllSocial2.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 3: { if (AllSocial3.CanGoBack) { AllSocial3.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } case 4: { if (AllSocial4.CanGoBack) { AllSocial4.GoBack(); } else { await Vars.displayMessageAsync("Quit " + Vars.AppName, "Are you sure you want to quit the app?", ""); } break; } } }