private void btnRun_Click(object sender, RoutedEventArgs e) { if (!isRunning) { if (!listTools.HasItems || listTools.SelectedItem == null) { this.AddLog(LogType.Warning, "No tool selected!"); return; } Communication.IsPreviewPaused = true; ToolBase toolFunction = (listTools.SelectedItem as ToolBase); toolFunction.Start(); currentFunction = toolFunction; btnRun.Content = "Stop Tool"; isRunning = true; } else { currentFunction.Stop(); Communication.IsPreviewPaused = false; btnRun.Content = "Run Selected"; isRunning = false; } }