internal Platform(global::Windows.UI.Xaml.Controls.Page page) { if (page == null) { throw new ArgumentNullException(nameof(page)); } _page = page; var current = global::Windows.UI.Xaml.Application.Current; if (!current.Resources.ContainsKey("RootContainerStyle")) { global::Windows.UI.Xaml.Application.Current.Resources.MergedDictionaries.Add(System.Maui.Maui.GetTabletResources()); } #if !UWP_14393 if (!current.Resources.ContainsKey(ShellRenderer.ShellStyle)) { var myResourceDictionary = new global::Windows.UI.Xaml.ResourceDictionary(); myResourceDictionary.Source = new Uri("ms-appx:///System.Maui.Platform.UAP/Shell/ShellStyles.xbf"); global::Windows.UI.Xaml.Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary); } #endif _container = new Canvas { Style = (global::Windows.UI.Xaml.Style)current.Resources["RootContainerStyle"] }; _page.Content = _container; _container.SizeChanged += OnRendererSizeChanged; MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) => { global::Windows.UI.Xaml.Controls.ProgressBar indicator = GetBusyIndicator(); indicator.Visibility = enabled ? Visibility.Visible : Visibility.Collapsed; }); _toolbarTracker.CollectionChanged += OnToolbarItemsChanged; UpdateBounds(); InitializeStatusBar(); SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; global::Windows.UI.Xaml.Application.Current.Resuming += OnResumingAsync; }
global::Windows.UI.Xaml.Controls.ProgressBar GetBusyIndicator() { if (_busyIndicator == null) { _busyIndicator = new global::Windows.UI.Xaml.Controls.ProgressBar { IsIndeterminate = true, Visibility = Visibility.Collapsed, VerticalAlignment = VerticalAlignment.Top }; Canvas.SetZIndex(_busyIndicator, 1); _container.Children.Add(_busyIndicator); } return(_busyIndicator); }