public TestProjectWithSessions(int sessionCount) { _testAppFolder = new TemporaryFolder("~~SpongeStatViewModelTestFolder~~"); ReflectionHelper.SetField(typeof(Sponge), "s_mainAppFldr", _testAppFolder.FolderPath); Project = SpongeProject.Create("statVwModelTestPrj"); for (int i = 0; i < sessionCount; i++) { Session session = Project.AddSession(i.ToString()); session.Save(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle adding a new session via clicking on the new button. /// </summary> /// ------------------------------------------------------------------------------------ private object lpSessions_NewButtonClicked(object sender) { var viewModel = new NewSessionDlgViewModel(_currProj); using (var dlg = new NewSessionDlg(viewModel)) { if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { var newSession = _currProj.AddSession(viewModel.NewSessionId); newSession.AddFiles(viewModel.SessionFiles); lblNoSessionsMsg.Visible = false; lpSessions.ListView.Focus(); return(newSession); } } return(null); }