internal string GetOrCreateTextRange(ITextRangeProvider rangeProvider) { if (rangeProvider == null) { return(string.Empty); } foreach (var entry in textRangeMapping) { if (entry.Value.Provider == rangeProvider) { return(entry.Key); } } TextPatternRangeWrapper tpw = new TextPatternRangeWrapper(rangeProvider, this); string path = string.Format("{0}/Range{1}", patternPath, textRangeIdCount); bus.Register(new ObjectPath(path), tpw); textRangeIdCount++; TextPatternRangeInfo newInfo = new TextPatternRangeInfo { Provider = rangeProvider, ProviderWrapper = tpw }; textRangeMapping.Add(path, newInfo); return(path); }
internal string GetOrCreateTextRange (ITextRangeProvider rangeProvider) { if (rangeProvider == null) return string.Empty; foreach (var entry in textRangeMapping) { if (entry.Value.Provider == rangeProvider) return entry.Key; } TextPatternRangeWrapper tpw = new TextPatternRangeWrapper (rangeProvider, this); string path = string.Format ("{0}/Range{1}", patternPath, textRangeIdCount); bus.Register (new ObjectPath (path), tpw); textRangeIdCount++; TextPatternRangeInfo newInfo = new TextPatternRangeInfo { Provider = rangeProvider, ProviderWrapper = tpw }; textRangeMapping.Add (path, newInfo); return path; }