IEnumerator LoadScreenShot() { //wait some seconds to assure that Application.CaptureScreenshot has finished creating screenshot yield return(new WaitForSeconds(3)); while (!vkapi.IsUserLoggedIn) { yield return(null); } WWW www = new WWW("file:///" + _filePath); yield return(www); if (string.IsNullOrEmpty(www.error)) { Texture2D tex = www.texture; jpegScreenShotBytes = tex.EncodeToJPG(); List <ShareImage> imgs = new List <ShareImage>(); ShareImage screenshot = new ShareImage { data = jpegScreenShotBytes, imageName = "screenshot.jpg", imagetype = ImageType.Jpeg }; imgs.Add(screenshot); var vkShare = new VKShare(OnShareFinished, "Hello From VK Api", imgs, "http://u3d.as/8HK"); vkShare.Share(); } }
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EVENTOS private void Share_OnClick() { Image image = new Image(); image.Source = ImageSource.FromResource("bar.png"); ShareImage share = new ShareImage(); share.Source = image.Source; BindingContext = share; }
public static bool UpdateShareImages(ShareImage model) { try { return(ShareImageDAL.UpdateShareImages(ProcessConnection.OpenMarketing, model)); } catch (Exception ex) { throw ex; } }
private void Awake() { Instance = this; }
public static bool UpdateShareImages(SqlConnection connection, ShareImage model) { SqlTransaction tran; if (connection.State == ConnectionState.Closed) { connection.Open(); } tran = connection.BeginTransaction(); try { string shareInfoSql = "UPDATE Marketing..tbl_ShareImagesInfo SET content=@content,isActive=@isActive,[status]=@status,lastUpdateTime=@lastUpdateTime WHERE PKID=@PKID"; var sqlParamsInfo = new SqlParameter[] { new SqlParameter("@content", model.content), new SqlParameter("@isActive", model.isActive), new SqlParameter("@status", model.isActive?"AuditPass":"******"), new SqlParameter("@lastUpdateTime", model.lastUpdateTime), new SqlParameter("@PKID", model.PKID) }; bool r = SqlHelper.ExecuteNonQuery(tran, CommandType.Text, shareInfoSql, sqlParamsInfo) > 0; List <bool> flag = new List <bool>(); //更新图片的状态->是否删除 string shareDetailSql = "UPDATE Marketing..tbl_ShareImagesDetail SET isDelete=@isDelete WHERE PKID=@PKID"; if (model.images != null && model.images.Count > 0) { foreach (var img in model.images) { var sqlParamsDetail = new SqlParameter[] { new SqlParameter("@isDelete", img.isDelete), new SqlParameter("@PKID", img.PKID) }; flag.Add(SqlHelper.ExecuteNonQuery(tran, CommandType.Text, shareDetailSql, sqlParamsDetail) > 0); } } //如果状态通过->将所有图片也设为通过 if (model.isActive) { flag.Add(SqlHelper.ExecuteNonQuery(tran, CommandType.Text, "UPDATE Marketing..tbl_ShareImagesDetail SET isActive=1 WHERE infoId=@PKID", new SqlParameter("@PKID", model.PKID)) > 0); } if (r && !flag.Contains(false)) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); if (connection.State == ConnectionState.Open) { connection.Close(); } return(false); throw ex; } finally { tran.Dispose(); } }