public TimeSplitter() { // ToDo: letzten Projekte laden //_projects = ReadProjectsFromLastRun(); if (_projects.Count < 1) { _projects.Add(0, new Project(0, Properties.Settings.Default.Project0)); _projects.Add(1, new Project(1, Properties.Settings.Default.Project1)); _projects.Add(2, new Project(2, Properties.Settings.Default.Project2)); _projects.Add(3, new Project(3, Properties.Settings.Default.Project3)); _projects.Add(4, new Project(4, Properties.Settings.Default.Project4)); _projects.Add(5, new Project(5, Properties.Settings.Default.Project5)); _projects.Add(6, new Project(6, Properties.Settings.Default.Project6)); _projects.Add(7, new Project(7, Properties.Settings.Default.Project7)); } _currentProject = Projects[0]; _lastStateChange = DateTime.Now; }
//private void FireEvent() //{ // OnMinute(); //} public TimeSpan GetTimeSpan(Project project) { if (project.Equals(_currentProject)) return _projects[project.Id].ElapsedTime.Add(DateTime.Now - _lastStateChange); else return _projects[project.Id].ElapsedTime; }
public void FocusOnProject(int id) { //_currentProject.AddSeconds(new TimeSpan(DateTime.Now.Ticks - _lastStateChange.Ticks).Seconds); _currentProject.AddSlice(_lastStateChange, DateTime.Now); _currentProject = _projects[id]; _lastStateChange = DateTime.Now; }
public void AddNewProject(Project project) { _projects.Add(project.Id, project); }