private void ImportMVD(string filename)
{
for (int iNS = 0; iNS < mvdXML.Namespaces.Length; iNS++)
{
string xmlns = mvdXML.Namespaces[iNS];
using (FormatXML format = new FormatXML(filename, typeof(mvdXML), xmlns))
{
try
{
this.m_loading = true; // prevent constructors from registering instances (xml serializer instantiates)
format.Load();
this.m_loading = false;
mvdXML mvd = (mvdXML)format.Instance;
Program.ImportMvd(mvd, this.m_project, filename);
break;
}
catch (InvalidOperationException xx)
{
// keep going until successful
if (iNS == mvdXML.Namespaces.Length - 1)
{
MessageBox.Show(this, "The file is not of a supported format (mvdXML 1.0 or mvdXML 1.1).", "Import MVDXML");
}
}
catch (Exception xx)
{
MessageBox.Show(this, xx.Message, "Import MVDXML");
xmlns = null;
}
finally
{
this.m_loading = false;
}
}
}
}