Ejemplo n.º 1
0
        private void OnStrokeCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
        {
            var list = _inkSynchronizer.BeginDry();

            StrokeCollected?.Invoke(this, list);
            _inkSynchronizer.EndDry();
        }
        public async Task StartBrokerAsync(string sessionUri)
        {
            if (alreadyStarted)
            {
                return;
            }

            currentSessionUri = sessionUri;

            connection = new HubConnection(Consts.SignalRUrl);
            hubProxy   = connection.CreateHubProxy("StrokeSyncHub");

            hubProxy.On <byte[]>("onStrokeCollected", compressedStrokePoints => { strokeChunkManager.ReceiveStrokePart(compressedStrokePoints, strokeDescription => StrokeCollected?.Invoke(this, strokeDescription)); });
            hubProxy.On <Guid>("onEraseStroke", strokeId => StrokeErased?.Invoke(this, strokeId));
            hubProxy.On("onEraseAllStrokes", () => AllStrokeErased?.Invoke(this, EventArgs.Empty));
            hubProxy.On("onResendAllStrokesRequested", () => ResendAllStrokesRequested?.Invoke(this, EventArgs.Empty));

            await connection.Start();

            await Task.Delay(500);

            alreadyStarted = true;

            await hubProxy.Invoke("JoinSession", currentSessionUri);
        }