public ProjectDetail(Project p) { InitializeComponent (); var timeEntries = App.Toggl.TimeEntry.List (new TimeEntryParams { ProjectId = p.Id }); list.ItemsSource = timeEntries; list.ItemSelected += (sender, e) => { ((ListView)sender).SelectedItem = null; }; var cnt = timeEntries.Count; list.Header = new Label { Text = cnt + " time entr" + (cnt == 1 ? "y" : "ies"), XAlign = TextAlignment.Center }; }
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 StartTimeMeasurementForProject (Project project) { StopTimeMeasurementIfRunning (); _selectedProject = project; selectedProjectText.Text = _selectedProject.Name; Start (startBtn, EventArgs.Empty); }
private void ShowProjectsAndUpdate() { Parallel.Task.Factory .StartNew (() => Device.BeginInvokeOnMainThread (() => { var cnt = _projects.Count; var name = App.User.FullName; list.Header = new Label { Text = string.Format ("{0} Project{1} for {2}", cnt, (cnt == 1 ? "" : "s"), name.Replace("_", " ").Replace("r", "R")), XAlign = TextAlignment.Center }; list.ItemsSource = _projects; list.ItemTapped += (sender, e) => { _selectedProject = e.Item as Project; selectedProjectText.Text = _selectedProject.Name; }; })) .ContinueWith ( (task) => { _projects = new ObservableCollection<Toggl.Project>(App.Toggl.Project.List()); _cache.Remove(ProjectsKey); _cache.Add(ProjectsKey, _projects.ToList()); Device.BeginInvokeOnMainThread (() => { list.ItemsSource = _projects; }); }); }