void HandleAgentDisconnected() { var disconnectedAgent = agent; ResetAgentConnection(); EvaluationService.OutdateAllCodeCells(); PostEvent(ClientSessionEventKind.AgentDisconnected); var title = Catalog.GetString("Session Disconnected"); Message message; if (SessionKind == ClientSessionKind.Workbook) { message = WithReconnectSessionAction( Message.CreateErrorAlert(title, Catalog.GetString( "The Workbook host application has terminated."))); } else { message = Message.CreateInfoAlert( title, Catalog.Format(Catalog.GetString( "Inspector is no longer connected to {0}. You may review and close " + "the session window at your leisure. A new Inspector session may be " + "attached via the debugger in your IDE."), disconnectedAgent.Identity.ApplicationName)); } ViewControllers.Messages.PushMessage(message); }
void WorkbookTargets_PropertyChanged(object sender, PropertyChangedEventArgs e) { EvaluationService.OutdateAllCodeCells(); var selectedTarget = ViewControllers.WorkbookTargets.SelectedTarget; if (selectedTarget == null) { TerminateAgentConnection(); } else if (selectedTarget.AgentType != agent.Type) { agent = agent.WithAgentType(selectedTarget.AgentType); InitializeAgentConnectionAsync().Forget(); } }