示例#1
0
        /// <summary>
        /// Method with signature required by ProgressDialogWithTask.RunTask to create the project (and a cache for it)
        /// as a background task while showing the dialog.
        /// </summary>
        /// <param name="progress"></param>
        /// <param name="parameters">A specific list is required...see the first few lines of the method.</param>
        /// <returns></returns>
        private static object CreateProjectTask(IThreadedProgress progress, object[] parameters)
        {
            // Get required parameters. Ideally these would just be the signature of the method, but RunTask requires object[].
            var liftPathname      = (string)parameters[0];
            var synchronizeInvoke = (ISynchronizeInvoke)parameters[1];
            var anthroFile        = (string)parameters[2];
            var cacheReceiver     = (LcmCache[])parameters[3];

            CoreWritingSystemDefinition wsVern, wsAnalysis;

            RetrieveDefaultWritingSystemsFromLift(liftPathname, out wsVern, out wsAnalysis);

            string projectPath = LcmCache.CreateNewLangProj(progress,
                                                            Directory.GetParent(Path.GetDirectoryName(liftPathname)).Parent.Name, // Get the new Flex project name from the Lift pathname.
                                                            FwDirectoryFinder.LcmDirectories, synchronizeInvoke, wsAnalysis, wsVern, null, null, null, anthroFile);

            // This is a temporary cache, just to do the import, and AFAIK we have no access to the current
            // user WS. So create it as "English". Put it in the array to return to the caller.
            cacheReceiver[0] = LcmCache.CreateCacheFromLocalProjectFile(projectPath, "en", new SilentLcmUI(synchronizeInvoke),
                                                                        FwDirectoryFinder.LcmDirectories, new LcmSettings(), progress);
            return(projectPath);
        }