void DisplayTimeEntryList(bool open, List<KopsikApi.KopsikTimeEntryViewItem> list) { if (InvokeRequired) { Invoke((MethodInvoker)delegate { DisplayTimeEntryList(open, list); }); return; } int y = 0; this.panelContent.Controls.Clear(); foreach (KopsikApi.KopsikTimeEntryViewItem item in list) { if (item.IsHeader) { TimeEntryCellWithHeader cell = new TimeEntryCellWithHeader(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 82; } else { TimeEntryCell cell = new TimeEntryCell(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 49; } } }
private void fillCells(List<Toggl.TogglTimeEntryView> list, Action<string, TimeEntryCell> registerCellByGUID) { var children = this.panel.Children; // remove superfluous cells if (children.Count > list.Count) { children.RemoveRange(list.Count, children.Count - list.Count); } // update existing cells var i = 0; for (; i < children.Count; i++) { var entry = list[i]; var cell = (TimeEntryCell)children[i]; cell.Display(entry, this); registerCellByGUID(entry.GUID, cell); } // add additional cells for (; i < list.Count; i++) { var entry = list[i]; var cell = new TimeEntryCell(); cell.Display(entry, this); registerCellByGUID(entry.GUID, cell); children.Add(cell); } }
private void setKeyboardHighlight(bool async) { var cell = this.keyboardHighlightedCell; this.cellAboutToKeyboardHighlight = cell; if (async) { this.Dispatcher.BeginInvoke( new Action(this.updateKeyboardHighlightImposter), DispatcherPriority.Background ); } else { this.updateKeyboardHighlightImposter(); } }
void OnTimeEntryList(bool open, List<Toggl.TimeEntry> list) { if (InvokeRequired) { Invoke((MethodInvoker)delegate { OnTimeEntryList(open, list); }); return; } DateTime start = DateTime.Now; int y = 0; List<Control> controls = new List<Control>(); foreach (Toggl.TimeEntry item in list) { if (item.IsHeader) { TimeEntryCellWithHeader cell = new TimeEntryCellWithHeader(y, Width); cell.Setup(item); controls.Add(cell); y += cell.Height; } else { TimeEntryCell cell = new TimeEntryCell(y, Width); cell.Setup(item); controls.Add(cell); y += cell.Height; } } Dock = DockStyle.Fill; EntriesList.SuspendLayout(); EntriesList.Controls.Clear(); EntriesList.Controls.AddRange(controls.ToArray()); EntriesList.ResumeLayout(false); EntriesList.PerformLayout(); TimeSpan spent = DateTime.Now.Subtract(start); Console.WriteLine(String.Format( "Time entries list view rendered in {0} ms", spent.TotalMilliseconds)); }
internal void DrawEntriesList(List<KopsikApi.KopsikTimeEntryViewItem> list) { int y = 0; this.panelContent.Controls.Clear(); foreach (KopsikApi.KopsikTimeEntryViewItem item in list) { if (item.IsHeader) { TimeEntryCellWithHeader cell = new TimeEntryCellWithHeader(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 82; } else { TimeEntryCell cell = new TimeEntryCell(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 49; } } }
public void HighlightCell(TimeEntryCell cell) { if (cell != null && this.panel.IsAncestorOf(cell)) { // y will be 0 if the time entry list hasnt rendered yet var y = cell.TransformToAncestor(this.panel).Transform(new Point(0, 0)).Y + cell.ActualHeight; this.highlightRectangleTop.Height = Math.Max(0, y - 53); this.highlightRectangleBottom.Height = this.panel.ActualHeight - y; this.highlightRectangleTop.Visibility = Visibility.Visible; this.highlightRectangleBottom.Visibility = Visibility.Visible; } else { this.highlightRectangleTop.Height = 0; this.highlightRectangleBottom.Height = 0; this.highlightRectangleTop.Visibility = Visibility.Collapsed; this.highlightRectangleBottom.Visibility = Visibility.Collapsed; cell = null; } if (this.highlightedCell != null) { this.highlightedCell.Selected = false; if (this.highlightedCell == this.keyboardHighlightCellImposter) { this.keyboardHighlightCellImposter.Selected = false; } } this.highlightedCell = cell; if (this.highlightedCell != null) { this.highlightedCell.Selected = true; if (this.highlightedCell == this.keyboardHighlightCellImposter) { this.keyboardHighlightCellImposter.Selected = true; } } }
public void HighlightCell(TimeEntryCell cell) { if (cell != null && this.panel.IsAncestorOf(cell)) { // y will be 0 if the time entry list hasnt rendered yet var y = cell.TransformToAncestor(this.panel).Transform(new Point(0, 0)).Y + cell.ActualHeight; this.highlightRectangleTop.Height = Math.Max(0, y - 53); this.highlightRectangleBottom.Height = Math.Max(0, this.panel.ActualHeight - y); this.highlightRectangleTop.Visibility = Visibility.Visible; this.highlightRectangleBottom.Visibility = Visibility.Visible; } else { this.highlightRectangleTop.Height = 0; this.highlightRectangleBottom.Height = 0; this.highlightRectangleTop.Visibility = Visibility.Collapsed; this.highlightRectangleBottom.Visibility = Visibility.Collapsed; cell = null; } if (this.highlightedCell != null) { this.highlightedCell.Selected = false; if (this.highlightedCell == this.keyboardHighlightCellImposter) { this.keyboardHighlightCellImposter.Selected = false; } } this.highlightedCell = cell; if (this.highlightedCell != null) { this.highlightedCell.Selected = true; if (this.highlightedCell == this.keyboardHighlightCellImposter) { this.keyboardHighlightCellImposter.Selected = true; } } }
internal void DrawEntriesList(List <KopsikApi.KopsikTimeEntryViewItem> list) { int y = 0; this.panelContent.Controls.Clear(); foreach (KopsikApi.KopsikTimeEntryViewItem item in list) { if (item.IsHeader) { TimeEntryCellWithHeader cell = new TimeEntryCellWithHeader(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 82; } else { TimeEntryCell cell = new TimeEntryCell(y); cell.Setup(item); this.panelContent.Controls.Add(cell); y += 49; } } }
private void fillCells(List <Toggl.TogglTimeEntryView> list, Action <string, TimeEntryCell> registerCellByGUID) { var children = this.panel.Children; // remove superfluous cells if (children.Count > list.Count) { children.RemoveRange(list.Count, children.Count - list.Count); } // update existing cells var i = 0; for (; i < children.Count; i++) { var entry = list[i]; var cell = (TimeEntryCell)children[i]; cell.Display(entry, this); registerCellByGUID(entry.GUID, cell); } // add additional cells for (; i < list.Count; i++) { var entry = list[i]; var cell = new TimeEntryCell(); cell.Display(entry, this); registerCellByGUID(entry.GUID, cell); children.Add(cell); } }
public void Imitate(TimeEntryCell cell) { this.guid = cell.guid; this.labelDescription.Text = cell.labelDescription.Text; this.projectColor.Fill = cell.projectColor.Fill; this.labelProject.Foreground = cell.labelProject.Foreground; this.labelProject.Text = cell.labelProject.Text; setOptionalTextBlockText(this.labelClient, cell.labelClient.Text); setOptionalTextBlockText(this.labelTask, cell.labelTask.Text); this.labelDuration.Text = cell.labelDuration.Text; this.billabeIcon.Visibility = cell.billabeIcon.Visibility; this.tagsIcon.Visibility = cell.tagsIcon.Visibility; this.tagsCount.Text = cell.tagsCount.Text; this.projectRow.Height = cell.projectRow.Height; this.entryHoverColor = cell.entryHoverColor; this.EntryBackColor = cell.EntryBackColor; this.unsyncedIcon.Visibility = cell.unsyncedIcon.Visibility; this.imitateTooltips(cell); }
private void updateKeyboardHighlightImposter() { var cell = this.cellAboutToKeyboardHighlight; this.cellAboutToKeyboardHighlight = null; if (cell == null || !this.panel.IsAncestorOf(cell)) { return; } if (cell.DayHeader.IsCollapsed) { this.selectDay(cell.DayHeader); return; } this.selectDay(null); this.keyboardHighlightCellImposter.Imitate(cell); var cellYTop = cell.TransformToAncestor(this.panel).Transform(new Point(0, 0)).Y; var y = Math.Max(0, cellYTop + cell.ActualHeight - 53 - 3); this.keyboardHighlight.Margin = new Thickness(-10, y, -10, 0); this.keyboardHighlight.Visibility = Visibility.Visible; this.imposterVisible = true; cell.BringIntoView(); }
private void hideSelection() { this.keyboardHighlight.Visibility = Visibility.Collapsed; this.imposterVisible = false; this.cellAboutToKeyboardHighlight = null; }
private void imitateTooltips(TimeEntryCell cell) { setToolTipIfNotEmpty(this.labelDescription, this.descriptionToolTip, cell.descriptionToolTip.Content as string); setToolTipIfNotEmpty(this.labelTask, this.taskProjectClientToolTip, cell.taskProjectClientToolTip.Content as string); setToolTipIfNotEmpty(this.labelProject, this.taskProjectClientToolTip, cell.taskProjectClientToolTip.Content as string); setToolTipIfNotEmpty(this.labelClient, this.taskProjectClientToolTip, cell.taskProjectClientToolTip.Content as string); setToolTipIfNotEmpty(this.labelDuration, this.durationToolTip, cell.durationToolTip.Content as string); if (this.tagsIcon.Visibility == Visibility.Visible) { this.tagsToolTip.Content = cell.tagsToolTip.Content; this.tagsIcon.ToolTip = this.tagsToolTip; } }
private void renderTimeEntryList(List<Toggl.TimeEntry> list) { emptyLabel.Visible = (list.Count == 0); entries.SuspendLayout(); for (int i = 0; i < list.Count; i++) { Toggl.TimeEntry te = list.ElementAt(i); TimeEntryCell cell = null; if (entries.Controls.Count > i) { cell = entries.Controls[i] as TimeEntryCell; } if (cell == null) { cell = new TimeEntryCell(); entries.Controls.Add(cell); if (i == 0) { cell.Width = entries.Width; } else { cell.Dock = DockStyle.Top; } } cell.Display(te); entries.Controls.SetChildIndex(cell, i); } while (entries.Controls.Count > list.Count) { entries.Controls.RemoveAt(list.Count); } entries.ResumeLayout(); entries.PerformLayout(); }