ConvertDipsToPixels() public method

public ConvertDipsToPixels ( double dips ) : int
dips double
return int
コード例 #1
0
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            var window = Window.Current.CoreWindow;

            if (CoreWindow != window)
            {
                window.VisibilityChanged += visibilityChanged;
            }
            CoreWindow = window;

            if (coreMetroWindow != null)
            {
                coreMetroWindow.Dispose();
            }
            coreMetroWindow = new CoreMetroWindow(this, Window.Current.CoreWindow, theEvent, false);
            FrameSize       = new Size2(coreMetroWindow.ConvertDipsToPixels(window.Bounds.Width), coreMetroWindow.ConvertDipsToPixels(window.Bounds.Height));

            if (Window.Current.Content as ApplicationPage == null)
            {
                /*if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                 * {
                 *  //TODO: Load state from previously suspended application
                 * }*/

                Window.Current.Content = new ApplicationPage(desc.WinRTAdApplicationID, desc.WinRTAdUnitID, desc.AdSize, desc.AdGravity, desc.UseAds);
                Shown();
            }

            Window.Current.Activate();
            running = true;
        }
コード例 #2
0
        public void Run()
        {
            var coreWindow = CoreWindow.GetForCurrentThread();

            FrameSize = new Size2(coreMetroWindow.ConvertDipsToPixels(coreWindow.Bounds.Width), coreMetroWindow.ConvertDipsToPixels(coreWindow.Bounds.Height));
            Shown();

            running = true;
            while (running)
            {
                if (visible)
                {
                    CoreWindow.GetForCurrentThread().Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessAllIfPresent);
                    OS.UpdateAndRender();
                }
                else
                {
                    CoreWindow.GetForCurrentThread().Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessOneAndAllPending);
                }
            }
        }