public async Task <ChadderError> DownloadPicture(ChadderPicture picture) { var response = await Session.PostRequestAPI <BasicResponse <byte[]> >(Urls.DownloadBlob, picture.Id); if (response.Error == ChadderError.OK) { var packed = Content.Deserialize(response.Extra); if (packed == null) { Insight.Track("Not a valid content"); return(ChadderError.INVALID_INPUT); } if (packed is ImageContent) { var record = new ChadderSQLPicture() { PictureId = picture.Id, Bin = (packed as ImageContent).BinData, ToBeUploaded = false }; await sqlDB.InsertAsync(record); picture.RecordId = record.recordId; return(ChadderError.OK); } else { Insight.Track("Not a ImageContent"); return(ChadderError.INVALID_INPUT); } } return(response.Error); }
public static MediaViewerFragment Create(ChadderPicture picture) { var result = new MediaViewerFragment(); result.Arguments = new Bundle(); result.Arguments.PutString(EXTRA_PICTURE_ID, picture.Id); return(result); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _picture = ChadderUI.Source.db.Pictures.FirstOrDefault(i => i.Id == Arguments.GetString(EXTRA_PICTURE_ID, null)); if (_picture == null) { SupportFragmentManager.PopBackStack(); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); Picture = null; }