SIL.FieldWorks.XWorks.FwXWindow.OnImportTranslatedLists C# (CSharp) 메소드

OnImportTranslatedLists() 공개 메소드

Import a file contained translated strings for one or more lists.
See FWR-1739.
public OnImportTranslatedLists ( object commandObject ) : bool
commandObject object
리턴 bool
		public bool OnImportTranslatedLists(object commandObject)
		{
			string filename = null;
			// ActiveForm can go null (see FWNX-731), so cache its value, and check whether
			// we need to use 'this' instead (which might be a better idea anyway).
			var form = ActiveForm;
			if (form == null)
				form = this;
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.CheckFileExists = true;
				dlg.RestoreDirectory = true;
				dlg.Title = ResourceHelper.GetResourceString("kstidOpenTranslatedLists");
				dlg.ValidateNames = true;
				dlg.Multiselect = false;
				dlg.Filter = ResourceHelper.FileFilter(FileFilterType.FieldWorksTranslatedLists);
				if (dlg.ShowDialog(form) != DialogResult.OK)
					return true;
				filename = dlg.FileName;
			}
#if DEBUG
			var dtBegin = DateTime.Now;
#endif
			using (new WaitCursor(form, true))
			{
				NonUndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(Cache.ActionHandlerAccessor,
					() => ImportTranslatedLists(filename));
			}
#if DEBUG
			var dtEnd = DateTime.Now;
			var span = new TimeSpan(dtEnd.Ticks - dtBegin.Ticks);
			Debug.WriteLine(String.Format("Total elapsed time for loading translated list(s) from {0} and handling PropChanges = {1}",
				filename, span));
#endif
			return true;
		}
FwXWindow