internal void UpdateWithShelve(DateTime shelveCreationDate, DateTime startDateTime) { TimeSpan time = TotalTime + (shelveCreationDate - startDateTime); HistoryShelveControl hsc = new HistoryShelveControl(shelveCreationDate); hsc.lblShelveTime.Content = GetFormatedTimeStamp(time); AddRow(); MainGrid.Children.Add(hsc); Grid.SetRow(hsc, numberOfItems); numberOfItems++; }
public void UpdateHistory(HistoryItem history) { if (history == null) { return; } Histories.Add(history); if (history.Type == HistoryType.Start) { HistoryStartItem hstart = new HistoryStartItem(this, history); hstart.Time = TotalTime; hstart.lblStartTime.Content = GetFormatedTimeStamp(TotalTime); if (history.ExtraTime > 0) { hstart.SetLabelValue(history.ExtraTime); } AddRow(); MainGrid.Children.Add(hstart); Grid.SetRow(hstart, numberOfItems); } else if (history.Type == HistoryType.Stop) { var last = Histories.Last(h => h.Type == HistoryType.Start); TotalTime += history.DateTime - last.DateTime + TimeSpan.FromMinutes(last.ExtraTime); HistoryStopItem hstop = new HistoryStopItem(history); hstop.Time = TotalTime; hstop.lblStopTime.Content = GetFormatedTimeStamp(TotalTime); AddRow(); MainGrid.Children.Add(hstop); Grid.SetRow(hstop, numberOfItems); } else { var last = Histories.Last(h => h.Type == HistoryType.Start); TimeSpan time = TotalTime + (history.DateTime - last.DateTime); HistoryShelveControl hsc = new HistoryShelveControl(history.DateTime); hsc.lblShelveTime.Content = GetFormatedTimeStamp(time); AddRow(); MainGrid.Children.Add(hsc); Grid.SetRow(hsc, numberOfItems); } numberOfItems++; }