private void wpFileLoader1_OnFileUploaded(object sender, FileItemEventArgs args) { }
private async void flAttachments_OnFileUploaded(object sender, FileItemEventArgs args) { var mt = sender as WpFileLoader; if (mt == null) return; var mf = System.IO.File.ReadAllBytes(args.FileItem.FilePath); var mtc = new TaskAttachement { TaskId = _taskId, AttachedBy = WPSuite.ConnectedUserId, File = new File { Size = args.FileItem.Size, Name = args.FileItem.Name, CreatedById = WPSuite.ConnectedUserId, Extension = args.FileItem.Extension, Content = mf } }; try { Logger.Log($"Send file to dispatcher for task {_taskId}"); var mres = await WebCallFactory.AttachFileToTask(mtc); if (mres.Error) throw mres.Exception; Logger.Log("File send with success!"); mt.Files.Add(Convertors.Convert(mres.TaskAttachement.File)); } catch (Exception mex) { UIHelper.ShowError(mex); Logger.Log(mex); } }