示例#1
0
        private async Task FetchAndInsertItemsAsync(int updateCount)
        {
            if (_lines == null)
            {
                // Not initialized yet.
                return;
            }

            // Show the status bar progress indicator, if available.
            Windows.UI.ViewManagement.StatusBar statusBar = null;
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
            }

            if (statusBar != null)
            {
                var task = statusBar.ProgressIndicator.ShowAsync();
            }

            // Simulate delay while we go fetch new items.
            await Task.Delay(500);

            for (int i = 0; i < updateCount; ++i)
            {
                Items.Insert(0, GetNextItem());
            }

            if (statusBar != null)
            {
                var task = statusBar.ProgressIndicator.HideAsync();
            }
        }
示例#2
0
        public AboutPage()
        {
            this.InitializeComponent();

            /*Color bgColor = InTheHand.ApplicationModel.Package.Current.BackgroundColor;
             * if (bgColor != Colors.Transparent)
             * {
             *  Color modColor = Color.FromArgb((byte)0xff, (byte)(bgColor.R / 3), (byte)(bgColor.G / 3), (byte)(bgColor.B / 3));
             *  this.Background = new SolidColorBrush(modColor);
             * }*/
#if WINDOWS_UWP || WINDOWS_PHONE_APP
            Windows.UI.ViewManagement.StatusBar sb = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
            if (sb != null)
            {
                previousBackground        = sb.BackgroundColor;
                previousForeground        = sb.ForegroundColor;
                previousBackgroundOpacity = sb.BackgroundOpacity;
                sb.BackgroundColor        = InTheHand.ApplicationModel.Package.Current.BackgroundColor;
                sb.BackgroundOpacity      = 1.0;
                sb.ForegroundColor        = Colors.White;
            }
#endif

#if WINDOWS_UWP
            SystemNavigationManager.GetForCurrentView().BackRequested += AboutPage_BackRequested;
#elif WINDOWS_PHONE_APP
            Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
#endif
            this.Loaded   += AboutPage_Loaded;
            this.Unloaded += AboutPage_Unloaded;
        }
示例#3
0
        /// <summary>
        /// Gets the status bar for the current window (app view).
        /// </summary>
        /// <returns></returns>
        public static StatusBar GetForCurrentView()
        {
#if WINDOWS_UWP
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                return(new StatusBar(Windows.UI.ViewManagement.StatusBar.GetForCurrentView()));
            }
            else
            {
                var t = Launcher.QueryUriSupportAsync(new Uri("taskbarprogress:///"), LaunchQuerySupportType.Uri).AsTask();
                t.Wait();
                var r = t.Result;
                if (r == LaunchQuerySupportStatus.Available)
                {
                    return(new StatusBar());
                }
            }

            return(null);
#elif WINDOWS_PHONE_APP
            return(new StatusBar(Windows.UI.ViewManagement.StatusBar.GetForCurrentView()));
#else
            if (_statusBar == null)
            {
                _statusBar = new StatusBar();
            }

            return(_statusBar);
#endif
        }
示例#4
0
 async private void HideSts()
 {
     if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
     {
         Windows.UI.ViewManagement.StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
         await statusBar.HideAsync();
     }
 }
 private async void HideStatusBar()
 {
     if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
     {
         Windows.UI.ViewManagement.StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
         await statusBar.HideAsync();
     }
 }
示例#6
0
        /// <summary>
        /// Tries to display the status bar
        /// </summary>
        /// <returns>The occluded height if the operation succedes</returns>
        public static async Task <double> TryShowAsync()
        {
            StatusBar statusBar = GetCurrentStatusBarAsync();

            if (statusBar == null)
            {
                return(0);
            }
            statusBar.BackgroundColor = null;
            await statusBar.ShowAsync();

            return(statusBar.OccludedRect.Height);
        }
示例#7
0
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            UnregisterBack();
#if WINDOWS_UWP
            Windows.UI.ViewManagement.StatusBar sb = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
            if (sb != null)
            {
                sb.BackgroundColor   = _previousBackground;
                sb.BackgroundOpacity = _previousBackgroundOpacity;
                sb.ForegroundColor   = _previousForeground;
            }
#endif

            base.OnNavigatingFrom(e);
        }
示例#8
0
        public Shell(Frame frame)
        {
            this.InitializeComponent();
            this.ShellSplitView.Content = frame;
            frame.Navigated            += Frame_Navigated;
            this.DataContext            = this;
            ViewModel = new ShellViewModel();

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
            else
            {
                backButton.Click += BackButton_Click;
            }

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                Windows.UI.ViewManagement.StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusBar.HideAsync();
            }
        }
示例#9
0
 private async void HideStatusBar()
 {
     Windows.UI.ViewManagement.StatusBar bar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
     await bar.HideAsync();
 }
示例#10
0
 private static StatusBar GetCurrentStatusBarAsync()
 {
     return(ApiInformation.IsTypePresent(StatusBarString) ? StatusBar.GetForCurrentView() : null);
 }
示例#11
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 async protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     // Hide Status bar
     Windows.UI.ViewManagement.StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
     await statusBar.HideAsync();
 }
示例#12
0
 //mobile
 internal StatusBar(Windows.UI.ViewManagement.StatusBar statusBar)
 {
     _statusBar = statusBar;
 }