public void Timer1Timer(object sender, EventArgs e) { fRI++; string captionTagList = Convert.ToString(fRI); CaptionTagList = captionTagList; try { if (!fRefreshed) { DateTime tDateTime = DateTime.Now; try { fRefreshed = true; DateTime right = DateTime.Now; DateTime right2 = DateTime.Now; PIBUtils.SessionRangeGen(fCurrentDate, fSession, ref right, ref right2, false); if (!(tDateTime >= right) || !(tDateTime <= right2)) { } else { LoadTrendData(DataLoadKind.dlkByTimer, DateTime.FromOADate(fLastUpdate), tDateTime); } } finally { fRefreshed = false; } } } catch (Exception ex) { PIBUtils.ShowError("Timer1Timer " + ex.Message); } }
private void GetTimeRange(ref DateTime d1, ref DateTime d2) { int itemIndex = cmbPeriod.SelectedIndex; if (itemIndex >= 2) { if (itemIndex == 2) { DateTime dummy = DateTime.Now; PIBUtils.SessionRangeGen(fCurrentDate.AddDays(-7.0), fSession, ref d1, ref dummy, false); PIBUtils.SessionRangeGen(fCurrentDate, fSession, ref dummy, ref d2, false); } } else { PIBUtils.SessionRangeGen(fCurrentDate, fSession, ref d1, ref d2, false); } }