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);
        }
示例#2
0
 public App()
 {
     this.InitializeComponent();
     try
     {
         if (DeviceTypeHelper.GetDeviceFormFactorType().ToString() == "Xbox")
         {
             this.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested;
             //Test if xbox support reveal effect
             if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.FocusVisualKind"))
             {
                 try
                 {
                     this.FocusVisualKind = FocusVisualKind.Reveal;
                 }
                 catch
                 {
                     //Earlier version on Xbox than RS4 which does not support reveal effect
                 }
             }
         }
     }
     catch
     {
     }
     this.Suspending += OnSuspending;
 }
示例#3
0
        /// <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);
            }
        }
 private void Call(object obj)
 {
     if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone)
     {
         Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(Phone, Title);
     }
 }
示例#5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Xamarin.Forms.Forms.Init(e);

            await InitNotificationsAsync();

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    AppStatus.UserLogged = UserApiService.GetUserLogged();

                    if (AppStatus.UserLogged == null)
                    {
                        rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    }
                    else
                    {
                        AppShell appShell = new AppShell();

                        appShell.AppFrame.Navigate(typeof(HomePage), e.Arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());

                        Window.Current.Content = appShell;
                    }
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }

            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone)
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }
        }
示例#6
0
        private void loadState()
        {
            this.tgSound.IsOn   = App.Config.Sound;
            this.tgVibrate.IsOn = App.Config.Vibrate;

            this.deviceType = DeviceTypeHelper.GetDeviceFormFactorType();
        }
        public NavigationPage()
        {
            InitializeComponent();
            var device = DeviceTypeHelper.GetDeviceFormFactorType();

            if (device == DeviceFormFactorType.Phone || device == DeviceFormFactorType.IoT || device == DeviceFormFactorType.Other)
            {
                splitView.CompactPaneLength = 0;
            }
        }
示例#8
0
        private async Task TrySetMapViewWithMargin(BasicGeoposition pos, double boundingBoxZoomAdjustment, MapAnimationKind mapAnimation = MapAnimationKind.None)
        {
            double narrowZoomAdjustment = boundingBoxZoomAdjustment / 2;

            // Creators update changed maps a bit, so we need to zoom in closer on any device running it.
            // MapStyle is a decent proxy for "are we on Creators or not"
            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone &&
                !ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.Maps.MapStyle"))
            {
                narrowZoomAdjustment = boundingBoxZoomAdjustment / 1.35;
            }

            // Create a box surrounding the specified point to emulate a zoom level on the map.
            // We're using a simulated bounding box, because we need to be able to specify a margin,
            // to accommodate either of the the floating content panels.
            BasicGeoposition northwest = BasicGeopositionExtensions.Create
                                         (
                0.0,
                pos.Longitude - boundingBoxZoomAdjustment,
                pos.Latitude + boundingBoxZoomAdjustment
                                         );
            BasicGeoposition southeast = BasicGeopositionExtensions.Create
                                         (
                0.0,
                pos.Longitude + boundingBoxZoomAdjustment,
                pos.Latitude - boundingBoxZoomAdjustment
                                         );

            if (AdaptiveVisualStateGroup.CurrentState == _narrowVisualState)
            {
                // Zoom in a little further when in the narrow view, otherwise we're a little
                // too far out for the narrow field of view
                northwest.Longitude += narrowZoomAdjustment;
                northwest.Latitude  -= narrowZoomAdjustment;

                southeast.Longitude -= narrowZoomAdjustment;
                southeast.Latitude  += narrowZoomAdjustment;

                GeoboundingBox box = new GeoboundingBox(northwest, southeast);
                if (NarrowSearchPanel.IsOpen)
                {
                    double bottomMargin = NarrowSearchPanel.ExpandedHeight;
                    await PageMap.TrySetViewBoundsAsync(box, new Thickness(0, 0, 0, bottomMargin), mapAnimation);
                }
                else
                {
                    await PageMap.TrySetViewBoundsAsync(box, new Thickness(0, 0, 0, 0), mapAnimation);
                }
            }
            else
            {
                GeoboundingBox box = new GeoboundingBox(northwest, southeast);
                await PageMap.TrySetViewBoundsAsync(box, new Thickness(410, 0, 0, 0), mapAnimation);
            }
        }
示例#9
0
        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);
        }
示例#10
0
 public App()
 {
     InitializeComponent();
     Suspending += OnSuspending;
     Container   = AutoFacConfiguration.Configure();
     if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox)
     {
         this.RequiresPointerMode           = ApplicationRequiresPointerMode.WhenRequested;
         Locator.SettingsVM.MediaCenterMode = true;
     }
 }
示例#11
0
        private async void BtnFaceBookLogin_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            StartLoading();

            await ObjFBHelper.LoginAndContinue();

            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Desktop)
            {
                ContinueWithWebAuthenticationBroker(null);
            }
        }
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Xbox)
            {
                SettingsForXbox();
            }

            if (!args.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(args);
            }
        }
        public async Task LoginAndContinue()
        {
            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Desktop)
            {
                WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, _loginUrl);

                ValidateAndProccessResult(result);
            }
            else
            {
                WebAuthenticationBroker.AuthenticateAndContinue(_loginUrl);
            }
        }
示例#14
0
        public MapDetailsControl()
        {
            this.InitializeComponent();

            if (DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Phone &&
                DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Tablet)
            {
                CurrentLocation.Visibility = Visibility.Collapsed;
            }

            _mapCurrentLocationIcon       = new MapIcon();
            _mapCurrentLocationIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Icons/curlocation-marker.png"));
        }
示例#15
0
        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // TODO: add your long-running task here
            // DB init - to fix
            if (firstInit)
            {
                firstInit = false;
                using (var db = new LocalContext())
                {
                    try
                    {
                        db.Database.Migrate();
                    }
                    catch (Exception)
                    {
                        // first time exception
                    }
                    await db.InitMigrateAsync();
                }
                Init();
            }

            // Get Device Type
            SettingsService.Instance.DeviceType = DeviceTypeHelper.GetDeviceFormFactorType();

            // Check for connection
            SettingsService.Instance.CheckConnections();

            Views.Shell.HamburgerMenu.IsFullScreen = true;

            if (args.Kind == ActivationKind.Protocol)
            {
                var protocolUri = (args as ProtocolActivatedEventArgs).Uri;
                var token       = await DataUtils.TryGetToken(protocolUri);

                if (!string.IsNullOrWhiteSpace(token))
                {
                    await PassportService.Instance.GetProfileData(token);
                }
            }
            if (SettingsService.Instance.CurrentUserData?.CanUse() ?? false)
            {
                Views.Shell.HamburgerMenu.IsFullScreen = false;
                await NavigationService.NavigateAsync(typeof(Views.MainPage));
            }
            else
            {
                await NavigationService.NavigateAsync(typeof(Views.LoginPage));
            }
        }
示例#16
0
        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);
            }
        }
示例#17
0
        private void NavCommandBar_Unloaded(object sender, RoutedEventArgs e)
        {
            Views.Busy.BusyChanged             -= BusyView_BusyChanged;
            _navigationService.Frame.Navigated -= Frame_Navigated;
            this.UnregisterPropertyChangedCallback(IsOpenProperty, _isOpenCallbackToken);
            this.SizeChanged -= NavCommandBar_SizeChanged;
            this.PrimaryCommands.VectorChanged   -= PrimaryCommands_VectorChanged;
            this.SecondaryCommands.VectorChanged -= SecondaryCommands_VectorChanged;

            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone)
            {
                InputPane.GetForCurrentView().Showing -= InputPane_Showing;
                InputPane.GetForCurrentView().Hiding  -= InputPane_Hiding;
            }
        }
示例#18
0
        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);
        }
示例#19
0
        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));
            }
        }
示例#20
0
        public StepThroughListView()
        {
            InitializeComponent();
            if (DeviceTypeHelper.GetDeviceFormFactorType() == Core.Enums.DeviceFormFactorType.Xbox)
            {
                ButtonLeft.Visibility  = Visibility.Collapsed;
                ButtonRight.Visibility = Visibility.Collapsed;
            }
            else
            {
                if (AlwaysShowButton == Visibility.Visible)
                {
                    ButtonLeft.Visibility  = Visibility.Visible;
                    ButtonRight.Visibility = Visibility.Visible;
                }
            }

            SizeChanged += StepThroughListView_SizeChanged;
        }
示例#21
0
        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);
        }
示例#22
0
        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);
        }
示例#23
0
        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;
            }
        }
示例#25
0
        private void NavCommandBar_Loaded(object sender, RoutedEventArgs e)
        {
            Views.Busy.BusyChanged             += BusyView_BusyChanged;
            _navigationService.Frame.Navigated += Frame_Navigated;

            /* AppBarButtons displayed in the NavigationButtons StackPanel won't have their Label
             * Visibility updated automatically when the AppBar opens. So instead, we listen directly
             * to the IsOpen property, and when it changes, we update each button's IsCompact property
             * accordingly. */
            _isOpenCallbackToken = this.RegisterPropertyChangedCallback(IsOpenProperty, new DependencyPropertyChangedCallback(IsOpenChanged));
            this.SizeChanged    += NavCommandBar_SizeChanged;
            this.PrimaryCommands.VectorChanged   += PrimaryCommands_VectorChanged;
            this.SecondaryCommands.VectorChanged += SecondaryCommands_VectorChanged;

            /*Arbitary value. I figure with a target of 60FPS, it's not unreasonabe to expect
             * simultaneous visibility changes to propagate within ~20 frames of each other. */
            _visibilityChangedThrottle.Interval = TimeSpan.FromMilliseconds(5.34);
            _visibilityChangedThrottle.Tick    += (s, args) =>
            {
                ReflowCommands(RenderSize, RenderSize);
                _visibilityChangedThrottle.Stop();
            };

            UpdateNavSeparatorVisibility();
            this.UpdateLayout();

            UpdateSelectionVisual(); // Call this once first, to make sure that _currentlySelected gets populated before we start Reflow()ing.
            ReflowCommands(this.RenderSize, this.RenderSize);
            UpdateSelectionVisual();

            UpdateButtonLabels(IsOpen);
            UpdateCommandsVisibilityTracking(this.PrimaryCommands);
            UpdateCommandsVisibilityTracking(this.SecondaryCommands);

            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone)
            {
                InputPane.GetForCurrentView().Showing += InputPane_Showing;
                InputPane.GetForCurrentView().Hiding  += InputPane_Hiding;
            }
        }
示例#26
0
        public MainPage()
        {
            this.InitializeComponent();

            ShowStatusBar();

            if (DeviceTypeHelper.GetDeviceFromFactorType() == DeviceFromFactorType.Phone)
            {
                Debug.WriteLine("current:" + _currentViewHeight + "; initial:" + InitialViewHeight + ";  BarStatus:" + IsSystemVirtualButtonBarShow);

                ApplicationView.GetForCurrentView().VisibleBoundsChanged += (sender, e) =>
                {
                    _currentViewHeight = ApplicationView.GetForCurrentView().VisibleBounds.Height;

                    Debug.WriteLine("current:" + _currentViewHeight + "; initial:" + InitialViewHeight + ";  BarStatus:" + IsSystemVirtualButtonBarShow);

                    MessagingCenter.Send <YahooTWBuy.Pages.MainPage, bool>((YahooTWBuy.Pages.MainPage)MainApp.MainPage,
                                                                           "UWP_SystemVirtualButtonBarStatus", IsSystemVirtualButtonBarShow);
                };
            }

            LoadApplication(MainApp);
        }
示例#27
0
        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;
            }
        }
示例#29
0
        public async Task TrySetViewBoundsAsync(GeoboundingBox bounds, Thickness?margin, MapAnimationKind animation, bool retryOnFailure = false)
        {
            if (DigiTransitMapControl == null)
            {
                return;
            }

            // We're checking for the MapStyle type as a proxy for "are we running on Creators or higher?".
            // We don't need to run the following code if we are.
            if (margin != null &&
                !ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.Maps.MapStyle") &&
                DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Phone)
            {
                //Margins are a little smaller on desktop for some reason. investigate this a little further, may just be a DPI thing?
                const int desktopPlusCoeff = 40;
                margin = new Thickness(margin.Value.Left + desktopPlusCoeff, margin.Value.Top + desktopPlusCoeff,
                                       margin.Value.Right + desktopPlusCoeff, margin.Value.Bottom + desktopPlusCoeff);
            }

            //If map movement fails, keep retrying until we get it right
            bool moved = false;

            do
            {
                moved = await DigiTransitMapControl.TrySetViewBoundsAsync(bounds, margin, animation);

                if (moved)
                {
                    break;
                }
                else
                {
                    await Task.Delay(2000); //looong delay to acommodate slow mobile rendering
                }
            } while (!moved && retryOnFailure);
        }
示例#30
0
 /// <summary>
 /// 初始设备分类
 /// </summary>
 private void InitDeviceType()
 {
     DeviceTypeHelper.InitDeviceTypes(treeList1);
 }