internal void Load(string filePath) { using (FileStream fs = new FileStream(filePath, FileMode.Open)) { XmlSerializer xs = new XmlSerializerFactory().CreateSerializer(this.GetType()); Estimates estimates = xs.Deserialize(fs) as Estimates; if (estimates != null) { this.Duration = estimates.Duration; this.RemainingTime = estimates.RemainingTime; this.ElapsedTime = estimates.ElapsedTime; } } }
public void UpdateEstimates(string reason) { TimeSpan interval = StopTime.Value.Subtract(StartTime); Estimates.ElapsedTime += interval.TotalHours; Estimates.RemainingTime -= interval.TotalHours; if (Estimates.RemainingTime < 0) { Estimates.RemainingTime = 0d; } UpdateWorkItem(false); WorkItem.Save(); Estimates.Save(Estimates.GetFilePath(WorkItem.Store.TeamProjectCollection.Uri.Host, WorkItem.Id)); }