} // GetSuggestedSortColumns public static UiBroadcastListColumn GetSuggestedNextSortColumn(UiBroadcastListColumn column) { switch (column) { case UiBroadcastListColumn.None: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.Name: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.Number: return(UiBroadcastListColumn.Name); case UiBroadcastListColumn.NumberAndName: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.NumberAndNameCrlf: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.NameAndNumber: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.Description: return(UiBroadcastListColumn.Name); case UiBroadcastListColumn.DvbType: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.LocationUrl: return(UiBroadcastListColumn.DvbType); case UiBroadcastListColumn.ShortName: return(UiBroadcastListColumn.Name); case UiBroadcastListColumn.Genre: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.GenreCode: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.ParentalRating: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.ParentalRatingCode: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.ServiceId: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.FullServiceId: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.UserName: return(UiBroadcastListColumn.OriginalName); case UiBroadcastListColumn.UserNumber: return(UiBroadcastListColumn.Name); case UiBroadcastListColumn.OriginalName: return(UiBroadcastListColumn.None); case UiBroadcastListColumn.OriginalNumber: return(UiBroadcastListColumn.Name); case UiBroadcastListColumn.IsActive: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.IsEnabled: return(UiBroadcastListColumn.Number); case UiBroadcastListColumn.LockLevel: return(UiBroadcastListColumn.Number); default: throw new IndexOutOfRangeException(); } // switch } // GetSuggestedNextSortColumn
} // SortedColumnNames public static string GetColumnName(UiBroadcastListColumn column) { switch (column) { case UiBroadcastListColumn.Number: return(Properties.ListViewManager.ColumnNumberShort); case UiBroadcastListColumn.Name: return(Properties.ListViewManager.ColumnNameShort); case UiBroadcastListColumn.NumberAndName: return(Properties.ListViewManager.ColumnNumberAndNameShort); case UiBroadcastListColumn.NumberAndNameCrlf: return(Properties.ListViewManager.ColumnNumberAndNameShort); case UiBroadcastListColumn.NameAndNumber: return(Properties.ListViewManager.ColumnNameAndNumberShort); case UiBroadcastListColumn.Description: return(Properties.ListViewManager.ColumnDescriptionShort); case UiBroadcastListColumn.DvbType: return(Properties.ListViewManager.ColumnDvbTypeShort); case UiBroadcastListColumn.LocationUrl: return(Properties.ListViewManager.ColumnLocationUrlShort); case UiBroadcastListColumn.ShortName: return(Properties.ListViewManager.ColumnShortNameShort); case UiBroadcastListColumn.Genre: return(Properties.ListViewManager.ColumnGenreShort); case UiBroadcastListColumn.GenreCode: return(Properties.ListViewManager.ColumnGenreCodeShort); case UiBroadcastListColumn.ParentalRating: return(Properties.ListViewManager.ColumnParentalRatingShort); case UiBroadcastListColumn.ParentalRatingCode: return(Properties.ListViewManager.ColumnParentalRatingCodeShort); case UiBroadcastListColumn.ServiceId: return(Properties.ListViewManager.ColumnServiceIdShort); case UiBroadcastListColumn.FullServiceId: return(Properties.ListViewManager.ColumnFullServiceIdShort); case UiBroadcastListColumn.UserName: return(Properties.ListViewManager.ColumnUserNameShort); case UiBroadcastListColumn.UserNumber: return(Properties.ListViewManager.ColumnUserNumberShort); case UiBroadcastListColumn.OriginalName: return(Properties.ListViewManager.ColumnOriginalNameShort); case UiBroadcastListColumn.OriginalNumber: return(Properties.ListViewManager.ColumnOriginalNumberShort); case UiBroadcastListColumn.IsActive: return(Properties.ListViewManager.ColumnIsActiveShort); case UiBroadcastListColumn.IsEnabled: return(Properties.ListViewManager.ColumnIsEnabledShort); case UiBroadcastListColumn.LockLevel: return(Properties.ListViewManager.ColumnLockLevelShort); default: throw new IndexOutOfRangeException(); } // switch } // GetColumnName
} // GetColumnName public static int GetColumnDefaultWidth(UiBroadcastListColumn column) { switch (column) { case UiBroadcastListColumn.Number: return(45); case UiBroadcastListColumn.Name: return(180); case UiBroadcastListColumn.NumberAndName: return(210); case UiBroadcastListColumn.NumberAndNameCrlf: return(210); case UiBroadcastListColumn.NameAndNumber: return(210); case UiBroadcastListColumn.Description: return(170); case UiBroadcastListColumn.DvbType: return(90); case UiBroadcastListColumn.LocationUrl: return(150); case UiBroadcastListColumn.ShortName: return(90); case UiBroadcastListColumn.Genre: return(150); case UiBroadcastListColumn.GenreCode: return(100); case UiBroadcastListColumn.ParentalRating: return(150); case UiBroadcastListColumn.ParentalRatingCode: return(100); case UiBroadcastListColumn.ServiceId: return(75); case UiBroadcastListColumn.FullServiceId: return(150); case UiBroadcastListColumn.UserName: return(180); case UiBroadcastListColumn.UserNumber: return(45); case UiBroadcastListColumn.OriginalName: return(180); case UiBroadcastListColumn.OriginalNumber: return(45); case UiBroadcastListColumn.IsActive: return(45); case UiBroadcastListColumn.IsEnabled: return(45); case UiBroadcastListColumn.LockLevel: return(120); default: throw new IndexOutOfRangeException(); } // switch } // GetColumnDefaultWidth
} // Compare public static List <UiBroadcastListSortColumn> GetSuggestedSortColumns(UiBroadcastListColumn column, bool ascending, int max) { var sortColumn = column; var result = new List <UiBroadcastListSortColumn>(max); var loop = 0; do { result.Add(new UiBroadcastListSortColumn(sortColumn, !ascending)); sortColumn = GetSuggestedNextSortColumn(sortColumn); loop++; }while ((sortColumn != UiBroadcastListColumn.None) && (loop < max)); return(result); } // GetSuggestedSortColumns
} // CompareSortColumns private int GetColumnWidth(UiBroadcastListColumn column) { var width = Settings.ColumnWidth[(int)column]; if (width <= 0) { return(GetColumnDefaultWidth(column)); } else if (width < MinColumnWidth) { return(MinColumnWidth); } else { return(width); } } // GetColumnWidth
} // GetColumnDefaultWidth public static string GetColumnData(UiBroadcastService service, UiBroadcastListColumn column) { switch (column) { case UiBroadcastListColumn.Number: return(service.DisplayLogicalNumber); case UiBroadcastListColumn.Name: return(service.DisplayName); case UiBroadcastListColumn.NumberAndName: return(string.Format(Properties.ListViewManager.NumberAndNameFormat, service.DisplayLogicalNumber, service.DisplayName)); case UiBroadcastListColumn.NumberAndNameCrlf: return(string.Format(Properties.ListViewManager.NumberAndNameCrlfFormat, service.DisplayLogicalNumber, service.DisplayName)); case UiBroadcastListColumn.NameAndNumber: return(string.Format(Properties.ListViewManager.NameAndNumberFormat, service.DisplayName, service.DisplayLogicalNumber)); case UiBroadcastListColumn.Description: return(service.DisplayDescription); case UiBroadcastListColumn.DvbType: return(service.DisplayServiceType); case UiBroadcastListColumn.LocationUrl: return(service.DisplayLocationUrl); case UiBroadcastListColumn.ShortName: return(service.DisplayShortName); case UiBroadcastListColumn.Genre: return(service.DisplayGenre); case UiBroadcastListColumn.GenreCode: return(service.DisplayGenreCode); case UiBroadcastListColumn.ParentalRating: return(service.DisplayParentalRating); case UiBroadcastListColumn.ParentalRatingCode: return(service.DisplayParentalRatingCode); case UiBroadcastListColumn.ServiceId: return(service.ServiceName); case UiBroadcastListColumn.FullServiceId: return(service.FullServiceName); case UiBroadcastListColumn.UserName: return(service.UserDisplayName ?? ""); case UiBroadcastListColumn.UserNumber: return(service.UserLogicalNumber ?? Properties.Texts.ChannelNumberNone); case UiBroadcastListColumn.OriginalName: return(service.DisplayOriginalName); case UiBroadcastListColumn.OriginalNumber: return(service.ServiceLogicalNumber ?? Properties.Texts.ChannelNumberNone); case UiBroadcastListColumn.IsActive: return((service.IsInactive) ? Properties.Texts.No : Properties.Texts.Yes); case UiBroadcastListColumn.IsEnabled: return((service.IsHidden) ? Properties.Texts.No : Properties.Texts.Yes); case UiBroadcastListColumn.LockLevel: return(service.DisplayLockLevel); default: throw new IndexOutOfRangeException(); } // switch } // GetColumnData
public UiBroadcastListSortColumn(UiBroadcastListColumn column, bool descending) : this() { Column = column; Descending = (column == UiBroadcastListColumn.None)? false : descending; } // constructor