private void openToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.CheckFileExists = true; dlg.RestoreDirectory = true; dlg.Title = "Open Fieldworks Language Project"; dlg.ValidateNames = true; dlg.Multiselect = false; dlg.Filter = "Project files (*.xml)|*.xml"; if (dlg.ShowDialog(this) == DialogResult.OK) { Cursor = Cursors.WaitCursor; try { DateTime start = DateTime.Now; string modelDir = DirectoryFinder.FwSourceDirectory; modelDir = modelDir.Substring(0, modelDir.LastIndexOf('\\')); modelDir = Path.Combine(modelDir, @"Output\XMI"); string mdcPathname = Path.Combine(modelDir, "xmi2cellar3.xml"); using (RealCacheLoader loader = new RealCacheLoader()) { m_objects.Clear(); m_cache = loader.LoadCache(mdcPathname, dlg.FileName, m_objects); } DateTime end = DateTime.Now; TimeSpan span = new TimeSpan(end.Ticks - start.Ticks); string totalTime = String.Format("Minutes: {0}, Seconds: {1}, Millseconds: {2}", ((span.Hours * 60) + span.Minutes).ToString(), span.Seconds.ToString(), span.Milliseconds.ToString()); m_tstbLoadTime.Text = String.Format("Time to Load: {0}", totalTime); } finally { Cursor = Cursors.Default; } #if FlushMemory MemoryManagement.FlushMemory(); #endif uint mainClid = MetaDataCache.GetClassId("LangProject"); int mainHvo = 0; foreach (KeyValuePair <int, uint> kvp in m_objects) { //uint clid = (uint)m_cache.get_IntProp(kvp.Key, (int)CmObjectFields.kflidCmObject_Class); if (kvp.Value == mainClid) { mainHvo = kvp.Key; break; } } m_current = new SelectedObject(0, mainHvo, mainClid); PopulateMainListView(); } } }