private void DeleteItemComplete(CalenderItem deleteItem) { if (deleteItem != null) { DestroyImmediate(deleteItem.gameObject); pageList[deleteItem.PageIndex].DeleteOneItem(deleteItem.PageIndex, deleteItem); for (int i = deleteItem.PageIndex + 1; i < pageList.Count; i++) { pageList[i].ShouldRefresh = true; } //后两页 for (int i = deleteItem.PageIndex + 1; i <= deleteItem.PageIndex + 2; i++) { if (i >= pageList.Count) { return; } pageList[i].LoadItems(i, false); } deleteItem = null; SetPageText(); } }
private void InitPageList() { //StartCoroutine(Cor_InitPageList()); for (int i = 0; i < CalenderController.instance.PageNum; i++) { AddEmptyPage(i); } int startIndex = PersonManager.instance.CurPersonPageIndex; int endIndex = Mathf.Min(CalenderController.instance.PageNum, PersonManager.instance.CurPersonPageIndex + 3); for (int i = startIndex; i < endIndex; i++) { int tempIndex = i; pageList[i].LoadItems(i, true, () => { if (tempIndex == endIndex - 1) { if (GameManager.instance.CalendarDetailShow) { CalenderItem item = GetCalendarItemByIndex(PersonManager.instance.CurPersonPageIndex, PersonManager.instance.CurPersonIndex); ChooseOneItem(item); } } }); } PageScrollEndFunc(PersonManager.instance.CurPersonPageIndex); }
void ChooseOneItem(CalenderItem item) { PersonManager.instance.CurPersonIndex = item.Index; CalenderController.instance.SelectItemId = item.Index; CurSelectItem = item; ShowDetail(item); }
void ShowDetail(CalenderItem item) { float number = 1; Tween t = DOTween.To(() => number, x => number = x, 0, 0.2f); t.OnUpdate(() => { ListMaskCG.alpha = number; }); DetailView.gameObject.SetActive(true); OriDetailPosition = item.transform.position; DetailItem = Instantiate(item.gameObject, transform, true); Destroy(DetailItem.GetComponent <CalenderItem>()); Destroy(DetailItem.transform.Find("btn_detail").GetComponent <ButtonScaleAni>()); CurSelectItem.GetComponent <CanvasGroup>().alpha = 0; BtnDetailBack.GetComponent <UIMove>().MoveShow(); BtnDetailDownload.GetComponent <UIMove>().MoveShow(); BtnDetailEdit.GetComponent <UIMove>().MoveShow(); BtnDetailGame.GetComponent <UIMove>().MoveShow(); BtnDelete.GetComponent <UIMove>().MoveHide(); BtnBack.GetComponent <UIMove>().MoveHide(); DetailItem.transform.localScale = Vector3.one; DetailItem.transform.position = OriDetailPosition; DetailItem.transform.DOScale(new Vector3(1.5f, 1.5f, 1.5f), 0.3f); DetailItem.transform.DOLocalMove(Vector3.zero, 0.3f); }
public List <CalenderItem> GetUserAppointments() { var appointments = new List <mp_appointment>(); var user_id = _userManager.GetUserId(HttpContext.User); if (User.IsInRole("clinician")) { var profile = _clinicianService.Get().FirstOrDefault(e => e.user_id == user_id); //get all the appointments of the profile appointments = _appointmentService.GetProfileAppointments(profile.id).ToList(); } else if (User.IsInRole("client")) { var profile = _profileService.GetProfileByUserId(user_id); //get all the appointments of the profile appointments = _appointmentService.GetProfileAppointments(profile.id).ToList(); } var calendar_items = new List <CalenderItem>(); foreach (var appointment in appointments) { var calendar_item = new CalenderItem { id = appointment.id, title = appointment.appointment_typeNavigation.name, start = appointment.start_date.ToString("yyyy-MM-ddThh:mm") }; calendar_items.Add(calendar_item); } return(calendar_items); }
public void ItemChoosed(CalenderItem item) { if (chooseOneItem != null) { chooseOneItem(item); } }
public void DeleteOneItem(int _index, CalenderItem deleteItem) { PageIndex = _index; int index = endItemIndex - 1; personList.Remove(deleteItem); /* * UIHelper.instance.LoadPrefabAsync("Prefabs/calendar|calendar_item", ItemContent, Vector3.zero, Vector3.one, false, null, (item) => { * if (index < CalenderController.instance.PersonNum) * { * string path = CalenderController.instance.pathList[index]; * PartDataWhole whole = PersonManager.instance.DeserializePerson(path); * CalenderItem calenderItem = item.GetComponent<CalenderItem>(); * calenderItem.Init(PageIndex, index, path, whole); * personList.Add(calenderItem); * if (CalenderController.instance.IsDelete) * { * calenderItem.ShowDelete(true); * } * } * else * { * trueItemCount -= 1; * Debug.Log("load null:" + index + " count:" + trueItemCount); * CalenderItem calenderItem = item.GetComponent<CalenderItem>(); * calenderItem.Init(); * } * if (trueItemCount <= 0) * { * CalenderController.instance.DeletePageFunc(this); * } * }); */ GameObject item = UIHelper.instance.LoadPrefab("Prefabs/calendar|calendar_item", ItemContent, Vector3.zero, Vector3.one, false); if (index < CalenderController.instance.PersonNum) { string path = CalenderController.instance.pathList[index]; CalenderItem calenderItem = item.GetComponent <CalenderItem>(); calenderItem.Init(PageIndex, index, path); personList.Add(calenderItem); if (CalenderController.instance.IsDelete) { calenderItem.ShowDelete(true); } } else { trueItemCount -= 1; Debug.Log("load null:" + index + " count:" + trueItemCount); CalenderItem calenderItem = item.GetComponent <CalenderItem>(); calenderItem.Init(); } if (trueItemCount <= 0) { CalenderController.instance.DeletePageFunc(this); } }
public void DeleteComplete(CalenderItem item) { PersonManager.instance.DeletePerson(item.fileName); pathList.Remove(item.fileName); PersonNum--; GetPageNum(PersonNum); if (deleteItemComplete != null) { deleteItemComplete(item); } }
/* * void LoadItemsFunc(int _index, bool first) * { * ShouldRefresh = false; * PageIndex = _index; * trueItemCount = 0; * * for (int j = ItemContent.childCount - 1; j >= 0; j--) * { * DestroyImmediate(ItemContent.GetChild(j).gameObject); * } * * personList.Clear(); * startItemIndex = 6 * _index; * endItemIndex = 6 * _index + 6; * Debug.Log("star:" + startItemIndex + " end:" + endItemIndex); * for (int i = startItemIndex; i < endItemIndex; i++) * { * GameObject item = UIHelper.instance.LoadPrefab("Prefabs/calendar|calendar_item",ItemContent, Vector3.zero, Vector3.one, false); * if (i < CalenderController.instance.PersonNum) * { * trueItemCount++; * string path = CalenderController.instance.pathList[i]; * CalenderItem calenderItem = item.GetComponent<CalenderItem>(); * calenderItem.Init(PageIndex, i, path); * personList.Add(calenderItem); * } * else * { * CalenderItem calenderItem = item.GetComponent<CalenderItem>(); * calenderItem.Init(); * } * } * if (CalenderController.instance.IsDelete) * { * SetDeleteStatus(true); * } * * if (trueItemCount == 0) * { * Debug.Log("trueItemCount==0"); * CalenderController.instance.DeletePageFunc(this); * } * } */ IEnumerator Cor_LoadItems(int _index, bool first, Action cb = null) { Debug.Log("pageIndex;" + _index); ShouldRefresh = false; PageIndex = _index; trueItemCount = 0; for (int j = ItemContent.childCount - 1; j >= 0; j--) { DestroyImmediate(ItemContent.GetChild(j).gameObject); } personList.Clear(); startItemIndex = 6 * _index; endItemIndex = 6 * _index + 6; int i = startItemIndex; while (i < endItemIndex) { GameObject item = UIHelper.instance.ClonePrefab(calendarItemTemplate, ItemContent, Vector3.zero, Vector3.one, false); if (i < CalenderController.instance.PersonNum) { trueItemCount++; string path = CalenderController.instance.pathList[i]; CalenderItem calenderItem = item.GetComponent <CalenderItem>(); calenderItem.Init(PageIndex, i, path); personList.Add(calenderItem); } else { CalenderItem calenderItem = item.GetComponent <CalenderItem>(); calenderItem.Init(); } i++; yield return(new WaitForSeconds(0.01f)); } if (cb != null) { cb(); } if (CalenderController.instance.IsDelete) { SetDeleteStatus(true); } if (trueItemCount == 0) { CalenderController.instance.DeletePageFunc(this); } }
public async Task <bool> PlanAsync(CalenderItem item) { //var result = await _context.AddAsync(item); //await _context.SaveChangesAsync(); return(true); }
public Task <List <CalenderItem> > GetCalenderItemsAsync() { UserCredential credential; using (var stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read)) { // The file token.json stores the user's access and refresh tokens, and is created // automatically when the authorization flow completes for the first time. string credPath = "token.json"; credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; } // Create Google Calendar API service. var service = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); List <CalenderItem> calenderItems = new List <CalenderItem>(); var calendarList = service.CalendarList.List().Execute(); IList <CalendarListEntry> calItems = calendarList.Items; List <Events> allEvents = new List <Events>(); if (calItems.Count > 0) { foreach (var calItem in calItems) { // Define parameters of request. EventsResource.ListRequest request = service.Events.List(calItem.Id); request.TimeMin = DateTime.Now; request.ShowDeleted = false; request.SingleEvents = true; request.MaxResults = 10; request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime; Events events = request.Execute(); if (events.Items != null && events.Items.Count > 0) { foreach (var eventItem in events.Items) { if (eventItem.Start.DateTime <= DateTime.Today.AddDays(3)) { CalenderItem calenderItem = new CalenderItem(); calenderItem.Summary = eventItem.Summary; calenderItem.ColorId = calItem.BackgroundColor; string when = eventItem.Start.DateTime.ToString(); if (String.IsNullOrEmpty(when)) { when = eventItem.Start.Date; } if (eventItem.Start.DateTime?.Date == DateTime.Today.Date || DateTime.ParseExact(when, "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-GB")) == DateTime.Today.Date) { calenderItem.Date = "Today"; } else if (eventItem.Start.DateTime?.Date == DateTime.Today.AddDays(1).Date || DateTime.ParseExact(when, "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-GB")) == DateTime.Today.AddDays(1).Date) { calenderItem.Date = "Tomorrow"; } else { calenderItem.Date = DateTime.ParseExact(when, "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-GB")).ToString("dd MMMM"); } calenderItem.Time = DateTime.ParseExact(when, "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-GB")).ToString("HH:mm"); calenderItem.DateTime = DateTime.ParseExact(when, "dd/MM/yyyy HH:mm:ss", new CultureInfo("en-GB")).ToString("dd MMMM HH:mm"); if (calenderItems.Count > 0 && calenderItems.Last().Date == calenderItem.Date) { calenderItem.isSameDate = true; } calenderItems.Add(calenderItem); } } } } } calenderItems = calenderItems.OrderBy(c => c.DateTime).ToList(); for (int i = 1; i < calenderItems.Count; i++) { if (calenderItems[i - 1].Date == calenderItems[i].Date) { calenderItems[i].isSameDate = true; } } return(Task.FromResult(calenderItems)); }