private void AddTimeEntry(Project project) { _startedDateTime = DateTime.Now; var entry = new TimeEntry { IsBillable = false, CreatedWith = "TogglAPI.Net", Start = _startedDateTime.Value.ToIsoDateStr (), Duration = _startedDateTime.Value.ToTogglStartDuration (), WorkspaceId = project.WorkspaceId, ProjectId = project.Id }; _startedTimeEntry = App.Toggl.TimeEntry.Add (entry); }
private void InitCurrentEntry() { var currentEntry = App.Toggl.TimeEntry.Current(); if (currentEntry.Id.HasValue) { _startedTimeEntry = currentEntry; _startedDateTime = currentEntry.Start.TogglDateTimeWorkAround (); } Device.BeginInvokeOnMainThread (() => { startBtn.IsEnabled = _startedTimeEntry == null; startBtn.IsVisible = _startedTimeEntry == null; stopBtn.IsVisible = _startedTimeEntry != null; }); }
public void Stop(object sender, EventArgs e) { var btn = ((Button)sender); btn.IsVisible = false; Parallel.Task.Factory .StartNew (() => EditTimeEntry ()) .ContinueWith ((entry) => { ChangeButtonVisibility (startBtn); _startedTimeEntry = null; _startedDateTime = null; }); }