private IReactiveValue GetOrCreateValue(ReactiveData data, string id, object defaultValue) { var reactiveValue = data.Get <IReactiveValue>(id); if (reactiveValue == null) { reactiveValue = new ReactiveValue(defaultValue); data.Add(id, reactiveValue); } return(reactiveValue); }
public void Start(string path) { _stopwatch.Start(); _data = new ReactiveData(); _data.ItemChanged += OnItemChanged; var text = GetTextByPath(path); _theradCount = GetCountOfThread(text); var textLen = text.Length; var splitedText = SplitText(text); for (int i = 0; i < _theradCount; i++) { var reactiveText = new ReactiveValue(splitedText[i]); _data.Add($"text_{i}", reactiveText); Thread myThread = new Thread(new ParameterizedThreadStart(CalculateTripletsForIndexedThread)); myThread.Name = "Поток " + i.ToString(); myThread.Start(i); } _data.Dispose(); }