private void MainPage_SizeChanged(object sender, SizeChangedEventArgs e) { // Manage the system tray in landscape mode Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { bool portrait = ApplicationView.GetForCurrentView().Orientation == ApplicationViewOrientation.Portrait; if (portrait) { if (SettingsService.Get <bool>(SettingsKeys.HideSystemTray)) { SystemTrayManager.HideAsync()?.AsTask().Forget(); } else { SystemTrayManager.TryShowAsync().Forget(); } } else { SystemTrayManager.HideAsync()?.AsTask().Forget(); } }).AsTask().Forget(); if (e.NewSize.Width < 720) { if (ViewModel.isLoggedin) { BottomAppBar.Visibility = Visibility.Visible; } else { BottomAppBar.Visibility = Visibility.Collapsed; } } }
public MainPage() { this.Loaded += (s, e) => { if (SettingsService.Get <bool>(SettingsKeys.HideSystemTray)) { SystemTrayManager.HideAsync().AsTask().Forget(); } else { SystemTrayManager.TryShowAsync().Forget(); } }; this.InitializeComponent(); ViewModel = new MainViewmodel(); this.DataContext = ViewModel; SizeChanged += MainPage_SizeChanged; //Listening for No Internet message Messenger.Default.Register <NoInternetMessageType>(this, ViewModel.RecieveNoInternetMessage); //Listening Internet available message Messenger.Default.Register <HasInternetMessageType>(this, ViewModel.RecieveInternetMessage); //Setting Header Text to the current page name Messenger.Default.Register(this, delegate(SetHeaderTextMessageType m) { setHeadertext(m.PageName); }); SimpleIoc.Default.Register <IAsyncNavigationService>(() => { return(new NavigationService(mainFrame)); }); NavigationCacheMode = NavigationCacheMode.Enabled; SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested; }