本文整理汇总了C#中MediaPortal.UI.Presentation.DataObjects.ListItem类的典型用法代码示例。如果您正苦于以下问题:C# ListItem类的具体用法?C# ListItem怎么用?C# ListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListItem类属于MediaPortal.UI.Presentation.DataObjects命名空间,在下文中一共展示了ListItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateShutdownItems
protected void UpdateShutdownItems()
{
ISettingsManager sm = ServiceRegistration.Get<ISettingsManager>();
List<SystemStateItem> systemStateItems = sm.Load<SystemStateDialogSettings>().ShutdownItemList;
bool timerActive = false;
Models.SleepTimerModel stm = ServiceRegistration.Get<IWorkflowManager>().GetModel(Consts.WF_STATE_ID_SLEEP_TIMER_MODEL) as Models.SleepTimerModel;
if (stm != null && stm.IsSleepTimerActive == true)
{
timerActive = true;
}
_shutdownItems.Clear();
if (systemStateItems != null)
{
for (int i = 0; i < systemStateItems.Count; i++)
{
SystemStateItem systemStateItem = systemStateItems[i];
if (!systemStateItem.Enabled)
continue;
ListItem item = new ListItem(Consts.KEY_NAME, Consts.GetResourceIdentifierForMenuItem(systemStateItem.Action, timerActive));
item.Command = new MethodDelegateCommand(() => DoAction(systemStateItem.Action));
_shutdownItems.Add(item);
}
}
_shutdownItems.FireChange();
}
示例2: Select
public void Select(ListItem item)
{
if (item == null)
return;
object actionObj;
object mediaItemObj;
if (!item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM_ACTION, out actionObj) || !item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM, out mediaItemObj))
return;
IMediaItemAction action = actionObj as IMediaItemAction;
MediaItem mediaItem = mediaItemObj as MediaItem;
if (action == null || mediaItem == null)
return;
try
{
ContentDirectoryMessaging.MediaItemChangeType changeType;
if (action.Process(mediaItem, out changeType) && changeType != ContentDirectoryMessaging.MediaItemChangeType.None)
{
ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, changeType);
}
}
catch (Exception ex)
{
ServiceRegistration.Get<ILogger>().Error("Error executing MediaItemAction '{0}':", ex, action.GetType());
}
}
示例3: LayoutTypeModel
public LayoutTypeModel()
{
items = new ItemsList();
ListItem listItem = new ListItem(Consts.KEY_NAME, "List")
{
Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.List))
};
listItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.List;
items.Add(listItem);
ListItem gridItem = new ListItem(Consts.KEY_NAME, "Grid")
{
Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.Icons))
};
gridItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.Icons;
items.Add(gridItem);
ListItem coversItem = new ListItem(Consts.KEY_NAME, "Covers")
{
Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.Cover))
};
coversItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.Cover;
items.Add(coversItem);
}
示例4: SettingChanged
protected override void SettingChanged()
{
_items.Clear();
SkinConfigSetting skinSetting = (SkinConfigSetting) _setting;
foreach (SkinManagement.Skin skin in skinSetting.Skins)
{
ListItem skinItem = new ListItem(KEY_NAME, skin.ShortDescription);
skinItem.SetLabel(KEY_TECHNAME, skin.Name);
ISkinResourceBundle resourceBundle;
string preview = skin.GetResourceFilePath(skin.PreviewResourceKey, false, out resourceBundle);
if (preview == null)
{
Theme defaultTheme = skin.DefaultTheme;
if (defaultTheme != null)
preview = defaultTheme.GetResourceFilePath(skin.PreviewResourceKey, false, out resourceBundle);
}
skinItem.SetLabel(KEY_IMAGESRC, preview);
_items.Add(skinItem);
if (skinSetting.CurrentSkinName == skin.Name)
{
skinItem.Selected = true;
_choosenItem = skinItem;
}
}
_items.FireChange();
base.SettingChanged();
}
示例5: RefreshUserList
/// <summary>
/// this will turn the _users list into the _usersExposed list
/// </summary>
private void RefreshUserList()
{
IList<IUser> users = ServiceRegistration.Get<IUserService>().GetUsers();
// clear the exposed users list
Users.Clear();
// add users to expose them
foreach (IUser user in users)
{
if (user == null)
{
continue;
}
ListItem buff = new ListItem();
buff.SetLabel("UserName", user.UserName);
buff.SetLabel("UserImage", user.UserImage);
if (user.NeedsPassword)
{
buff.SetLabel("NeedsPassword", "true");
}
else
{
buff.SetLabel("NeedsPassword", "false");
}
buff.SetLabel("LastLogin", user.LastLogin.ToString("G"));
Users.Add(buff);
}
// tell the skin that something might have changed
Users.FireChange();
}
示例6: ItemCheckedChanged
private bool ItemCheckedChanged(int index, ListItem item)
{
bool isChecked = (bool) item.AdditionalProperties[Consts.KEY_IS_CHECKED];
_shutdownItemList[index].Enabled = isChecked;
return true;
}
示例7: SelectMovie
public static void SelectMovie(ListItem item)
{
var t = new Trailer { Title = (string)item.AdditionalProperties[NAME], Url = (string)item.AdditionalProperties[TRAILER] };
if (t.Url != "")
{
CinemaPlayerHelper.PlayStream(t);
}
}
示例8:
bool IFanartImageSourceProvider.TryCreateFanartImageSource(ListItem listItem, out FanArtImageSource fanartImageSource)
{
SeriesFilterItem series = listItem as SeriesFilterItem;
if (series != null)
{
fanartImageSource = new FanArtImageSource
{
FanArtMediaType = FanArtMediaTypes.Series,
FanArtName = series.SimpleTitle
};
return true;
}
SeriesItem episode = listItem as SeriesItem;
if (episode != null)
{
fanartImageSource = new FanArtImageSource
{
FanArtMediaType = FanArtMediaTypes.Series,
FanArtName = episode.Series
};
return true;
}
MovieFilterItem movieCollection = listItem as MovieFilterItem;
if (movieCollection != null)
{
fanartImageSource = new FanArtImageSource
{
FanArtMediaType = FanArtMediaTypes.MovieCollection,
FanArtName = movieCollection.SimpleTitle
};
return true;
}
MovieItem movie = listItem as MovieItem;
if (movie != null)
{
fanartImageSource = new FanArtImageSource
{
FanArtMediaType = FanArtMediaTypes.Movie,
// Fanart loading now depends on the MediaItemId to support local fanart
FanArtName = movie.MediaItem.MediaItemId.ToString()
};
return true;
}
VideoItem video = listItem as VideoItem;
if (video != null)
{
fanartImageSource = new FanArtImageSource
{
FanArtMediaType = FanArtMediaTypes.Movie,
// Fanart loading now depends on the MediaItemId to support local fanart
FanArtName = video.MediaItem.MediaItemId.ToString()
};
return true;
}
fanartImageSource = null;
return false;
}
示例9: MoveItemUp
private bool MoveItemUp(int index, ListItem item)
{
if (index <= 0 || index >= _shutdownItems.Count)
return false;
Utilities.CollectionUtils.Swap(_shutdownItemList, index, index - 1);
_focusedDownButton = -1;
_focusedUpButton = index - 1;
UpdateShutdownItems();
return true;
}
示例10: MoveItemDown
protected virtual bool MoveItemDown(int index, ListItem item)
{
IPlaylist playlist = _playlist;
if (playlist == null)
return false;
lock (playlist.SyncObj)
{
if (index < 0 || index >= playlist.ItemList.Count - 1)
return false;
playlist.Swap(index, index + 1);
return true;
}
}
示例11: PlatformSelectModel
public PlatformSelectModel()
{
items = new ItemsList();
var platforms = Dropdowns.GetPlatformList();
for (int i = -1; i < platforms.Count; i++)
{
string platformName = i < 0 ? "" : platforms[i].Name;
ListItem item = new ListItem(Consts.KEY_NAME, platformName)
{
Command = new MethodDelegateCommand(() => UpdatePlatform(platformName))
};
item.AdditionalProperties[KEY_PLATFORM] = platformName;
items.Add(item);
}
}
示例12: Init
public static void Init()
{
items.Clear();
var oneItemSelected = false;
foreach (var cd in GoogleMovies.GoogleMovies.Data.List)
{
var item = new ListItem();
item.AdditionalProperties[NAME] = cd.Current.Id;
item.SetLabel("Name", cd.Current.Name + " - " + cd.Current.Address);
items.Add(item);
if (oneItemSelected) continue;
CinemaHome.SelectCinema(cd.Current.Id);
oneItemSelected = true;
}
items.FireChange();
}
示例13: ViewModeModel
public ViewModeModel()
{
ViewSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ViewSettings>();
_layoutTypeProperty = new WProperty(typeof(LayoutType), settings.LayoutType);
_layoutSizeProperty = new WProperty(typeof(LayoutSize), settings.LayoutSize);
ListItem smallList = new ListItem(Consts.KEY_NAME, Consts.RES_SMALL_LIST)
{
Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Small)),
};
smallList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
smallList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Small;
_viewModeItemsList.Add(smallList);
ListItem mediumlList = new ListItem(Consts.KEY_NAME, Consts.RES_MEDIUM_LIST)
{
Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Medium))
};
mediumlList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
mediumlList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Medium;
_viewModeItemsList.Add(mediumlList);
ListItem largeList = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_LIST)
{
Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Large))
};
largeList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
largeList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
_viewModeItemsList.Add(largeList);
ListItem largeGrid = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_GRID)
{
Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.GridLayout, LayoutSize.Large))
};
largeGrid.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.GridLayout;
largeGrid.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
_viewModeItemsList.Add(largeGrid);
ListItem coverLarge = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_COVER)
{
Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.CoverLayout, LayoutSize.Large))
};
coverLarge.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.CoverLayout;
coverLarge.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
_viewModeItemsList.Add(coverLarge);
}
示例14: TryGetAction
private bool TryGetAction(ListItem item, out SystemStateAction action)
{
action = SystemStateAction.Suspend;
if (item == null)
return false;
object oIndex;
if (item.AdditionalProperties.TryGetValue(Consts.KEY_INDEX, out oIndex))
{
int? i = oIndex as int?;
if (i.HasValue)
{
action = ShutdownItemList[i.Value].Action;
return true;
}
}
return false;
}
示例15: ViewModeModel
public ViewModeModel()
{
startupItems = new ItemsList();
var startupStates = StartupStateSetting.StartupStates;
foreach (string key in startupStates.Keys)
{
StartupState state = startupStates[key];
if (state != StartupState.LASTUSED)
{
ListItem item = new ListItem(Consts.KEY_NAME, LocalizationHelper.CreateResourceString(key))
{
Command = new MethodDelegateCommand(() => SetStartupState(state))
};
item.AdditionalProperties[KEY_STARTUP_STATE] = state;
startupItems.Add(item);
}
}
}