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;
}