예제 #1
0
        public async Task UpdateProgress(string sessionKey, int value, int total = -1, string stepId = "")
        {
            WebsocketSessionFileProgress response = new WebsocketSessionFileProgress
            {
                SessionKey     = sessionKey,
                UnitsCompleted = value,
                UnitTotal      = total,
                StepID         = stepId
            };

            WebsocketSessionUpdate[] updates = CreateProgressUpdates(WebsocketSessionUpdateStatus.Progress, response);
            WebsocketSession         session = GetSessionByKey(sessionKey);
            string hostId = session.GetAttributeValue <string>("hostId");
            WebsocketSessionMessageResponse updateResponse = CreateWebsocketResponseMessage(WebsocketSessionMessageType.StatusUpdates, updates);

            SendMessage(sessionKey, hostId, updateResponse);
        }
예제 #2
0
 protected static WebsocketSessionUpdate[] CreateProgressUpdates(WebsocketSessionUpdateStatus status, WebsocketSessionFileProgress progress)
 {
     WebsocketSessionUpdate[] updates = new WebsocketSessionUpdate[] {
         new WebsocketSessionUpdate
         {
             Status   = GetSessionUpdateStatusString(status),
             Progress = progress
         }
     };
     return(updates);
 }