/// <summary> /// Reports error. This is there to offload the ExpandError function from the "Real-Time" worker thread to the application thread /// </summary> private void ReportError(string error) { if (NonFatalException != null) { NonFatalException.Invoke(GrblErrorProvider.ExpandError(error)); } }
private async void MainWindow_Loaded(object sender, RoutedEventArgs e) { await ViewModel.InitAsync(); await GrblErrorProvider.InitAsync(); await ViewModel.LoadMRUs(); foreach (var file in ViewModel.MRUs.PnPJobs) { var pnpJobMenu = new MenuItem() { Header = file, Tag = file }; pnpJobMenu.Click += PnpJobMenu_Click;; RecentPNPJobs.Items.Add(pnpJobMenu); } foreach (var file in ViewModel.MRUs.BoardFiles) { var boardMenu = new MenuItem() { Header = file, Tag = file }; boardMenu.Click += BoardMenu_Click; RecentBoards.Items.Add(boardMenu); } foreach (var file in ViewModel.MRUs.ProjectFiles) { var projectMenu = new MenuItem() { Header = file, Tag = file }; projectMenu.Click += ProjectMenu_Click; RecentProjects.Items.Add(projectMenu); } foreach (var file in ViewModel.MRUs.GCodeFiles) { var gcodeFile = new MenuItem() { Header = file, Tag = file }; gcodeFile.Click += GcodeFile_Click; RecentGCodeFiles.Items.Add(gcodeFile); } }