public override void EditList(Noti item, EditType type)
        {
            var noti = item as RealmFriendshipNoti;

            switch (type)
            {
            case EditType.Add:
                if (Notis.FindAll(x => (x as RealmFriendshipNoti).Percentage.Equals(noti.Percentage)).Count == 0)
                {
                    Notis.Add(item);
                    Notis.Sort(SortNotis);
                }
                else
                {
                    DependencyService.Get <IToast>().Show(AppResources.NotiSettingPage_AlreadyExistToast_Message);
                }
                break;

            case EditType.Remove:
                Notis.Remove(Notis.Find(x => (x as RealmFriendshipNoti).Percentage.Equals(noti.Percentage)));
                break;

            case EditType.Edit:
                (Notis[Notis.FindIndex(x => (x as RealmFriendshipNoti).Percentage.Equals(noti.Percentage))] as RealmFriendshipNoti).Percentage = noti.Percentage;
                break;

            default:
                break;
            }

            SaveNotis();
            UpdateScheduledNoti <RealmFriendshipNoti>();
        }
Beispiel #2
0
        public override void EditList(Noti item, EditType type)
        {
            switch (type)
            {
            case EditType.Add:
                item.NotiId = IdPreIndex + Notis.Count;

                Notis.Add(item);
                Notis.Sort(SortNotis);
                break;

            case EditType.Remove:
                Notis.Remove(Notis.Find(x => x.NotiId == item.NotiId));
                break;

            case EditType.Edit:
                int index = Notis.FindIndex(x => x.NotiId == item.NotiId);

                Notis[index] = item;
                Notis[index].UpdateTime();
                break;

            case EditType.EditOnlyTime:
                Notis[Notis.FindIndex(x => x.NotiId == item.NotiId)] = item;
                break;

            default:
                break;
            }

            SaveNotis();
            UpdateScheduledNoti <GardeningNoti>();
        }
Beispiel #3
0
        public override void EditList(Noti item, EditType type)
        {
            switch (type)
            {
            case EditType.Add:
                item.NotiId = ID_PREINDEX + Notis.Count;

                Notis.Add(item);
                Notis.Sort(SortNotis);
                break;

            case EditType.Remove:
                Notis.Remove(Notis.Find(x => x.NotiId.Equals(item.NotiId)));
                break;

            case EditType.Edit:
                var index = Notis.FindIndex(x => x.NotiId.Equals(item.NotiId));

                Notis[index] = item;
                Notis[index].UpdateTime();
                break;

            default:
                break;
            }

            SaveNotis();
            UpdateScheduledNoti <GadgetNoti>();
        }