/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; ///phone , tablet, Xbox DeviceType = DeviceTypeHelper.GetDeviceType(); ///fake xbox app settings DeviceType = DeviceFormFactorType.Xbox; if (App.IsXbox) { ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; //size of your app on the xbox ApplicationView.PreferredLaunchViewSize = new Size(960, 540); this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested; } else { ApplicationView.PreferredLaunchViewSize = new Size(970, 768); } }
void Responsive() { var width = Window.Current.Bounds.Width; if (width < 800) { VisualStateManager.GoToState(this, nameof(Narrow), false); } else if (width < 1050) { VisualStateManager.GoToState(this, nameof(Medium), false); } else { VisualStateManager.GoToState(this, nameof(Full), false); } if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Tablet && AppViewHelper.GetFullscreen() == false) { VisualStateManager.GoToState(this, nameof(WindowState), false); } else { VisualStateManager.GoToState(this, nameof(FullscreenState), false); } Locator.MediaPlaybackViewModel.PlaybackService.SetSizeVideoPlayer((uint)Math.Ceiling(App.RootPage.SwapChainPanel.ActualWidth), (uint)Math.Ceiling(App.RootPage.SwapChainPanel.ActualHeight)); Locator.VideoPlayerVm.ChangeSurfaceZoom(Locator.VideoPlayerVm.CurrentSurfaceZoom); DisplayOrHide(true); }
private static bool IsNegativeSign(VirtualKey key) { var isNegativeSign = key == VirtualKey.Subtract || (int)key == DashKey; if (RadNumericBox.IsAzertyKeyboard) { isNegativeSign = isNegativeSign || (key == VirtualKey.Number6 && DeviceTypeHelper.GetDeviceType() != DeviceType.Phone); } return(isNegativeSign); }
public App() { InitializeComponent(); Suspending += OnSuspending; Container = AutoFacConfiguration.Configure(); if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox) { this.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; Locator.SettingsVM.MediaCenterMode = true; } }
public MainPage() { InitializeComponent(); var smtc = SystemMediaTransportControls.GetForCurrentView(); Locator.MediaPlaybackViewModel.SetMediaTransportControls(smtc); this.GotFocus += MainPage_GotFocus; this.Loaded += MainPage_Loaded; if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox) { Locator.HttpServer.bind(8080); } }
private static bool IsNumericKey(VirtualKey key) { DeviceType deviceType = DeviceTypeHelper.GetDeviceType(); bool isTablet = deviceType == DeviceType.Tablet; if (isTablet && key == VirtualKey.Shift && OnScreenKeyboardVisible) { IsInputPaneNumber = true; return(false); } if (RadNumericBox.IsAzertyKeyboard && key == VirtualKey.Number6 && deviceType != DeviceType.Phone) { bool keyModifierUsed = KeyboardHelper.IsModifierKeyDown(VirtualKey.Shift) ^ KeyboardHelper.IsModifierKeyLocked(VirtualKey.CapitalLock); if (isTablet) { if (IsInputPaneNumber) { IsInputPaneNumber = false; return(true); } else if (OnScreenKeyboardVisible) { return(false); } } return(keyModifierUsed); } if (isTablet && key != VirtualKey.Shift) { IsInputPaneNumber = false; } if (key >= VirtualKey.Number0 && key <= VirtualKey.Number9) { return(true); } if (key >= VirtualKey.NumberPad0 && key <= VirtualKey.NumberPad9) { return(true); } return(false); }
public void OnNavigatedTo() { // If no playback was ever started, ContinueIndexing can be null // If we navigate back and forth to the main page, we also don't want to // re-mark the task as completed. Locator.MediaLibrary.ContinueIndexing = new TaskCompletionSource <bool>(); DisplayHelper.PrivateDisplayCall(true); Locator.Slideshow.IsPaused = true; if (Locator.SettingsVM.ForceLandscape && DeviceTypeHelper.GetDeviceType() != DeviceTypeEnum.Xbox) { DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape; } if (Locator.MediaPlaybackViewModel.CurrentMedia is VideoItem) { Task.Run(async() => await UpdateCurrentVideo(Locator.MediaPlaybackViewModel.CurrentMedia as VideoItem)); } }
private static bool IsNumericKey(VirtualKey key) { if (RadNumericBox.IsAzertyKeyboard && key == VirtualKey.Number6 && DeviceTypeHelper.GetDeviceType() != DeviceType.Phone) { return(false); } if (key >= VirtualKey.Number0 && key <= VirtualKey.Number9) { return(true); } if (key >= VirtualKey.NumberPad0 && key <= VirtualKey.NumberPad9) { return(true); } return(false); }
private static bool IsNumericKey(VirtualKey key) { if (RadNumericBox.IsAzertyKeyboard && key == VirtualKey.Number6 && DeviceTypeHelper.GetDeviceType() != DeviceType.Phone) { return(KeyboardHelper.IsModifierKeyDown(VirtualKey.Shift) ^ KeyboardHelper.IsModifierKeyLocked(VirtualKey.CapitalLock)); } if (key >= VirtualKey.Number0 && key <= VirtualKey.Number9) { return(true); } if (key >= VirtualKey.NumberPad0 && key <= VirtualKey.NumberPad9) { return(true); } return(false); }
private void ArtistAlbumsSemanticView_Loaded(object sender, RoutedEventArgs e) { if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox) { (FindName(nameof(AlbumsArtistsListView)) as FrameworkElement).Visibility = Visibility.Visible; } else { (FindName(nameof(AlbumsSemanticZoom)) as FrameworkElement).Visibility = Visibility.Visible; } if (AlbumsListView != null) { AlbumsListView.SizeChanged += AlbumsListViewOnSizeChanged; } Locator.MusicLibraryVM.PropertyChanged += MusicLibraryVM_PropertyChanged; ResponsiveTracksListView(); ResponsiveAlbumsList(); this.Unloaded += ArtistAlbumsSemanticView_Unloaded; }
public void UpdatePlayerVisibility() { NowPlayingArtistGrid.Visibility = PlayPreviousButton.Visibility = PlayNextButton.Visibility = MiniPlayerVisibility; var shuffleButton = FindName(nameof(ShuffleButton)) as FrameworkElement; if (shuffleButton != null) { shuffleButton.Visibility = MiniPlayerVisibility; } var repeatButton = FindName(nameof(RepeatButton)) as FrameworkElement; if (repeatButton != null) { repeatButton.Visibility = MiniPlayerVisibility; } var miniWindowButton = FindName(nameof(MiniWindowButton)) as FrameworkElement; if (miniWindowButton != null) { if (DeviceTypeHelper.GetDeviceType() != DeviceTypeEnum.Tablet || UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Touch) { miniWindowButton.Visibility = Visibility.Collapsed; } else { miniWindowButton.Visibility = MiniPlayerVisibility; } } if (App.SplitShell.FooterVisibility != AppBarClosedDisplayMode.Hidden) { App.SplitShell.FooterVisibility = MiniPlayerVisibility == Visibility.Visible ? AppBarClosedDisplayMode.Compact : AppBarClosedDisplayMode.Minimal; } }
private void SettingsPage_Loaded(object sender, RoutedEventArgs e) { #if STARTS if (DeviceTypeHelper.GetDeviceType() != DeviceTypeEnum.Tablet) { foreach (var element in MusicSettingsPanel.Children) { if ((string)((FrameworkElement)element).Tag == "STARTS") { element.Visibility = Visibility.Collapsed; } } foreach (var element in VideoSettingsPanel.Children) { if ((string)((FrameworkElement)element).Tag == "STARTS") { element.Visibility = Visibility.Collapsed; } } } #endif AppThemeSwitch.Focus(FocusState.Programmatic); }
void SwitchLock() { isLocked = !isLocked; LockToggleIcon.Glyph = (isLocked) ? App.Current.Resources["LockedSymbol"].ToString() : App.Current.Resources["UnlockedSymbol"].ToString(); Slider.IsEnabled = !isLocked; SubtitlesButton.IsEnabled = !isLocked; PlayButton.IsEnabled = !isLocked; PauseButton.IsEnabled = !isLocked; VolumeSlider.IsEnabled = !isLocked; MenuButton.IsEnabled = !isLocked; if (Locator.SettingsVM.ForceLandscape && DeviceTypeHelper.GetDeviceType() != DeviceTypeEnum.Xbox) { DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape; } else if (isLocked) { DisplayInformation.AutoRotationPreferences = DisplayInformation.GetForCurrentView().CurrentOrientation; } else { DisplayInformation.AutoRotationPreferences = DisplayOrientations.None; } }
private void UpdateTrigger() { var activeDeviceType = ActiveDeviceType; SetActive(DeviceTypeHelper.GetDeviceType() == activeDeviceType); }