public void Display(Toggl.TogglTimeEntryView item) { this.guid = item.GUID; this.labelDescription.Text = item.Description == "" ? "(no description)" : item.Description; var projectColorBrush = getProjectColorBrush(ref item); this.projectColor.Fill = projectColorBrush; this.labelProject.Foreground = projectColorBrush; this.labelProject.Text = item.ClientLabel == "" ? item.ProjectLabel : "• " + item.ProjectLabel; setOptionalTextBlockText(this.labelClient, item.ClientLabel); setOptionalTextBlockText(this.labelTask, item.TaskLabel == "" ? "" : item.TaskLabel + " -"); this.labelDuration.Text = item.Duration; showOnlyIf(this.billabeIcon, item.Billable); showOnlyIf(this.tagsIcon, !string.IsNullOrEmpty(item.Tags)); this.projectRow.Height = item.ProjectLabel == "" ? new GridLength(0) : GridLength.Auto; showOnlyIf(this.dayHeader, item.IsHeader); if (item.IsHeader) { this.labelFormattedDate.Text = item.DateHeader; this.labelDateDuration.Text = item.DateDuration; } this.updateToolTips(item); }
public TimeEntryBlock(Toggl.TogglTimeEntryView te, int hourHeight, DateTime date) { _hourHeight = hourHeight; DateCreated = date; _timeEntry = te; OpenEditView = ReactiveCommand.Create(() => Toggl.Edit(TimeEntryId, false, Toggl.Description)); var startEndObservable = this.WhenAnyValue(x => x.VerticalOffset, x => x.Height, (offset, height) => (Started: TimelineUtils.ConvertOffsetToDateTime(offset, date, _hourHeight), Ended: TimelineUtils.ConvertOffsetToDateTime(offset + height, date, _hourHeight))); startEndObservable.Select(tuple => $"{tuple.Started:HH:mm tt} - {tuple.Ended:HH:mm tt}") .ToPropertyEx(this, x => x.StartEndCaption); startEndObservable.Select(tuple => { var duration = tuple.Ended.Subtract(tuple.Started); return(duration.Hours + " h " + duration.Minutes + " min"); }) .ToPropertyEx(this, x => x.Duration); this.WhenAnyValue(x => x.Height) .Select(h => h >= TimelineConstants.MinResizableTimeEntryBlockHeight) .Where(_ => !IsDragged) .ToPropertyEx(this, x => x.IsResizable); this.WhenAnyValue(x => x.IsOverlapping, x => x.Height, (isOverlapping, height) => !isOverlapping && height >= TimelineConstants.MinShowTEDescriptionHeight) .ToPropertyEx(this, x => x.ShowDescription); }
private static SolidColorBrush getProjectColorBrush(ref Toggl.TogglTimeEntryView item) { var colourString = string.IsNullOrEmpty(item.Color) ? "#999999" : item.Color; var color = (Color)(ColorConverter.ConvertFromString(colourString) ?? Color.FromRgb(153, 153, 153)); return(new SolidColorBrush(color)); }
public static TimeEntryLabelViewModel ToTimeEntryLabelViewModel(this Toggl.TogglTimeEntryView item) { return(new TimeEntryLabelViewModel( item.Description, item.ToProjectLabelViewModel(), item.Tags, item.Billable)); }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { using (Performance.Measure("timer responding to OnRunningTimerState")) { SetRunningTimeEntry(te); secondsTimer.IsEnabled = true; } }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { ExperimentHacks.RemoveEmptyStateFirstLine(this, this.parameters); this.parameters.TutorialManager.ActivateScreen <Experiment101Screen>(); Toggl.SendObmAction(this.Id, "seen"); Toggl.OnRunningTimerState -= this.onRunningTimerState; }
private void SetRunningTimeEntry(Toggl.TogglTimeEntryView item) { ResetRunningTimeEntry(true); runningTimeEntry = item; TimeEntryLabelViewModel = item.ToTimeEntryLabelViewModel(); DurationText = Toggl.FormatDurationInSecondsHHMMSS(item.DurationInSeconds); DurationPanelToolTip = "started at " + item.StartTimeString; }
private void onStoppedTimerState() { using (Performance.Measure("timer responding to StoppedTimerState")) { secondsTimer.IsEnabled = false; ResetRunningTimeEntry(false); runningTimeEntry = default(Toggl.TogglTimeEntryView); } }
public static DayHeaderViewModel ToDayHeaderViewModel(this Toggl.TogglTimeEntryView item) { if (!item.IsHeader) { throw new InvalidOperationException("Can only create day header from header time entry view."); } return(new DayHeaderViewModel(item.DateHeader, item.DateDuration)); }
public static ProjectLabelViewModel ToProjectLabelViewModel(this Toggl.TogglTimeEntryView item) { return(new ProjectLabelViewModel( item.ProjectLabel, item.TaskLabel, item.ClientLabel, item.Color, item.WorkspaceName, item.PID, item.TID)); }
private void onLogin(bool open, ulong userId) { if (this.TryBeginInvoke(this.onLogin, open, userId)) { return; } this.timeEntry = new Toggl.TogglTimeEntryView(); this.projects = null; this.clients = null; this.workspaces = null; }
public static bool IsEqualTo( this TimeEntryLabelViewModel timeEntryLabelViewModel, Toggl.TogglTimeEntryView item) { if (timeEntryLabelViewModel == null) { return(false); } return(timeEntryLabelViewModel.Description == item.Description && timeEntryLabelViewModel.Tags == item.Tags && timeEntryLabelViewModel.IsBillable == item.Billable && timeEntryLabelViewModel.ProjectLabel.IsEqualTo(item)); }
private void onStoppedTimerState() { if (this.TryBeginInvoke(this.onStoppedTimerState)) { return; } using (Performance.Measure("timer responding to OnStoppedTimerState")) { this.secondsTimer.IsEnabled = false; this.setUIToStoppedState(); this.runningTimeEntry = default(Toggl.TogglTimeEntryView); } }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { if (this.TryBeginInvoke(this.onRunningTimerState, te)) { return; } using (Performance.Measure("timer responding to OnRunningTimerState")) { this.runningTimeEntry = te; this.setUIToRunningState(te); this.secondsTimer.IsEnabled = true; } }
public static bool IsEqualTo( this ProjectLabelViewModel projectLabelViewModel, Toggl.TogglTimeEntryView item) { if (projectLabelViewModel == null) { return(false); } return(projectLabelViewModel.ProjectName == item.ProjectLabel && projectLabelViewModel.TaskName == item.TaskLabel && projectLabelViewModel.ClientName == item.ClientLabel && projectLabelViewModel.ColorString == item.Color && projectLabelViewModel.WorkspaceName == item.WorkspaceName && projectLabelViewModel.ProjectInfo.ProjectId == item.PID && projectLabelViewModel.ProjectInfo.TaskId == item.TID); }
private void setUIToRunningState(Toggl.TogglTimeEntryView item) { this.resetUIState(true); this.descriptionLabel.Text = item.Description == "" ? "(no description)" : item.Description; this.projectLabel.Text = string.IsNullOrEmpty(item.ClientLabel) ? item.ProjectLabel : "• " + item.ProjectLabel; setOptionalTextBlockText(this.clientLabel, item.ClientLabel); setOptionalTextBlockText(this.taskLabel, string.IsNullOrEmpty(item.TaskLabel) ? "" : item.TaskLabel + " -"); this.projectLabel.Foreground = getProjectColorBrush(ref item); showOnlyIf(this.billabeIcon, item.Billable); showOnlyIf(this.tagsIcon, !string.IsNullOrEmpty(item.Tags)); if (!string.IsNullOrEmpty(item.ProjectLabel)) { this.projectGridRow.Height = new GridLength(1, GridUnitType.Star); } this.invalidate(); }
private void updateToolTips(Toggl.TogglTimeEntryView item) { setToolTipIfNotEmpty(this.labelDescription, this.descriptionToolTip, item.Description); setToolTipIfNotEmpty(this.labelTask, this.taskProjectClientToolTip, item.ProjectAndTaskLabel); setToolTipIfNotEmpty(this.labelProject, this.taskProjectClientToolTip, item.ProjectAndTaskLabel); setToolTipIfNotEmpty(this.labelClient, this.taskProjectClientToolTip, item.ProjectAndTaskLabel); if (item.DurOnly) { this.labelDuration.ToolTip = null; } else { this.labelDuration.ToolTip = this.durationToolTip; this.durationToolTip.Content = item.StartTimeString + " - " + item.EndTimeString; } if (this.tagsIcon.Visibility == Visibility.Visible) { this.tagsToolTip.Content = item.Tags.Replace(Toggl.TagSeparator, ", "); } }
private void onTimeEntryEditor(bool open, Toggl.TogglTimeEntryView timeEntry, string focusedFieldName) { if (this.TryBeginInvoke(this.onTimeEntryEditor, open, timeEntry, focusedFieldName)) { return; } using (Performance.Measure("filling edit view from OnTimeEntryEditor")) { this.timeEntry = timeEntry; var isCurrentlyRunning = timeEntry.DurationInSeconds < 0; this.endTimeTextBox.IsEnabled = !isCurrentlyRunning; if (open) { this.descriptionTextBox.SetText(timeEntry.Description); this.durationTextBox.Text = timeEntry.Duration; setTime(this.startTimeTextBox, timeEntry.StartTimeString); setTime(this.endTimeTextBox, timeEntry.EndTimeString); this.projectTextBox.SetText(timeEntry.ProjectLabel); this.clientTextBox.SetText(timeEntry.ClientLabel); this.startDatePicker.SelectedDate = Toggl.DateTimeFromUnix(timeEntry.Started); } else { setTextIfUnfocused(this.descriptionTextBox, timeEntry.Description); setTextIfUnfocused(this.durationTextBox, timeEntry.Duration); setTimeIfUnfocused(this.startTimeTextBox, timeEntry.StartTimeString); setTimeIfUnfocused(this.endTimeTextBox, timeEntry.EndTimeString); setTextIfUnfocused(this.projectTextBox, timeEntry.ProjectLabel); if (!this.startDatePicker.IsFocused) { this.startDatePicker.SelectedDate = Toggl.DateTimeFromUnix(timeEntry.Started); } } if (isCurrentlyRunning) { this.endTimeTextBox.Text = ""; } this.billableCheckBox.Visibility = timeEntry.CanSeeBillable ? Visibility.Visible : Visibility.Collapsed; this.billableCheckBox.IsChecked = timeEntry.Billable; if (timeEntry.UpdatedAt > 0) { var updatedAt = Toggl.DateTimeFromUnix(timeEntry.UpdatedAt); this.lastUpdatedText.Text = "Last update " + updatedAt.ToShortDateString() + " at " + updatedAt.ToLongTimeString(); this.lastUpdatedText.Visibility = Visibility.Visible; } else { this.lastUpdatedText.Visibility = Visibility.Collapsed; } if (open || !this.tagList.IsKeyboardFocusWithin) { this.tagList.Clear(open); if (timeEntry.Tags != null) { this.tagList.AddTags(timeEntry.Tags.Split(new[] { Toggl.TagSeparator }, StringSplitOptions.RemoveEmptyEntries)); } this.updateTagListEmptyText(); } if (this.isInNewProjectMode) { this.disableNewProjectMode(); } this.projectColorCircle.Background = new SolidColorBrush(getProjectColor(timeEntry.Color)); this.selectedWorkspaceId = timeEntry.WID; this.selectedWorkspaceName = timeEntry.WorkspaceName; if (timeEntry.CanAddProjects) { this.newProjectButton.Visibility = Visibility.Visible; this.projectAddButtonColumn.Width = GridLength.Auto; this.projectAddButtonColumn.SharedSizeGroup = "AddButtons"; } else { this.newProjectButton.Visibility = Visibility.Hidden; this.projectAddButtonColumn.Width = new GridLength(0); this.projectAddButtonColumn.SharedSizeGroup = null; } } }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { if (this.TryBeginInvoke(this.onRunningTimerState, te)) return; using (Performance.Measure("timer responding to OnRunningTimerState")) { this.runningTimeEntry = te; this.setUIToRunningState(te); this.secondsTimer.IsEnabled = true; } }
private void onTimeEntryEditor(bool open, Toggl.TogglTimeEntryView timeEntry, string focusedFieldName) { if (this.TryBeginInvoke(this.onTimeEntryEditor, open, timeEntry, focusedFieldName)) return; using (Performance.Measure("filling edit view from OnTimeEntryEditor")) { var keepNewProjectModeOpen = !open && this.isInNewProjectMode && this.hasTimeEntry() && this.timeEntry.GUID == timeEntry.GUID && this.timeEntry.PID == timeEntry.PID && this.timeEntry.WID == timeEntry.WID && timeEntry.CanAddProjects; if (!keepNewProjectModeOpen && this.hasTimeEntry() && this.isInNewProjectMode) { this.confirmNewProject(); } this.timeEntry = timeEntry; var isCurrentlyRunning = timeEntry.DurationInSeconds < 0; this.endTimeTextBox.IsEnabled = !isCurrentlyRunning; this.setText(this.descriptionTextBox, timeEntry.Description, open); setTime(this.durationTextBox, timeEntry.Duration, open); setTime(this.startTimeTextBox, timeEntry.StartTimeString, open); setTime(this.endTimeTextBox, timeEntry.EndTimeString, open); this.startDatePicker.SelectedDate = Toggl.DateTimeFromUnix(timeEntry.Started); if (isCurrentlyRunning) { this.endTimeTextBox.Text = ""; } this.billableCheckBox.ShowOnlyIf(timeEntry.CanSeeBillable); this.billableCheckBox.IsChecked = timeEntry.Billable; if (timeEntry.UpdatedAt > 0) { var updatedAt = Toggl.DateTimeFromUnix(timeEntry.UpdatedAt); this.lastUpdatedText.Text = "Last update " + updatedAt.ToShortDateString() + " at " + updatedAt.ToLongTimeString(); this.lastUpdatedText.Visibility = Visibility.Visible; } else { this.lastUpdatedText.Visibility = Visibility.Collapsed; } if (open || !this.tagList.IsKeyboardFocusWithin) { this.tagList.Clear(open); if (timeEntry.Tags != null) this.tagList.AddTags(timeEntry.Tags.Split(new[] {Toggl.TagSeparator}, StringSplitOptions.RemoveEmptyEntries)); this.updateTagListEmptyText(); } if (!keepNewProjectModeOpen) { if (this.isInNewProjectMode) this.disableNewProjectMode(); this.projectColorCircle.Background = new SolidColorBrush(getProjectColor(timeEntry.Color)); this.setText(this.projectTextBox, timeEntry.ProjectLabel, open); this.setText(this.clientTextBox, timeEntry.ClientLabel, open); this.selectedWorkspaceId = timeEntry.WID; this.selectedWorkspaceName = timeEntry.WorkspaceName; if (timeEntry.CanAddProjects) { this.newProjectButton.Visibility = Visibility.Visible; this.projectAddButtonColumn.Width = GridLength.Auto; this.projectAddButtonColumn.SharedSizeGroup = "AddButtons"; } else { this.newProjectButton.Visibility = Visibility.Hidden; this.projectAddButtonColumn.Width = new GridLength(0); this.projectAddButtonColumn.SharedSizeGroup = null; } } } }
private void onLogin(bool open, ulong userId) { if (this.TryBeginInvoke(this.onLogin, open, userId)) return; this.timeEntry = new Toggl.TogglTimeEntryView(); this.projects = null; this.clients = null; this.workspaces = null; }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { this.quitTutorial(); }
private void onTimeEntryEditor(bool open, Toggl.TogglTimeEntryView te, string focusedFieldName) { this.activateScreen <BasicTutorialScreen5>(); }
private void openSecondScreenDelayed(Toggl.TogglTimeEntryView te) { this.activateScreen <Experiment98Screen2>(); Toggl.OnRunningTimerState -= this.openSecondScreenDelayed; }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { this.activateScreen <Experiment98Screen2>(); }
private void onStoppedTimerState() { if (this.TryBeginInvoke(this.onStoppedTimerState)) return; using (Performance.Measure("timer responding to OnStoppedTimerState")) { this.secondsTimer.IsEnabled = false; this.setUIToStoppedState(); this.runningTimeEntry = default(Toggl.TogglTimeEntryView); } }
private void onTimerEntryEditor(bool open, Toggl.TogglTimeEntryView te, string focusedFieldName) { this.quitTutorial(); }
private void onTimeEntryEditor(bool open, Toggl.TogglTimeEntryView te, string f) { this.quitTutorial(); }
private void onRunningTimerState(Toggl.TogglTimeEntryView te) { this.tutorialManager.ActivateScreen <BasicTutorialScreen4>(); }
private static SolidColorBrush getProjectColorBrush(ref Toggl.TogglTimeEntryView item) { return(getProjectColorBrush(item.Color)); }