public void DefaultWritingSystemsFromLiftWithNoEntries_ReturnsFrenchAndEnglish()
        {
            string    input = @"<?xml version='1.0' encoding='utf-8'?>
<lift
	version='0.13'
	producer='SIL.FLEx 7.2.5.41073'>
</lift>";
            XmlReader reader = XmlReader.Create(new StringReader(input));
            string    vernWs, analysisWs;

            ChooseLangProjectDialog.RetrieveDefaultWritingSystemIdsFromLift(reader, out vernWs, out analysisWs);
            reader.Close();
            Assert.That(vernWs, Is.EqualTo("fr"));
            Assert.That(analysisWs, Is.EqualTo("en"));
        }
        public void DefaultWritingSystemsFromLift_FindsCorrectWritingSystemsFromGloss()
        {
            string    input = @"<?xml version='1.0' encoding='utf-8'?>
<lift
	version='0.13'
	producer='SIL.FLEx 7.2.5.41073'>
	<entry
		dateCreated='2012-06-12T18:41:19Z'
		id='bɛben_00ff1845-1d48-47cc-b9f4-cd8834bc70e0'
		guid='00ff1845-1d48-47cc-b9f4-cd8834bc70e0'>
		<lexical-unit>
			<form
				lang='xyz'>
				<text>bɛben</text>
			</form>
		</lexical-unit>
		<trait
			name='morph-type'
			value='stem' />
		<sense
			id='6b800abe-c349-4f6a-8ece-0c03f6203b84'>
			<grammatical-info
				value='Noun'></grammatical-info>
			<gloss>
				<form
					lang='qed'>
					<text>dance, music</text>
				</form>
			</gloss>
		</sense>
	</entry>
</lift>";
            XmlReader reader = XmlReader.Create(new StringReader(input));
            string    vernWs, analysisWs;

            ChooseLangProjectDialog.RetrieveDefaultWritingSystemIdsFromLift(reader, out vernWs, out analysisWs);
            reader.Close();
            Assert.That(vernWs, Is.EqualTo("xyz"));
            Assert.That(analysisWs, Is.EqualTo("qed"));
        }
Exemple #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays a dialog that allows the user to choose an FW language project.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool ShowOpenProject(Form owner, ref Rectangle dialogBounds,
			ref int dialogSplitterPos, out string name, out string server)
		{
			Icu.InitIcuDataDir();
			RegistryHelper.ProductName = "FieldWorks"; // inorder to find correct Registry keys

			using (var dlg = new ChooseLangProjectDialog(dialogBounds, dialogSplitterPos))
			{
				if (dlg.ShowDialog(owner) == DialogResult.OK)
				{
					name = dlg.Project;
					server = dlg.Server;
					dialogBounds = dlg.Bounds;
					dialogSplitterPos = dlg.SplitterPosition;
					return true;
				}
			}

			name = null;
			server = null;
			return false;
		}
Exemple #4
0
		internal static ProjectId ChooseLangProject(Form dialogOwner, IHelpTopicProvider helpTopicProvider)
		{
			if (!FwNewLangProject.CheckProjectDirectory(dialogOwner, helpTopicProvider))
			{
				return null;
			}
			using (var dlg = new ChooseLangProjectDialog(helpTopicProvider, false))
			{
				dlg.ShowDialog(dialogOwner);
				var app = helpTopicProvider as IApp;
				if (app != null)
				{
					var activeWindow = app.ActiveMainWindow;
					if (activeWindow != null && dlg.ObtainedProjectType != ObtainedProjectType.None)
					{
						((IFwMainWnd)activeWindow).Mediator.PropertyTable.SetProperty("LastBridgeUsed",
							dlg.ObtainedProjectType == ObtainedProjectType.Lift ? "LiftBridge" : "FLExBridge",
							PropertyTable.SettingsGroup.LocalSettings);
					}
				}

				if (dlg.DialogResult == DialogResult.OK)
				{
					var projId = new ProjectId(dlg.Project, dlg.Server);
					if (IsSharedXmlBackendNeeded(projId))
						projId.Type = FDOBackendProviderType.kSharedXML;
					return projId;
			}

				return null;
		}
		}