예제 #1
0
        private void fillDays(List <List <Toggl.TogglTimeEntryView> > days, Action <string, TimeEntryCell> registerCellByGUID)
        {
            var children = this.Entries.Children;

            // remove superfluous days
            if (children.Count > days.Count)
            {
                children.RemoveRange(days.Count, children.Count - days.Count);
            }

            // update existing days
            var i = 0;

            for (; i < children.Count; i++)
            {
                var day = days[i];

                var header = (TimeEntryCellDayHeader)children[i];
                header.Display(day, registerCellByGUID);
            }

            // add additional days
            for (; i < days.Count; i++)
            {
                var day = days[i];

                var header = new TimeEntryCellDayHeader();
                header.Display(day, registerCellByGUID);

                children.Add(header);
            }
        }
        private void fillDays(List <List <Toggl.TogglTimeEntryView> > days, Action <string, TimeEntryCell> registerCellByGUID)
        {
            var children = this.Entries.Children;

            Dictionary <string, bool> isCollapsed =
                new Dictionary <string, bool>();
            var i = 0;

            // remember which days were collapsed
            if (children.Count > 0)
            {
                for (; i < children.Count; i++)
                {
                    var header = (TimeEntryCellDayHeader)children[i];
                    isCollapsed.Add(header.dateHeader, header.IsCollapsed);
                }
            }

            // remove superfluous days
            if (children.Count > days.Count)
            {
                children.RemoveRange(days.Count, children.Count - days.Count);
            }

            // update existing days
            i = 0;
            for (; i < children.Count; i++)
            {
                var collapsed = false;
                var day       = days[i];
                var item      = (Toggl.TogglTimeEntryView)day[0];

                isCollapsed.TryGetValue(item.DateHeader, out collapsed);

                var header = (TimeEntryCellDayHeader)children[i];
                header.Display(day, registerCellByGUID, collapsed);
            }

            // add additional days
            for (; i < days.Count; i++)
            {
                var day = days[i];

                var header = new TimeEntryCellDayHeader();
                header.Display(day, registerCellByGUID, false);

                children.Add(header);
            }
        }
예제 #3
0
        public void Display(Toggl.TogglTimeEntryView item, TimeEntryCellDayHeader dayHeader)
        {
            this.guid      = item.GUID;
            this.DayHeader = dayHeader;

            this.labelDescription.Text = item.Description == "" ? "(no description)" : item.Description;

            var projectColorBrush = Utils.ProjectColorBrushFromString(item.Color);

            this.projectColor.Fill       = projectColorBrush;
            this.labelProject.Foreground = projectColorBrush;
            this.labelProject.Text       = item.ClientLabel.IsNullOrEmpty() ? item.ProjectLabel : "• " + item.ProjectLabel;
            setOptionalTextBlockText(this.labelClient, item.ClientLabel);
            setOptionalTextBlockText(this.labelTask, item.TaskLabel.IsNullOrEmpty() ? "" : item.TaskLabel + " -");
            this.labelDuration.Text = item.Duration;
            this.billabeIcon.ShowOnlyIf(item.Billable);

            this.confirmlessDelete = (item.Description.Length == 0 &&
                                      item.DurationInSeconds < 15 && item.PID == 0);

            if (string.IsNullOrEmpty(item.Tags))
            {
                this.tagsIcon.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.tagsIcon.Visibility = Visibility.Visible;
                this.tagsCount.Text      = item.Tags.CountSubstrings(Toggl.TagSeparator).ToString();
            }

            this.projectRow.Height = item.ProjectLabel == "" ? new GridLength(0) : GridLength.Auto;

            this.entrySeperator.ShowOnlyIf(!item.IsHeader);

            this.entryHoverColor = hoverColor;
            this.EntryBackColor  = idleBackColor;

            this.unsyncedIcon.ShowOnlyIf(item.Unsynced);
            this.lockedIcon.ShowOnlyIf(item.Locked);

            this.updateToolTips(item);

            this.setupGroupedMode(item);
        }
        private void selectDay(TimeEntryCellDayHeader dayHeader)
        {
            if (this.selectedDay != null)
            {
                this.selectedDay.IsSelected = false;
            }

            this.selectedDay = dayHeader;

            if (dayHeader == null)
            {
                return;
            }


            dayHeader.IsSelected = true;
            dayHeader.BringIntoView();
            this.hideSelection();
        }
예제 #5
0
        private void selectDay(TimeEntryCellDayHeader dayHeader)
        {
            if (this.selectedDay != null)
            {
                this.selectedDay.IsSelected = false;
            }

            this.selectedDay = dayHeader;

            if (dayHeader == null)
            {
                return;
            }


            dayHeader.IsSelected = true;
            dayHeader.BringIntoView();
            this.hideSelection();
        }
예제 #6
0
        public void Display(Toggl.TogglTimeEntryView item, TimeEntryCellDayHeader dayHeader)
        {
            this.guid = item.GUID;
            this.DayHeader = dayHeader;

            this.labelDescription.Text = item.Description == "" ? "(no description)" : item.Description;

            var projectColorBrush = Utils.ProjectColorBrushFromString(item.Color);

            this.projectColor.Fill = projectColorBrush;
            this.labelProject.Foreground = projectColorBrush;
            this.labelProject.Text = item.ClientLabel.IsNullOrEmpty() ? item.ProjectLabel : "• " + item.ProjectLabel;
            setOptionalTextBlockText(this.labelClient, item.ClientLabel);
            setOptionalTextBlockText(this.labelTask, item.TaskLabel.IsNullOrEmpty() ? "" : item.TaskLabel + " -");
            this.labelDuration.Text = item.Duration;
            this.billabeIcon.ShowOnlyIf(item.Billable);

            if (string.IsNullOrEmpty(item.Tags))
            {
                this.tagsIcon.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.tagsIcon.Visibility = Visibility.Visible;
                this.tagsCount.Text = item.Tags.CountSubstrings(Toggl.TagSeparator).ToString();
            }

            this.projectRow.Height = item.ProjectLabel == "" ? new GridLength(0) : GridLength.Auto;

            this.entrySeperator.ShowOnlyIf(!item.IsHeader);

            this.entryHoverColor = hoverColor;
            this.EntryBackColor = idleBackColor;

            this.unsyncedIcon.ShowOnlyIf(item.Unsynced);

            this.updateToolTips(item);
        }
예제 #7
0
        private void fillDays(List<List<Toggl.TogglTimeEntryView>> days, Action<string, TimeEntryCell> registerCellByGUID)
        {
            var children = this.Entries.Children;

            // remove superfluous days
            if (children.Count > days.Count)
            {
                children.RemoveRange(days.Count, children.Count - days.Count);
            }

            // update existing days
            var i = 0;
            for (; i < children.Count; i++)
            {
                var day = days[i];

                var header = (TimeEntryCellDayHeader)children[i];
                header.Display(day, registerCellByGUID);
            }

            // add additional days
            for (; i < days.Count; i++)
            {
                var day = days[i];

                var header = new TimeEntryCellDayHeader();
                header.Display(day, registerCellByGUID);

                children.Add(header);
            }
        }