コード例 #1
0
ファイル: FileUpLoader.cs プロジェクト: SHWDTech/PowerQuality
        private static void StartRecordProcess(Dictionary <string, string> recordConfigs, View.Progress progress, List <string> fileList)
        {
            var client       = new PostClient($"{ServerAddr}Record");
            var recordParams = new RecordParams
            {
                RecordConfigs = recordConfigs,
                FileList      = fileList,
                RecordName    = recordConfigs["RecordName"]
            };

            var processId = Guid.Parse(client.Post(JsonConvert.SerializeObject(recordParams)).Replace("\"", string.Empty));
            var stage     = string.Empty;

            client.SetParams($"{{record}}:{processId}");
            while (stage != RecordProcessStage.ProcessCompleted && stage != RecordProcessStage.Failed)
            {
                var fatchClient = new PostClient($"{ServerAddr}Record?record={processId}");
                stage = fatchClient.Get().Replace("\"", string.Empty);
                progress.UPdateProgressStage(stage);
                Thread.Sleep(1000);
            }

            progress.FinishUpload();
        }