Exemple #1
0
    void Refresh()
    {
        ClearList();
        DateTime?previous = null;

        foreach (var item in manager.intervals)
        {
            CreateDay(previous, item.start);
            var elem = new TableIntervalPresenter(item, previous, elementPrefab, elementPrefab.height);
            elem.OnEdit += () => HandleIntervalEdit(elem);
            presenters.Add(elem);
            previous = item.finish;
            if (item.start.Date != item.finish.Date)
            {
                CreateDay(item.finish);
            }
        }

        var currentIntervalStart = manager.currentIntervalStart;

        if (currentIntervalStart != null)
        {
            CreateDay(previous, currentIntervalStart.Value);
            var elem = new TableCurrentIntervalPresenter(currentIntervalStart.Value, previous, elementPrefab, elementPrefab.height);
            elem.OnEdit += () => HandleCurrentEdit(elem);
            presenters.Add(elem);
        }
        listBuilder.SetDirty();
    }
Exemple #2
0
 private void HandleDelete(TableIntervalPresenter elem)
 {
     manager.Remove(elem.interval.guid);
     Refresh();
 }
Exemple #3
0
 private void HandleEditDone(TableIntervalPresenter elem, DateTime d1, DateTime d2)
 {
     manager.Edit(elem.interval.guid, d1, d2);
     Refresh();
 }
Exemple #4
0
 private void HandleIntervalEdit(TableIntervalPresenter elem)
 {
     Singleton <EditIntervalUI> .Instance.Open(elem.interval, (d1, d2) => HandleEditDone(elem, d1, d2), null, () => HandleDelete(elem));
 }