コード例 #1
0
        private async Task <ActivityDTO> ConfigureFollowUp(bool setFileName = false, string fileUri = null, ActivityDTO existingActivity = null)
        {
            if (string.IsNullOrEmpty(fileUri))
            {
                fileUri = HealthMonitor_FixtureData.GetFilePath();
            }

            var configureUrl = GetTerminalConfigureUrl();
            var dataDTO      = HealthMonitor_FixtureData.Load_Excel_File_v1_InitialConfiguration_Fr8DataDTO(Guid.NewGuid());

            if (existingActivity == null)
            {
                existingActivity = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);
            }

            if (setFileName)
            {
                using (var storage = _crateManager.GetUpdatableStorage(existingActivity))
                {
                    var activityUi    = new Load_Excel_File_v1.ActivityUi();
                    var controlsCrate = _crateManager.GetStorage(existingActivity).FirstCrate <StandardConfigurationControlsCM>();
                    activityUi.SyncWith(controlsCrate.Content);
                    activityUi.FilePicker.Value = fileUri;
                    storage.ReplaceByLabel(Fr8.Infrastructure.Data.Crates.Crate.FromContent(controlsCrate.Label, new StandardConfigurationControlsCM(activityUi.Controls.ToArray())));
                }
            }
            dataDTO.ActivityDTO = existingActivity;
            return(await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO));
        }