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; } this.highlightedCell = cell; if (this.highlightedCell != null) { this.highlightedCell.Selected = true; } }
public void HighlightCell(TimeEntryCell cell) { if (cell != null) { var y = cell.TransformToAncestor(this.panel).Transform(new Point(0, 0)).Y + cell.ActualHeight; this.highlightRectangleTop.Height = 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; } if (this.highlightedCell != null) { this.highlightedCell.Selected = false; } this.highlightedCell = cell; if (this.highlightedCell != null) { this.highlightedCell.Selected = true; } }
public void HighlightEntry(string GUID) { this.highlightedGUID = GUID; WPF.TimeEntryCell cell = null; if (GUID != null) { this.cellsByGUID.TryGetValue(GUID, out cell); } this.entries.HighlightCell(cell); }
private void renderTimeEntryList(List <Toggl.TogglTimeEntryView> list) { var previousCount = this.entries.Children.Count; var newCount = list.Count; using (Performance.Measure("rendering time entry list, previous count: {0}, new count: {1}", previousCount, newCount)) { emptyLabel.Visible = (list.Count == 0); this.cellsByGUID.Clear(); int maxCount = list.Count; for (int i = 0; i < maxCount; i++) { Toggl.TogglTimeEntryView te = list[i]; WPF.TimeEntryCell cell = null; if (entries.Children.Count > i) { cell = (TogglDesktop.WPF.TimeEntryCell)entries.Children[i]; } if (cell == null) { cell = new WPF.TimeEntryCell(); entries.Children.Add(cell); } cell.Display(te); this.cellsByGUID.Add(te.GUID, cell); } if (entries.Children.Count > list.Count) { entries.Children.RemoveRange(list.Count, entries.Children.Count - list.Count); } entries.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); entriesHost.Invalidate(); this.refreshHighlight(); } }
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; } }
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.projectRow.Height = cell.projectRow.Height; this.entryHoverColor = cell.entryHoverColor; this.EntryBackColor = cell.EntryBackColor; this.imitateTooltips(cell); }
private void updateKeyboardHighlightImposter() { var cell = this.cellAboutToKeyboardHighlight; this.cellAboutToKeyboardHighlight = null; if (cell == null || !this.panel.IsAncestorOf(cell)) { return; } 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; cell.BringIntoView(); }
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(); } }
private void hideSelection() { this.keyboardHighlight.Visibility = Visibility.Collapsed; this.cellAboutToKeyboardHighlight = null; }
private void renderTimeEntryList(List<Toggl.TogglTimeEntryView> list) { var previousCount = this.entries.Children.Count; var newCount = list.Count; using (Performance.Measure("rendering time entry list, previous count: {0}, new count: {1}", previousCount, newCount)) { emptyLabel.Visible = (list.Count == 0); this.cellsByGUID.Clear(); int maxCount = list.Count; for (int i = 0; i < maxCount; i++) { Toggl.TogglTimeEntryView te = list[i]; WPF.TimeEntryCell cell = null; if (entries.Children.Count > i) { cell = (TogglDesktop.WPF.TimeEntryCell)entries.Children[i]; } if (cell == null) { cell = new WPF.TimeEntryCell(); entries.Children.Add(cell); } cell.Display(te); this.cellsByGUID.Add(te.GUID, cell); } if (entries.Children.Count > list.Count) { entries.Children.RemoveRange(list.Count, entries.Children.Count - list.Count); } entries.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); entriesHost.Invalidate(); this.refreshHighlight(); } }
private void renderTimeEntryList(List<Toggl.TimeEntry> list) { emptyLabel.Visible = (list.Count == 0); this.cellsByGUID.Clear(); int maxCount = list.Count; for (int i = 0; i < maxCount; i++) { Toggl.TimeEntry te = list[i]; WPF.TimeEntryCell cell = null; if (entries.Children.Count > i) { cell = (TogglDesktop.WPF.TimeEntryCell)entries.Children[i]; } if (cell == null) { cell = new WPF.TimeEntryCell(); entries.Children.Add(cell); } cell.Display(te); this.cellsByGUID.Add(te.GUID, cell); } if (entries.Children.Count > list.Count) { entries.Children.RemoveRange(list.Count, entries.Children.Count - list.Count); } entries.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); entriesHost.Invalidate(); entries.RefreshHighLight(); }
private void fillTimeEntryList(List<Toggl.TogglTimeEntryView> list) { var previousCount = this.entries.Children.Count; var newCount = list.Count; var cells = new List<Tuple<string, TimeEntryCell>>(newCount); using (Performance.Measure("rendering time entry list, previous count: {0}, new count: {1}", previousCount, newCount)) { this.cellsByGUID.Clear(); var children = this.entries.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)this.entries.Children[i]; cell.Display(entry); this.cellsByGUID.Add(entry.GUID, cell); cells.Add(Tuple.Create(entry.GUID, cell)); } // add additional cells for (; i < list.Count; i++) { var entry = list[i]; var cell = new TimeEntryCell(); cell.Display(entry); this.cellsByGUID.Add(entry.GUID, cell); cells.Add(Tuple.Create(entry.GUID, cell)); children.Add(cell); } this.entries.FinishedFillingList(); this.entries.SetTimeEntryCellList(cells); this.refreshHighLight(); } }