예제 #1
0
        private void OnCreateProjectFromFLEx(object sender, EventArgs e)
        {
            var dlg = new NewProjectFromRawLiftDialog();

            if (DialogResult.OK != dlg.ShowDialog())
            {
                return;
            }

            Logger.WriteEvent("Attempting create new project from FLEx Export...");

            if (ProjectFromRawFLExLiftFilesCreator.Create(dlg.PathToNewProjectDirectory, dlg.PathToLift))
            {
                if (OpenProject(dlg.PathToNewProjectDirectory))
                {
                    using (var info = new NewProjectInformationDialog(dlg.PathToNewProjectDirectory))
                    {
                        info.ShowDialog();
                    }
                }
            }
            if (_project != null)
            {
                var logger = _project.Container.Resolve <ILogger>();
                logger.WriteConciseHistoricalEvent("Created New Project From FLEx Export");
            }
        }
예제 #2
0
        public void CreateAndOpenProject(string directoryPath, string languageTag, string langName)
        {
            //TODO: This method should have another argument for the language name.
            //the "wesay" part may not exist yet
            if (!Directory.GetParent(directoryPath).Exists)
            {
                Directory.GetParent(directoryPath).Create();
            }

            CreateNewProject(directoryPath);
            OpenProject(directoryPath);

            if (!Project.WritingSystems.Contains(languageTag))
            {
                var genericWritingSystemShippedWithWs = Project.WritingSystems.Get("qaa-x-qaa");
                genericWritingSystemShippedWithWs.Language     = languageTag;
                genericWritingSystemShippedWithWs.LanguageName = langName;
                if (genericWritingSystemShippedWithWs.Language == WellKnownSubTags.Unlisted.Language)
                {
                    //this is to accomodate Flex which expects to have a custom language tag
                    //as the first private use subtag when the language subtag is qaa
                    var langTag = TrimLanguageNameForTag(langName);
                    genericWritingSystemShippedWithWs.Variant = "x-" + langTag;                         // replace x-qaa
                }
                else
                {
                    genericWritingSystemShippedWithWs.Variant = "";                     //remove x-qaa
                }
                Project.WritingSystems.Set(genericWritingSystemShippedWithWs);
                Project.WritingSystems.Save();
            }

            if (_project != null)
            {
                var logger = _project.Container.Resolve <ILogger>();
                logger.WriteConciseHistoricalEvent("Created New Project");


                if (ErrorReport.IsOkToInteractWithUser)
                {
                    using (var dlg = new NewProjectInformationDialog(directoryPath))
                    {
                        dlg.ShowDialog();
                    }
                }
            }
        }