public SelectActorWindow(SelectActorWindowViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; DataContext = _viewModel; _viewModel.ClosingRequest += (sender, e) => this.Close(); textBox.Focus(); }
private void LogChosenConfirmed() { switch (LogChosen) { case OwnFileSelected: var filePath = BrowseLog(); if (filePath != null) { var fileContents = File.ReadAllText(filePath); try { IsWaiting = true; var log = XmlParser.ParseLog( new LogStandard("", "trace", new LogStandardEntry(DataType.String, "id"), "event", new LogStandardEntry(DataType.String, "id"), new LogStandardEntry(DataType.String, "name"), new LogStandardEntry(DataType.String, "roleName")), fileContents); IsWaiting = false; // Fire event LogLoaded?.Invoke(log); // Close view OnClosingRequest(); } catch { MessageBox.Show("Parsing of the file failed.\n\nPlease ensure that the file chosen was previously\ngenerated by the UlrikHøvsgaard Algorithm program."); } } break; case HospitalLog: try { var res = MessageBox.Show("Are you sure, that you wish to parse this log?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.No) { return; } IsWaiting = true; var log = XmlParser.ParseLog( new LogStandard("http://www.xes-standard.org/", "trace", new LogStandardEntry(DataType.String, "conceptName"), "event", new LogStandardEntry(DataType.String, "ActivityCode"), new LogStandardEntry(DataType.String, "conceptName"), new LogStandardEntry(DataType.String, "org:group")), Resources.Hospital_log); IsWaiting = false; // Spawn actor selection window var selectActorViewModel = new SelectActorWindowViewModel(log); // Subscribe to event that gives the chosen sub-log selectActorViewModel.SubLogSelected += SubLogChosen; // Make window open the SelectActorWindow as a dialog OpenSelectActorWindow?.Invoke(selectActorViewModel); if (_chosenLog == null) return; // Fire event LogLoaded?.Invoke(_chosenLog); // Close view OnClosingRequest(); } catch { MessageBox.Show("An error occured when trying to parse the log", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case BpiChallenge2015: try { var res = MessageBox.Show("Are you sure, that you wish to parse this log?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.No) { return; } IsWaiting = true; var log = XmlParser.ParseLog( new LogStandard("http://www.xes-standard.org/", "trace", new LogStandardEntry(DataType.String, "conceptName"), "event", new LogStandardEntry(DataType.String, "conceptName"), new LogStandardEntry(DataType.String, "activityNameEN"), new LogStandardEntry(DataType.String, "monitoringResource")), Resources.BPIC15_1_xes); IsWaiting = false; // Spawn actor selection window var selectActorViewModel = new SelectActorWindowViewModel(log); // Subscribe to event that gives the chosen sub-log selectActorViewModel.SubLogSelected += SubLogChosen; // Make window open the SelectActorWindow as a dialog OpenSelectActorWindow?.Invoke(selectActorViewModel); if (_chosenLog == null) return; // Fire event LogLoaded?.Invoke(_chosenLog); // Close view OnClosingRequest(); } catch { MessageBox.Show("An error occured when trying to parse the log", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; default: MessageBox.Show("Unexpected choice occured.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } }