예제 #1
0
        private void RunButton_Click(object sender, EventArgs e)
        {
            runButton.Enabled        = false;
            queueProgressBar.Value   = 0;
            queueProgressBar.Maximum = AssignmentManager.Total;
            queueProgressBar.Visible = true;
            string testCase = testCaseTextBox.Text;
            SynchronizationContext _context = SynchronizationContext.Current;
            Thread thread = new Thread(() =>
            {
                AssignmentManager.Run(_context, queueProgressBar, statusLabel, resultGridView, imageList, runButton, testCase);
            });

            thread.Start();
        }
예제 #2
0
        private void ResultGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            assignmentDetails.ResetText();
            if (e.RowIndex < 0 || e.RowIndex > resultGridView.Rows.Count)
            {
                return;
            }
            DataGridViewRow row        = resultGridView.Rows[e.RowIndex];
            string          name       = row.Cells[0].Value.ToString();
            var             assignment = AssignmentManager.GetAssignmentByName(name);

            if (assignment == null)
            {
                assignmentDetails.ResetText();
            }
            else
            {
                assignmentDetails.AppendText("Assignment Details\n", Color.Blue, true);
                if (assignment.grade == Grade.DID_NOT_COMPILE)
                {
                    assignmentDetails.AppendText("This assignment could not be compiled.\n", Color.Red, false);
                    if (assignment.exception != null)
                    {
                        assignmentDetails.AppendText(assignment.exception.Message + "\n", Color.Black, false);
                        assignmentDetails.AppendText(assignment.exception.StackTrace + "\n", Color.Black, false);
                    }
                    if (assignment.standardError != null)
                    {
                        assignmentDetails.AppendText(assignment.standardError, Color.Red, false);
                    }
                }
                else if (assignment.grade == Grade.INCORRECT_OUTPUT)
                {
                    assignmentDetails.AppendText("Assignment compiled with no issues.\n", Color.Green, false);
                    assignmentDetails.AppendText("Assignment output was incorrect.\n", Color.Red, false);
                    assignmentDetails.AppendText(assignment.standardOutput);
                }
                else if (assignment.grade == Grade.CORRECT)
                {
                    assignmentDetails.AppendText("Assignment compiled with no issues.\n", Color.Green, false);
                    assignmentDetails.AppendText("Assignment output was correct.", Color.Green, false);
                }
            }
        }
예제 #3
0
        private void ClearAllMenuItem_Click(object sender, EventArgs e)
        {
            TaskDialog dialog = new TaskDialog()
            {
                Icon              = (TaskDialogStandardIcon)TaskDialogCommonIcon.ExplorerSearch,
                Cancelable        = true,
                Caption           = "Clear all?",
                InstructionText   = "Clear All Items?",
                StartupLocation   = TaskDialogStartupLocation.CenterOwner,
                OwnerWindowHandle = this.Handle
            };

            dialog.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No;
            if (dialog.Show() == TaskDialogResult.Yes)
            {
                filesListView.Clear();
                AssignmentManager.Clear();
            }
        }
예제 #4
0
        private void OpenMenuItem_Click(object sender, EventArgs e)
        {
            CommonOpenFileDialog dialog = new CommonOpenFileDialog()
            {
                RestoreDirectory = true,
                Multiselect      = true,
                EnsureFileExists = true,
                Title            = "Select Files"
            };

            dialog.Filters.Add(new CommonFileDialogFilter("Java File", "*.java"));
            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                foreach (var item in dialog.FileNames)
                {
                    AssignmentManager.NewAssignment(item);
                }
            }
            UpdateList();
        }
예제 #5
0
        private void OpenDirectoryItem_Click(object sender, EventArgs e)
        {
            CommonOpenFileDialog dialog = new CommonOpenFileDialog()
            {
                RestoreDirectory = true,
                EnsureFileExists = true,
                Title            = "Select Files",
                IsFolderPicker   = true
            };

            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                foreach (var item in Directory.GetFiles(dialog.FileName))
                {
                    if (item.EndsWith(".java"))
                    {
                        AssignmentManager.NewAssignment(item);
                    }
                }
            }
            UpdateList();
        }