Exemplo n.º 1
0
        public static void Init()
        {
            if (IsInitialized)
            {
                return;
            }

            Device.PlatformServices = new PlatformServices();

            Registrar.RegisterAll(new[]
            {
                typeof(ExportRendererAttribute),
                typeof(ExportImageSourceHandlerAttribute),
                typeof(ExportCellAttribute)
            });
            Device.OS    = TargetPlatform.Other;
            Device.Idiom = TargetIdiom.Tablet;

            string name = typeof(Forms).GetType().Name;
            var    myResourceDictionary = new Windows.UI.Xaml.ResourceDictionary
            {
                Source =
                    new Uri("ms-appx:///Xamarin.Forms.Platform.WP8/WinRTResources.xaml",
                            UriKind.RelativeOrAbsolute)
            };

            Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary);
            //  ExpressionSearch.Default = new Forms.WinPhoneExpressionSearch();

            IsInitialized = true;
        }
Exemplo n.º 2
0
        public static void Init()
        {
            if (IsInitialized)
                return;

            Device.PlatformServices = new PlatformServices();

            Registrar.RegisterAll(new[]
                                  {
                                      typeof (ExportRendererAttribute),
                                      typeof (ExportImageSourceHandlerAttribute),
                                      typeof (ExportCellAttribute)
                                  });
            Device.OS = TargetPlatform.Other;
            Device.Idiom = TargetIdiom.Tablet;

            string name = typeof(Forms).GetType().Name;
            var myResourceDictionary = new Windows.UI.Xaml.ResourceDictionary
                                       {
                                           Source =
                                               new Uri("ms-appx:///Xamarin.Forms.Platform.WP8/WinRTResources.xaml",
                                               UriKind.RelativeOrAbsolute)
                                       };

            Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary);
            //  ExpressionSearch.Default = new Forms.WinPhoneExpressionSearch();

            IsInitialized = true;
        }
 public DelighterUnitToStyleConverter()
 {
     m_delighters = new Windows.UI.Xaml.ResourceDictionary
     {
         Source = new Uri(@"ms-appx:///Views/DelighterUnitStyles.xaml")
     };
 }
        static partial void PlatformInit()
        {
            if (s_isInitialized)
            {
                return;
            }
            s_isInitialized = true;

            var resourceDictionary = new WResrouceDictionary();

            resourceDictionary.Source = s_xbf;

            WApplication.Current.Resources.MergedDictionaries.Add(resourceDictionary);
        }
Exemplo n.º 5
0
        internal Platform(Windows.UI.Xaml.Controls.Page page)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            _page = page;

            var current = Windows.UI.Xaml.Application.Current;

            if (!current.Resources.ContainsKey("RootContainerStyle"))
            {
                Windows.UI.Xaml.Application.Current.Resources.MergedDictionaries.Add(Forms.GetTabletResources());
            }

#if UWP_16299
            if (!current.Resources.ContainsKey(ShellRenderer.ShellStyle))
            {
                var myResourceDictionary = new Windows.UI.Xaml.ResourceDictionary();
                myResourceDictionary.Source = new Uri("ms-appx:///Xamarin.Forms.Platform.UAP/Shell/ShellStyles.xbf");
                Windows.UI.Xaml.Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary);
            }
#endif

            _container = new Canvas
            {
                Style = (Windows.UI.Xaml.Style)current.Resources["RootContainerStyle"]
            };

            _page.Content = _container;

            _container.SizeChanged += OnRendererSizeChanged;

            MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
            {
                Windows.UI.Xaml.Controls.ProgressBar indicator = GetBusyIndicator();
                indicator.Visibility = enabled ? Visibility.Visible : Visibility.Collapsed;
            });

            _toolbarTracker.CollectionChanged += OnToolbarItemsChanged;

            UpdateBounds();

            InitializeStatusBar();

            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
            Windows.UI.Xaml.Application.Current.Resuming += OnResumingAsync;
        }
Exemplo n.º 6
0
        public static void extendIntoTitleBar(Windows.UI.Xaml.ResourceDictionary Resources)
        {
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            var titleBar = ApplicationView.GetForCurrentView().TitleBar;

            if (CheckContract.isAPIContractExist(6))
            {
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                titleBar.ButtonForegroundColor         = (Color)Resources["SystemBaseHighColor"];
            }
            else
            {
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            }
        }
        public IResourceDictionary GetSystemResources()
        {
            Windows.UI.Xaml.ResourceDictionary windowsResources = Windows.UI.Xaml.Application.Current.Resources;

            var resources = new ResourceDictionary();

            resources[Device.Styles.TitleStyleKey]    = GetStyle("HeaderTextBlockStyle");
            resources[Device.Styles.SubtitleStyleKey] = GetStyle("SubheaderTextBlockStyle");
            resources[Device.Styles.BodyStyleKey]     = GetStyle("BodyTextBlockStyle");
            resources[Device.Styles.CaptionStyleKey]  = GetStyle("CaptionTextBlockStyle");
#if WINDOWS_UWP
            resources[Device.Styles.ListItemTextStyleKey] = GetStyle("BaseTextBlockStyle");
#else
            resources[Device.Styles.ListItemTextStyleKey] = GetStyle("TitleTextBlockStyle");
#endif
            resources[Device.Styles.ListItemDetailTextStyleKey] = GetStyle("BodyTextBlockStyle");
            return(resources);
        }
        internal static string GetResourceNameDebug(this DependencyObject obj)
        {
            var source = ResourceDictionary.GetResourceSource(obj);

            return(source?.ResourceKey.Key ?? "No associated key found. Make sure you uncommented '//#define DEBUG_SET_RESOURCE_SOURCE' in ResourceDictionary.cs");
        }