public void populate(Round oldRound) { Round myRound = oldRound; //set the duration int minutes = (int)myRound.getDuration().Minutes; int seconds = (int)myRound.getDuration().Seconds; originalDuration = new TimeSpan(0, minutes, seconds); currentDuration = originalDuration; //set the roles roles = myRound.Roles; //set the questions questions = myRound.Questions; }
private void saveProfileToolStripMenuItem_Click(object sender, EventArgs e) { //call error checking method validation(); if (errProvider.GetError(lstRoles).Length != 0) { return; } if (errProvider.GetError(txtQuestions).Length != 0) { return; } if (errProvider.GetError(grpDuration).Length != 0) { return; } //get the Rounder object Round myRound = loadRounderObject(); SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Filter = "Text Files (.txt)|*.txt|All Files (*.*)|*.*"; if (saveFile.ShowDialog() == DialogResult.OK) { //write to the file StreamWriter sw = new StreamWriter(saveFile.FileName); foreach (string role in myRound.Roles) { sw.WriteLine(role); } sw.WriteLine("#"); foreach (string question in myRound.Questions) { sw.WriteLine(question); } sw.WriteLine("#"); sw.WriteLine(myRound.getDuration().Minutes.ToString()); sw.WriteLine(myRound.getDuration().Seconds.ToString()); sw.Close(); } }