Esempio n. 1
0
        public void SetExecutionNodeStatus(string executionNodeID, string message, HubCallerContext context)
        {
            if (message != ClientState.UpdateAfterCompletion.Value)
            {
                Application.Current.Dispatcher.Invoke(delegate {
                    if (clientControls.ContainsKey(context.ConnectionId))
                    {
                        ClientControl client = clientControls[context.ConnectionId];
                        client.SetStatusText(message);
                    }
                });
            }

            if (message == ClientState.Assigned.Value && View.AutoExecute)
            {
                clientControls[context.ConnectionId].PercentComplete = 0;
                MessageHub.Hub.Clients.Client(context.ConnectionId).ClearAndPrepare();
            }

            if (message == ClientState.Ready.Value && View.AutoExecute)
            {
                SetRefreshRate(gridRefreshRate);
                clientControls[context.ConnectionId].PercentComplete = 0;
                MessageHub.Hub.Clients.Client(context.ConnectionId).Execute();
            }

            if (message == ClientState.Executing.Value)
            {
                clientControls[context.ConnectionId].StartUpdateTimer();
            }

            if (message == ClientState.UnAssigned.Value)
            {
                clientControls[context.ConnectionId].PercentComplete = 0;
            }

            if (message == ClientState.ExecutionComplete.Value || message == ClientState.Stopped.Value || message == ClientState.UpdateAfterCompletion.Value)
            {
                clientControls[context.ConnectionId].Stop();
                MessageHub.Hub.Clients.Client(context.ConnectionId).CompletionReport();
            }
        }