示例#1
0
        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 };
        }
示例#2
0
文件: Main.xaml.cs 项目: 0rupp/XToggl
		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);
		}
示例#3
0
文件: Main.xaml.cs 项目: 0rupp/XToggl
		private void StartTimeMeasurementForProject (Project project)
		{
			StopTimeMeasurementIfRunning ();

			_selectedProject = project;
			selectedProjectText.Text = _selectedProject.Name;

			Start (startBtn, EventArgs.Empty);
		}
示例#4
0
文件: Main.xaml.cs 项目: 0rupp/XToggl
		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;
					});
				});
		}