예제 #1
0
        /// <summary>
        /// Launch the app
        /// </summary>
        public static CalculatorAppLfm Launch()
        {
            Log.Comment("Launching Calculator and waiting for first page load...");

            // Need to set this for the MITALite Tap~ methods to work on high DPI screens.
            UAPApp.SetTestDPIAwareness();

            // We want to be able to see any element in the tree
            Context.RawContext.Activate();

            // Set default wait timeout.
            MS.Internal.Mita.Foundation.Waiters.Waiter.DefaultTimeout = TimeSpan.FromSeconds(30);

            // Enable Mita internal logging.
            MS.Internal.Mita.Foundation.Utilities.Log.OutImplementation = (s, a) => { Log.Comment($"- [MitaLite] { string.Format(s, a) }"); };

            using (EtwWaiter appLaunchWaiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AppLaunchEndETWEventName))
            {
                var viewDescriptor = NavigationHelper.LaunchApplication(Constants.PackageAppUserModelId);
                appLaunchWaiter.Wait(TimeSpan.FromSeconds(30));

                Window calculatorWindow = new Window(UIObject.Root.Descendants.Find(CoreWindowUICondition));
                Debug.Assert(calculatorWindow.ClassName == CoreWindowClassName);

                // Move our window to the foreground.
                WindowHelper.SetAsForeground(calculatorWindow.GetTopLevelWindow());

                return(new CalculatorAppLfm(new CalculatorAppPom(calculatorWindow), viewDescriptor));
            }
        }
예제 #2
0
        public NavBarLfm OpenNavBar()
        {
            using (EtwWaiter waiter = this.ObjectModel.GetNavBarOpenedWaiter())
            {
                this.ObjectModel.NavButton.Invoke();
                waiter.Wait();
            }

            return(new NavBarLfm(this.ObjectModel.NavBarPom));
        }
예제 #3
0
        public AboutFlyoutLfm OpenAboutFlyout()
        {
            var navBar = this.OpenNavBar();

            using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AboutFlyoutOpenedETWEventName))
            {
                navBar.SelectAbout();
                waiter.Wait();
            }

            return(new AboutFlyoutLfm(this.ObjectModel.AboutFlyoutPom));
        }
예제 #4
0
 public void OpenBody()
 {
     using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.HistoryBodyOpenedETWEventName))
     {
         // Only one exists at a given time.
         if (this.ObjectModel.IsHistoryButtonVisible)
         {
             if (!this.ObjectModel.IsBodyOpen)
             {
                 this.ObjectModel.HistoryButton.Invoke();
                 waiter.Wait();
             }
         }
         else if (!this.ObjectModel.HistoryPivot.IsSelected)
         {
             this.ObjectModel.HistoryPivot.Click();
             waiter.Wait();
         }
     }
 }