/// <summary> /// Show the Open File dialogue, then load the selected character. /// </summary> private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Chummer5 Files (*.chum5)|*.chum5|All Files (*.*)|*.*", Multiselect = true }; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { Timekeeper.Start("load_sum"); Cursor = Cursors.WaitCursor; Character[] lstCharacters = new Character[openFileDialog.FileNames.Length]; object lstCharactersLock = new object(); Parallel.For(0, lstCharacters.Length, i => { Character objLoopCharacter = LoadCharacter(openFileDialog.FileNames[i]); lock (lstCharactersLock) lstCharacters[i] = objLoopCharacter; }); Cursor = Cursors.Default; Program.MainForm.OpenCharacterList(lstCharacters); Application.DoEvents(); Timekeeper.Finish("load_sum"); Timekeeper.Log(); } }
/// <summary> /// Show the Open File dialogue, then load the selected character. /// </summary> private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Chummer5 Files (*.chum5)|*.chum5|All Files (*.*)|*.*"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { Timekeeper.Start("load_sum"); foreach (string strFileName in openFileDialog.FileNames) { LoadCharacter(strFileName); Timekeeper.Start("load_event_time"); Application.DoEvents(); Timekeeper.Finish("load_event_time"); } Timekeeper.Finish("load_sum"); Timekeeper.Log(); } }