Exemplo n.º 1
0
        private async Task StopLiveTransactions()
        {
            // Stop the live update task
            if (_cts != null)
            {
                _cts.Cancel();
                _cts.Dispose();
                _cts = null;
            }

            // Close the session
            if (_session != null)
            {
                await _client.StopLiveSessionAsync(new StopLiveSessionParameters
                {
                    SessionId = this._session.SessionId
                });

                _session = null;
            }

            // Clearing the text
            this.textTransactions.Clear();

            // Updating state of controls
            UpdateControlsState();
        }
Exemplo n.º 2
0
        private async Task StartLiveTransactions()
        {
            try
            {
                // Starting live session and telling it to fetch 100 last lines
                _session = await _client.StartLiveSessionAsync(new StartLiveSessionParameters
                {
                    SourceId           = _item.FQID.ObjectId,
                    PrecedingLineCount = 100,
                });

                // Updating state of controls
                UpdateControlsState();

                // Creating cancelation source, so we could cancel the task and starting the task of updating the live transactions
                _cts = new CancellationTokenSource();
                await UpdateLiveTransactions(_cts.Token);
            }
            catch (OperationCanceledException) { }
        }