コード例 #1
0
        private void Connect()
        {
            //Register a handler which will be invoked when the hub method dashboard
            SignalRHubConnection.On <List <DashboardMessage> >("dashboardMessage", (clientMessage) =>
            {
                // when the message arrives update the client message an data set
                foreach (var message in clientMessage)
                {
                    // Update the dataset based on the city Id for demo we are using two datasets which will be used in the chart.
                    switch (message.Id)
                    {
                    case "1":
                        _dataSetForPune.Add(Convert.ToInt16(message.Details));
                        break;

                    case "2":
                        _dataSetForMumbai.Add(Convert.ToInt16(message.Details));
                        break;
                    }
                }

                // Adds the labels data coming from signalr Service to the Dataset
                AddData();

                //This tells Blazor that the UI needs to be updated

                StateHasChanged();
            });
        }
コード例 #2
0
        private void MergeDataset(IDataset datasetProxy, IDataset dataset)
        {
            for (int i = 0; i < dataset.Count; i++)
            {
                var item   = ItemFactory.Create();
                var source = dataset[i];

                item.Position = source.Position;
                item.Rotation = source.Rotation;
                item.Scale    = source.Scale;

                item.SetData(source.GetData());

                datasetProxy.Add(item);
            }
        }
コード例 #3
0
        private void Connect()
        {
            HubConnection.On <List <DashboardMessage> >("dashboardMessage", (clientMessage) =>
            {
                foreach (var message in clientMessage)
                {
                    switch (message.Id)
                    {
                    case "1":
                        dataset1.Add(Convert.ToInt16(message.Details));
                        break;

                    case "2":
                        dataset2.Add(Convert.ToInt16(message.Details));
                        break;
                    }
                }

                AddData();

                StateHasChanged(); //This tells Blazor that the UI needs to be updated
            });
        }