예제 #1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(e.Arguments) && e.Arguments.Contains("role") && e.Arguments.Contains("parentprocessid"))
            {
                // Start the VS Test Runner if there's args we recognize
                Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();
                // Ensure the current window is active
                Window.Current.Activate();

                Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments);
            }
            else
            {
                Resources.MergedDictionaries.Add(new DeviceResources());

                var rootFrame = Window.Current.Content as Frame;

                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (rootFrame == null)
                {
                    rootFrame            = new Frame();
                    rootFrame.Navigated += OnNavigated;

                    // Place the frame in the current Window

                    OnInitializeRunner();

                    Initialized = true;

                    RunnerOptions.Current.TerminateAfterExecution = TerminateAfterExecution;
                    RunnerOptions.Current.AutoStart = AutoStart;

                    var nav = new Navigator(rootFrame);

#pragma warning disable CS0618 // Type or member is obsolete
                    var runner = new DeviceRunner(testAssemblies, nav, ResultChannel ?? new TextWriterResultChannel(Writer));
#pragma warning restore CS0618 // Type or member is obsolete
                    var hvm = new HomeViewModel(nav, runner);

                    nav.NavigateTo(NavigationPage.Home, hvm);

                    Window.Current.Content = rootFrame;
                }

                // Ensure the current window is active
                Window.Current.Activate();
                // Hook up the default Back handler
                SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) =>
                {
                    if (rootFrame.CanGoBack)
                    {
                        args.Handled = true;
                        rootFrame.GoBack();
                    }
                };
            }
        }
예제 #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Resources.MergedDictionaries.Add(new DeviceResources());

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                rootFrame            = new Frame();
                rootFrame.Navigated += OnNavigated;

                // Place the frame in the current Window

                OnInitializeRunner();

                Initialized = true;

                RunnerOptions.Current.TerminateAfterExecution = TerminateAfterExecution;
                RunnerOptions.Current.AutoStart = AutoStart;

                var nav = new Navigator(rootFrame);

                var runner = new DeviceRunner(testAssemblies, nav, new ResultListener(Writer));
                var hvm    = new HomeViewModel(nav, runner);

                nav.NavigateTo(NavigationPage.Home, hvm);



                Window.Current.Content = rootFrame;
            }

            // Ensure the current window is active
            Window.Current.Activate();
            // Hook up the default Back handler
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) =>
            {
                if (rootFrame.CanGoBack)
                {
                    args.Handled = true;
                    rootFrame.GoBack();
                }
            };
        }
예제 #3
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Resources.MergedDictionaries.Add(new DeviceResources());

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.Navigated += OnNavigated;

                // Place the frame in the current Window

                OnInitializeRunner();

                Initialized = true;

                RunnerOptions.Current.TerminateAfterExecution = TerminateAfterExecution;
                RunnerOptions.Current.AutoStart = AutoStart;

                var nav = new Navigator(rootFrame);

                var runner = new DeviceRunner(testAssemblies, nav, new ResultListener(Writer));
                var hvm = new HomeViewModel(nav, runner);

                nav.NavigateTo(NavigationPage.Home, hvm);

              

                Window.Current.Content = rootFrame;
            }

            // Ensure the current window is active
            Window.Current.Activate();
            // Hook up the default Back handler
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) =>
            {
                if (rootFrame.CanGoBack)
                {
                    args.Handled = true;
                    rootFrame.GoBack();
                }
            };
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sfile"></param>
        public void Load(string sfile)
        {
            if (System.IO.File.Exists(sfile))
            {
                XElement xx = XElement.Load(sfile);

                foreach (var vv in xx.Element("Devices").Elements())
                {
                    DeviceData data = new DeviceData();
                    data.LoadFromXML(vv);
                    data.Name = string.IsNullOrEmpty(data.Group) ? this.Name + "." + data.Name : this.Name + "." + data.Group + "." + data.Name;
                    DeviceRunner runner = new DeviceRunner()
                    {
                        Device = data
                    };
                    AddDevice(runner);
                }
            }
        }