public void DisplayDetail(int _stationid) { stationsDao = new Stations_DAO(); reviewsDao = new Reviews_DAO(); photosDao = new Photos_DAO(); pPhotos = new Photos(); stationId = _stationid; EventDelegate.Add(buttonWriteReview.GetComponent <UIButton>().onClick, () => { Addreview.SetActive(true); Addreview.GetComponent <AddReview_UI>().Init(_stationid); gameObject.SetActive(false); }); EventDelegate.Add(ButtonCountPhotos.GetComponent <UIButton>().onClick, () => { PhotosDetail.SetActive(true); // PhotosDetail.GetComponent<PhotoDetail_UI>().DesTroyResuiltItem(); PhotosDetail.GetComponent <PhotoDetail_UI>().Setphotos(_stationid); gameObject.SetActive(false); }); EventDelegate.Add(ButtonBack.GetComponent <UIButton>().onClick, Clickback); EventDelegate.Add(buttonAddPhotos.GetComponent <UIButton>().onClick, ClickAddPhotos); EventDelegate.Add(ButtonCountReview.GetComponent <UIButton>().onClick, () => { ReviewDetail.SetActive(true); ReviewDetail.GetComponent <ReviewDetail_UI>().ShowReview(_stationid); EventDelegate.Add( buttonBackDetail.GetComponent <UIButton>().onClick, () => { ReviewDetail.SetActive(false); }); }); resuilt = stationsDao.GetStationById(_stationid); StationName.GetComponent <UILabel>().text = resuilt[0]["Name"].ToString(); StationCity.GetComponent <UILabel>().text = resuilt[0]["LocationName"].ToString(); Wifi.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["Wifi"].ToString()); Toilet.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["Toilet"].ToString()); Trolleys.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["Trolley"].ToString()); Refeshment.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["Refreshment"].ToString()); Atm.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["ATM"].ToString()); DisabledAccess.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["DisabledAccess"].ToString()); // ButtonCountReview.GetComponentInChildren <UILabel>().text = reviewsDao.CoutNumReview(_stationid) + " Review"; ButtonCountPhotos.GetComponentInChildren <UILabel>().text = photosDao.CoutNumPhotos(_stationid) + " Photos"; }
/* * /// note * /// 0 - new station * /// 1 - Home * /// 2 - Find detail * /// 3 - Top station * /// 4 - Add new * /// 5 - Find resuilt * /// 6 - Photo detail */ void Start() { pPhotosDao = new Photos_DAO(); regeventform = new bool[6]; for (int i = 0; i < regeventform.Length; i++) { regeventform[i] = false; } if (!regeventform[1]) { //reg event form home EventDelegate.Add(form[1].GetComponent <Home_UI>().btnAddNew.GetComponent <UIButton>().onClick, Home_Click_AddNew); EventDelegate.Add(form[1].GetComponent <Home_UI>().btnFind.GetComponent <UIButton>().onClick, Home_Click_Find); EventDelegate.Add(form[1].GetComponent <Home_UI>().btnTopStationByFaclilities.GetComponent <UIButton>().onClick, Home_Click_TopStationByFacilities); } resuilt = pPhotosDao.GetAllPicture(); WWW www; for (int i = 0; i < resuilt.Rows.Count; i++) { if (!File.Exists(Application.persistentDataPath + "/" + resuilt[i]["PhotoFile"])) { www = new WWW(Application.streamingAssetsPath + "/Pictures/" + resuilt[i]["PhotoFile"]); // Wait for download to complete - not pretty at all but easy hack for now // and it would not take long since the data is on the local device. while (!www.isDone) { ; } if (String.IsNullOrEmpty(www.error)) { System.IO.File.WriteAllBytes(Application.persistentDataPath + "/" + resuilt[i]["PhotoFile"], www.bytes); } } } }