private void _epgProgramsGridControl_ProgramClicked(object sender, EpgControl.ProgramEventArgs e) { if (this.ProgramClicked != null) { this.ProgramClicked(this, e.Offset(_epgProgramsGridControl.Location)); } }
private int CreateEpgChannelCells(Channel channel, int top) { DateTime startDate = EpgControl.GetEpgStartTime(_model); DateTime endDate = EpgControl.GetEpgEndTime(_model); int cellHeight = 0; int previousRight = 0; if (_model.ProgramsByChannel.ContainsKey(channel.ChannelId)) { bool isTop = (top == 0); cellHeight = isTop ? _height : (_height - 1); foreach (GuideProgramSummary guideProgram in _model.ProgramsByChannel[channel.ChannelId].Programs) { GuideProgramCell cell = new GuideProgramCell(); cell.GuideProgram = guideProgram; cell.Channel = channel; cell.IsTop = isTop; cell.ClipLeft = (guideProgram.StartTime < startDate); cell.ClipRight = (guideProgram.StopTime > endDate); cell.StartTime = cell.ClipLeft ? startDate : guideProgram.StartTime; cell.StopTime = cell.ClipRight ? endDate : guideProgram.StopTime; TimeSpan leftSpan = cell.StartTime - startDate; int left = (int)(leftSpan.TotalMinutes * 4 * _widthFactor); if (left > previousRight) { GuideProgramCell emptyCell = new GuideProgramCell(); emptyCell.Rectangle = new Rectangle(previousRight, top, left - previousRight, cellHeight); _guideProgramCells.Add(emptyCell); } cell.Rectangle = new Rectangle(left, top, (int)(cell.Duration.TotalMinutes * 4 * _widthFactor), cellHeight); _guideProgramCells.Add(cell); previousRight = cell.Rectangle.Right; } } if (previousRight < this.Width) { GuideProgramCell emptyCell = new GuideProgramCell(); emptyCell.Rectangle = new Rectangle(previousRight, top, this.Width, cellHeight); _guideProgramCells.Add(emptyCell); } return(top + cellHeight); }
private void SetTimeIndicator() { DateTime now = DateTime.Now; if (_model != null && EpgControl.GetEpgStartTime(_model) <= now && now <= EpgControl.GetEpgEndTime(_model)) { TimeSpan time = new TimeSpan(now.TimeOfDay.Hours, now.TimeOfDay.Minutes, 0); _epgTimeControl.CursorAtTime = time; _epgProgramsControl.CursorAtTime = time; } else { _epgTimeControl.CursorAtTime = null; _epgProgramsControl.CursorAtTime = null; } }
private void _epgProgramsControl_ProgramContextMenu(object sender, EpgControl.ProgramEventArgs e) { if (this.ProgramContextMenu != null) { this.ProgramContextMenu(this, e.Offset(_epgProgramsControl.Location)); } }