void NewSession(IEnumerable<string> portStrings) { if (session != null) session.Dispose(); SetFilePath(null); timer.Reset(); session = new Session(timer, Enumerable.Empty<string>()); try { session = new Session(timer, portStrings); } catch (Exception e) { MessageBox.Show(string.Format("Got an exception of type {0}\nMessage: {1}\nStacktrace:\n{2}", e.GetType(), e.Message, e.StackTrace), "Capture creation error", MessageBoxButtons.OK, MessageBoxIcon.Error); } RebuildList(); }
void LoadSession(string filePath) { session.Dispose(); SetFilePath(filePath); timer.Reset(); session = new Session(new Capture(XElement.Load(this.filePath))); RebuildList(); }