public async void SetValue(NetworkMode nw, FUPSetValueMeta meta, string ctrlname) { if (nw == NetworkMode.Offline) { string pattern = $"{meta.TableName}-{meta.RowId}-{ctrlname}*"; List <FileWrapper> Files = HelperFunctions.GetFilesByPattern(pattern); foreach (FileWrapper file in Files) { this.AppendToGallery(file.FileName, file.Bytea); } } else if (nw == NetworkMode.Online) { foreach (FileMetaInfo info in meta.Files) { try { ApiFileResponse resp = await FormService.Instance.GetFile(info.FileCategory, $"{info.FileRefId}.jpg"); if (resp != null && resp.HasContent) { this.AppendToGallery(info.FileName, resp.Bytea); } } catch (Exception ex) { EbLog.Error("GetFile api error ::" + ex.Message); } } } }
private void SetFileData(EbMobileControl ctrl, object data) { FUPSetValueMeta fup = new FUPSetValueMeta { TableName = this.Form.TableName, RowId = this.RowId, FileRefIds = data?.ToString() }; if (ctrl is EbMobileFileUpload) { if (this.filesData != null && this.filesData.ContainsKey(ctrl.Name)) { fup.Files.AddRange(this.filesData[ctrl.Name]); } } ctrl.SetValue(fup); }
public async void SetValue(NetworkMode network, FUPSetValueMeta meta, string ctrlname) { if (network == NetworkMode.Offline) { string pattern = $"{meta.TableName}-{meta.RowId}-{ctrlname}*"; List <FileWrapper> Files = HelperFunctions.GetFilesByPattern(pattern); foreach (FileWrapper file in Files) { string name = Guid.NewGuid().ToString("N"); uploadedFiles.Add(name); this.AddAudioFrame(file.Bytea, false, name); } } else if (network == NetworkMode.Online) { foreach (FileMetaInfo info in meta.Files) { try { ApiFileResponse resp = await FormService.Instance.GetFile(info.FileCategory, $"{info.FileRefId + AUDIO_TYPE}"); if (resp != null && resp.HasContent) { string name = Guid.NewGuid().ToString("N"); uploadedFiles.Add(name); this.AddAudioFrame(resp.Bytea, false, name); } } catch (Exception ex) { EbLog.Error("GetFile api error ::" + ex.Message); } } } }