public EPGDisplay( EPGEntry entry ) { // Set up InitializeComponent(); // Load Text = entry.SubItems[3].Text; lbName.Text = Text; lbTime.Text = string.Format( "{0} - {1}", entry.CompareData[1], entry.CompareData[2] ); lbDescription.Text = entry.SubItems[4].Text; // Check for identifier var identifier = entry.SubItems[5].Text; if (!string.IsNullOrEmpty( identifier )) Text += string.Format( " [{0}]", identifier ); }
public EPGDisplay(EPGEntry entry) { // Set up InitializeComponent(); // Load Text = entry.SubItems[3].Text; lbName.Text = Text; lbTime.Text = string.Format("{0} - {1}", entry.CompareData[1], entry.CompareData[2]); lbDescription.Text = entry.SubItems[4].Text; // Check for identifier var identifier = entry.SubItems[5].Text; if (!string.IsNullOrEmpty(identifier)) { Text += string.Format(" [{0}]", identifier); } }
private void lstEntries_DoubleClick(object sender, EventArgs e) { // Check if (1 != lstEntries.SelectedItems.Count) { return; } // Load EPGEntry entry = lstEntries.SelectedItems[0] as EPGEntry; // None if (null == entry) { return; } // Show using (EPGDisplay dialog = new EPGDisplay(entry)) if (DialogResult.OK == dialog.ShowDialog(this)) { Close(); } }
public int Compare(object x, object y) { // Change type EPGEntry leftObject = x as EPGEntry; EPGEntry rightObject = y as EPGEntry; // Not sortable if (null == rightObject) { if (null == leftObject) { return(0); } else { return(-1); } } else if (null == leftObject) { return(+1); } // Attach to parent ReaderMain main = (ReaderMain)leftObject.ListView.Parent; // Get the sort index int sortIndex = main.SortIndex; bool ascending = (sortIndex > 0); // Correct if (!ascending) { sortIndex = -sortIndex; } // Load IComparable left = (IComparable)leftObject.CompareData[--sortIndex]; object right = rightObject.CompareData[sortIndex]; // Not sortable if (null == right) { if (null == left) { return(0); } else { return(-1); } } else if (null == left) { return(+1); } // Process int result = left.CompareTo(right); // Correct if (ascending) { return(result); } else { return(-result); } }