Esempio n. 1
0
        /// <summary>
        /// AppMonitorLoader Main Method for STi consumption, direct-application-launching version
        /// </summary>
        /// <param name="commandline">Arguments to AppMonitor loader, either a config file or original format</param>
        public static void RunApplication(string commandline)
        {
            ProcessStartInfo pInfo = ProcessArgs(commandline);

            DictionaryStore.StartServer();

            ApplicationMonitor appMon = new ApplicationMonitor();

            // if we're launching a ClickOnce application, clean the cache
            // Since this method precludes remote deployment and our enlistment should build properly signed manifests, there's no need to update / resign the manifests.
            if (pInfo.FileName.ToLowerInvariant().EndsWith(ApplicationDeploymentHelper.STANDALONE_APPLICATION_EXTENSION) || pInfo.FileName.ToLowerInvariant().EndsWith(ApplicationDeploymentHelper.BROWSER_APPLICATION_EXTENSION))
            {
                ApplicationDeploymentHelper.CleanClickOnceCache();
            }
            // shell exec the app
            appMon.StartProcess(pInfo);

            // Some Xbap tests exit early unless we add PresentationHost.exe as a monitored process.  Has to happen after StartProcess.
            // Timing is not an issue, since this is simply adding a string to a List, so will execute orders of magnitude faster than actually starting any Xbap.
            if (pInfo.FileName.ToLowerInvariant().EndsWith(ApplicationDeploymentHelper.BROWSER_APPLICATION_EXTENSION))
            {
                appMon.MonitorProcess("PresentationHost.exe");
            }
            appMon.WaitForUIHandlerAbort();
            CloseCurrentVariationIfOneExists();
            appMon.Close();
        }