private void BtnOpenAnswerSheet_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); ofd.FileName = ""; ofd.DefaultExt = "*.json"; ofd.Multiselect = false; if (ofd.ShowDialog() == true) { PreviewWindow w = new PreviewWindow(); w.Show(); this.visualizer.VisualizeAnswerSheet(ofd.FileName, w.PreviewCanvas, w.StepGraphCanvas, true, false, true); } }
private void Window_Drop(object sender, System.Windows.DragEventArgs e) { // Show analysis result when saved files are dropped string[] paths = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[]; if (paths.Length == 1) { // visualize single answer sheet string filepath = paths[0]; if (System.IO.Path.GetExtension(filepath) == ".json") { // Visualize answer sheet when 1 json file is dropped PreviewWindow previewWindow = new PreviewWindow(); previewWindow.Show(); this.visualizer.VisualizeAnswerSheet(filepath, previewWindow.PreviewCanvas, previewWindow.StepGraphCanvas, true, false, true); } else if (Directory.Exists(filepath)) { // Group answer sheets when directory is dropped. this.analyzer.GroupAnswerSheet(filepath); AnswerGroupWindow groupWindow = new AnswerGroupWindow(this.analyzer, this.visualizer); groupWindow.Show(); } } else if (paths.Length == 2) { string filepath1 = paths[0]; string filepath2 = paths[1]; if (System.IO.Path.GetExtension(filepath1) == ".json" && System.IO.Path.GetExtension(filepath2) == ".json") { // visualize answer sheets comparison when 2 json files are dropped ComparisonWindow comparisonWindow = new ComparisonWindow(); comparisonWindow.Show(); this.visualizer.VisualizeAnswerSheetComparison(filepath1, filepath2, comparisonWindow.PreviewCanvas1, comparisonWindow.PreviewCanvas2, comparisonWindow.GraphCanvas); } } }
/// <summary> /// Preview answer sheet /// </summary> public void OpenAnswerSheet() { this.parentWindow.UnselectAnswerSheet(); PreviewWindow previewWindow = new PreviewWindow(); previewWindow.Show(); this.visualizer.VisualizeAnswerSheet(this.answerData.FilePath, previewWindow.PreviewCanvas, previewWindow.StepGraphCanvas, false); }