Inheritance: Toggl.DataObjects.BaseDataObject
Exemplo n.º 1
0
		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);
		}
Exemplo n.º 2
0
		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;
			});
		}
Exemplo n.º 3
0
		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;
					});
		}