public RHistory(IRInteractiveWorkflowVisual interactiveWorkflow, ITextBuffer textBuffer, IFileSystem fileSystem, IRSettings settings, IEditorOperationsFactoryService editorOperationsFactory, IRtfBuilderService rtfBuilderService, Action dispose) { _interactiveWorkflow = interactiveWorkflow; _historyTextBuffer = textBuffer; _fileSystem = fileSystem; _editorOperationsFactory = editorOperationsFactory; _rtfBuilderService = rtfBuilderService; _dispose = dispose; _textBufferIsEditable = new CountdownDisposable(MakeTextBufferReadOnly); _isMultiline = settings.MultilineHistorySelection; if (_isMultiline) { _entries = new MultilineRHistoryEntries(); } else { _entries = new SinglelineRHistoryEntries(); } _nextEntrySelector = new SingleEntrySelector(this, false); _previousEntrySelector = new SingleEntrySelector(this, true); _rangeUpEntrySelector = new RangeEntrySelector(this, true); _rangeDownEntrySelector = new RangeEntrySelector(this, false); MakeTextBufferReadOnly(); }
public RInteractiveEvaluator(IRSessionProvider sessionProvider, IRSession session, IRHistory history, IConnectionManager connections, IServiceContainer services, IRSettings settings, IConsole console) { History = history; Session = session; _sessionProvider = sessionProvider; _connections = connections; _services = services; _settings = settings; _console = console; _evaluatorRequest = new CountdownDisposable(); _fs = _services.FileSystem(); _disposableBag .Add(() => Session.Output -= SessionOnOutput) .Add(() => Session.Connected -= SessionOnConnected) .Add(() => Session.Disconnected -= SessionOnDisconnected) .Add(() => Session.BeforeRequest -= SessionOnBeforeRequest) .Add(() => Session.AfterRequest -= SessionOnAfterRequest) .Add(() => _sessionProvider.BrokerChanging -= OnBrokerChanging); _sessionProvider.BrokerChanging += OnBrokerChanging; Session.Output += SessionOnOutput; Session.Connected += SessionOnConnected; Session.Disconnected += SessionOnDisconnected; Session.BeforeRequest += SessionOnBeforeRequest; Session.AfterRequest += SessionOnAfterRequest; }
public void Increment() { var countdownDisposable = new CountdownDisposable(() => { }); countdownDisposable.Count.Should().Be(0); var disposable1 = countdownDisposable.Increment(); countdownDisposable.Count.Should().Be(1); var disposable2 = countdownDisposable.Increment(); countdownDisposable.Count.Should().Be(2); disposable2.Dispose(); countdownDisposable.Count.Should().Be(1); disposable2.Dispose(); countdownDisposable.Count.Should().Be(1); disposable2 = countdownDisposable.Increment(); countdownDisposable.Count.Should().Be(2); disposable1.Dispose(); countdownDisposable.Count.Should().Be(1); disposable2.Dispose(); countdownDisposable.Count.Should().Be(0); }
public RInteractiveEvaluator(IRSession session, IRHistory history, IConnectionManager connections, ICoreShell coreShell, IRSettings settings) { History = history; Session = session; Session.Output += SessionOnOutput; Session.Disconnected += SessionOnDisconnected; Session.BeforeRequest += SessionOnBeforeRequest; Session.AfterRequest += SessionOnAfterRequest; _connections = connections; _coreShell = coreShell; _settings = settings; _evaluatorRequest = new CountdownDisposable(); }
public SettingsAccess(ProjectConfigurationSettingsProvider provider, IThreadHandling threadHandling, string projectPath, IRProjectProperties propertes, ConfigurationSettingCollection settings) { _provider = provider; _threadHandling = threadHandling; _projectPath = projectPath; _properties = propertes; _counter = new CountdownDisposable(Release); Settings = settings; Settings.CollectionChanged += OnCollectionChanged; }
public RSession(int id, Action onDispose) { Id = id; _onDispose = onDispose; _disposeToken = DisposeToken.Create <RSession>(); _disableMutatingOnReadConsole = new CountdownDisposable(() => { if (!_delayedMutatedOnReadConsole) { return; } _delayedMutatedOnReadConsole = false; Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty)); }); }
public RSession(int id, IRHostBrokerConnector brokerConnector, Action onDispose) { Id = id; BrokerConnector = brokerConnector; _onDispose = onDispose; _disposeToken = DisposeToken.Create <RSession>(); _disableMutatingOnReadConsole = new CountdownDisposable(() => { if (!_delayedMutatedOnReadConsole) { return; } _delayedMutatedOnReadConsole = false; Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty)); }); _afterHostStartedTask = TaskUtilities.CreateCanceled(new RHostDisconnectedException()); }
public void Create() { var callCount = 0; Action callback = () => callCount++; var countdownDisposable = new CountdownDisposable(callback); countdownDisposable.Count.Should().Be(0); callCount.Should().Be(0); var disposable = countdownDisposable.Increment(); countdownDisposable.Count.Should().Be(1); callCount.Should().Be(0); disposable.Dispose(); countdownDisposable.Count.Should().Be(0); callCount.Should().Be(1); }
public RSession(int id, IBrokerClient brokerClient, Action onDispose) { Id = id; BrokerClient = brokerClient; _onDispose = onDispose; _disposeToken = DisposeToken.Create <RSession>(); _disableMutatingOnReadConsole = new CountdownDisposable(() => { if (!_delayedMutatedOnReadConsole) { return; } _delayedMutatedOnReadConsole = false; Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty)); }); _initializationLock = new BinaryAsyncLock(); _initializationTcs = new TaskCompletionSourceEx <object>(); _afterHostStartedTask = TaskUtilities.CreateCanceled(new RHostDisconnectedException()); }
public RSession(int id, string name, IBrokerClient brokerClient, IExclusiveReaderLock initializationLock, Action onDispose) { Id = id; Name = name; BrokerClient = brokerClient; _onDispose = onDispose; _disposeToken = DisposeToken.Create <RSession>(); _disableMutatingOnReadConsole = new CountdownDisposable(() => { if (!_delayedMutatedOnReadConsole) { return; } _delayedMutatedOnReadConsole = false; Task.Run(() => Mutated?.Invoke(this, EventArgs.Empty)); }); _initializationLock = initializationLock; _stopHostLock = new BinaryAsyncLock(true); _hostStartedTcs = new TaskCompletionSourceEx <object>(); _startupInfo = new RHostStartupInfo(); }
internal AnalysisQueue() { _ppc = new PriorityProducerConsumer <QueueItem>(4, excludeDuplicates: true, comparer: QueueItemComparer.Instance); _queueControlCounter = new CountdownDisposable(() => _queueEnabled.Reset(), () => _queueEnabled.Set()); _consumerTask = Task.Run(ConsumerLoop); }
public BatchObservableCollection(IEnumerable <T> collection) : base(collection) { _batchUpdate = new CountdownDisposable(OnBatchUpdateCompleted); }
public BatchObservableCollection() { _batchUpdate = new CountdownDisposable(OnBatchUpdateCompleted); }