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); } } }
private void BtnCompareAnswerSheets_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); ofd.FileName = ""; ofd.DefaultExt = "*.json"; ofd.Multiselect = true; if (ofd.ShowDialog() == true) { if (ofd.FileNames.Length == 2) { ComparisonWindow w = new ComparisonWindow(); w.Show(); this.visualizer.VisualizeAnswerSheetComparison(ofd.FileNames[0], ofd.FileNames[1], w.PreviewCanvas1, w.PreviewCanvas2, w.GraphCanvas); } } }
/// <summary> /// Visualize answe sheet comparison /// </summary> public void CompareAnswerSheet() { //Console.WriteLine("CTRL+LeftClick"); if (this.parentWindow.AnswerSheetSelected) { AnswerSheetItemData selectedSheet = this.parentWindow.UnselectAnswerSheet(); ComparisonWindow comparisonWindow = new ComparisonWindow(); comparisonWindow.Show(); this.visualizer.VisualizeAnswerSheetComparison(selectedSheet.AnswerData.FilePath, this.AnswerData.FilePath, comparisonWindow.PreviewCanvas1, comparisonWindow.PreviewCanvas2, comparisonWindow.GraphCanvas); } else { this.SelectCanvasVisibility = Visibility.Visible; this.parentWindow.SelectAnswerSheet(this); } }