/// <summary> /// Create a remote agent with the given name /// </summary> public static RemoteAgentTag CreateRemoteAgent(string agentName, ITextView view, IEditorFormatMap formatMap) { Dictionary <string, RemoteAgentTag> existingAgents = GetExistingAgents(view); RemoteAgentTag agent; if (existingAgents.TryGetValue(agentName, out agent)) { return(agent); } var brushes = _brushes[existingAgents.Count % _brushes.Count]; ResourceDictionary agentDictionary = new ResourceDictionary(); agentDictionary.Add(MarkerFormatDefinition.BorderId, brushes.Item1); agentDictionary.Add(MarkerFormatDefinition.FillId, brushes.Item2); formatMap.AddProperties(agentName, agentDictionary); agent = new RemoteAgentTag(agentName); existingAgents[agentName] = agent; return(agent); }
private void CoverageColours_ColoursChanged(object sender, EventArgs e) { if (prepared) { editorFormatMap.BeginBatchUpdate(); foreach (var coverageEditorFormatDefinition in coverageEditorFormatDefinitions) { var newBackgroundColor = GetBackgroundColor(coverageEditorFormatDefinition.CoverageType); coverageEditorFormatDefinition.SetBackgroundColor(newBackgroundColor); editorFormatMap.AddProperties(coverageEditorFormatDefinition.Identifier, coverageEditorFormatDefinition.CreateResourceDictionary()); } editorFormatMap.EndBatchUpdate(); } }
/// <summary> /// Create a remote agent with the given name /// </summary> public static RemoteAgentTag CreateRemoteAgent(string agentName, ITextView view, IEditorFormatMap formatMap) { Dictionary<string, RemoteAgentTag> existingAgents = GetExistingAgents(view); RemoteAgentTag agent; if (existingAgents.TryGetValue(agentName, out agent)) return agent; var brushes = _brushes[existingAgents.Count % _brushes.Count]; ResourceDictionary agentDictionary = new ResourceDictionary(); agentDictionary.Add(MarkerFormatDefinition.BorderId, brushes.Item1); agentDictionary.Add(MarkerFormatDefinition.FillId, brushes.Item2); formatMap.AddProperties(agentName, agentDictionary); agent = new RemoteAgentTag(agentName); existingAgents[agentName] = agent; return agent; }
public void AddProperties(string key, ResourceDictionary properties) { viewProps.Add(key); categoryMap.AddProperties(key, properties); }