public void UpdateFile(IProtoService protoService, DatedFile file) { var date = Utils.UnixTimestampToDateTime(file.Date); var format = string.Format(Strings.Resources.FormatDateAtTime, BindConvert.Current.ShortDate.Format(date), BindConvert.Current.ShortTime.Format(date)); Date.Text = format; Texture.Source = null; UpdateFile(protoService, file.File); }
private async void AddFile(bool translation) { var picker = new FileOpenPicker(); picker.ViewMode = PickerViewMode.Thumbnail; picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; picker.FileTypeFilter.AddRange(Constants.PhotoTypes); var files = await picker.PickMultipleFilesAsync(); if (files != null && files.Count > 0) { IsDirty = true; foreach (var file in files) { var asFile = true; var generated = await file.ToGeneratedAsync(asFile?ConversionType.Copy : ConversionType.Compress); ProtoService.Send(new UploadFile(generated, new FileTypeSecure(), 16), result => { if (result is File upload) { var item = new DatedFile(upload, DateTime.Now.ToTimestamp()); _uploadingFiles[upload.Id] = item; BeginOnUIThread(() => { if (translation) { Translation.Add(item); } else { Files.Add(item); } }); } }); } } }