当前位置: 首页>>代码示例>>C#>>正文


C# ItemsList.Add方法代码示例

本文整理汇总了C#中ItemsList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ItemsList.Add方法的具体用法?C# ItemsList.Add怎么用?C# ItemsList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemsList的用法示例。


在下文中一共展示了ItemsList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
        }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:25,代码来源:LayoutTypeModel.cs

示例2: InitializeTree

 protected void InitializeTree()
 {
   _tree = new ItemsList();
   TreeItem item = new TreeItem("Name", "First item");
   CreateChildren(item, 2, 3);
   _tree.Add(item);
   item = new TreeItem("Name", "Second item");
   CreateChildren(item, 2, 4);
   _tree.Add(item);
   item = new TreeItem("Name", "Third item");
   CreateChildren(item, 2, 5);
   _tree.Add(item);
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:13,代码来源:TreeViewModel.cs

示例3: showContext

 void showContext()
 {
     ItemsList items = new ItemsList();
     items.Add(new ListItem(Consts.KEY_NAME, "[Emulators.Config.Edit]")
     {
         Command = new MethodDelegateCommand(() => ConfigureEmulatorModel.EditEmulator(emulator))
     });
     ListDialogModel.Instance().ShowDialog(emulator.Title, items);
 }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:9,代码来源:EmulatorViewModel.cs

示例4: CreatePossibleValuesList

        ItemsList CreatePossibleValuesList()
        {
            var result = new ItemsList();
            if (PropertyDescriptor.IsBool)
            {
                var item = new ListItem(Consts.KEY_NAME, new StringId("[System.Yes]")) { Selected = Value == true.ToString() };
                item.AdditionalProperties.Add(KEY_VALUE, true.ToString());
                result.Add(item);

                item = new ListItem(Consts.KEY_NAME, new StringId("[System.No]")) { Selected = Value == false.ToString() };
                item.AdditionalProperties.Add(KEY_VALUE, false.ToString());
                result.Add(item);
            }
            else if (PropertyDescriptor.IsEnum)
            {
                foreach (string e in PropertyDescriptor.GetEnumValues())
                {
                    var item = new ListItem(Consts.KEY_NAME, e) { Selected = Value == e };
                    item.AdditionalProperties.Add(KEY_VALUE, e);
                    result.Add(item);
                }
            }
            return result;
        }
开发者ID:offbyoneBB,项目名称:mp-onlinevideos2,代码行数:24,代码来源:SiteSettingViewModel.cs

示例5: 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);
     }
 }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:15,代码来源:PlatformSelectModel.cs

示例6: 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);
         }
     }
 }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:18,代码来源:ViewModeModel.cs

示例7: GetItems

        protected ItemsList GetItems()
        {
            var model = EmulatorsMainModel.Instance();
            StartupState currentState = model.StartupState;

            bool showPC = Emulator.GetPC().Games.Count > 0;
            if (!showPC && currentState == StartupState.PCGAMES)
                currentState = StartupState.EMULATORS;

            ItemsList items = new ItemsList();
            foreach (ListItem item in startupItems)
            {
                StartupState state;
                if (tryGetStartupState(item.AdditionalProperties, out state))
                {
                    if (state != StartupState.PCGAMES || showPC)
                    {
                        item.Selected = (StartupState)state == currentState;
                        items.Add(item);
                    }
                }
            }
            return items;
        }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:24,代码来源:ViewModeModel.cs

示例8: UpdatePlaylists

 protected void UpdatePlaylists(ItemsList list, List<PlaylistBase> playlistsData, bool selectFirstItem)
 {
   list.Clear();
   bool selectPlaylist = selectFirstItem;
   playlistsData.Sort((a, b) => a.Name.CompareTo(b.Name));
   foreach (PlaylistBase playlistData in playlistsData)
   {
     AVType? avType = ConvertPlaylistTypeToAVType(playlistData.PlaylistType);
     if (!avType.HasValue)
       continue;
     ListItem playlistItem = new ListItem(Consts.KEY_NAME, playlistData.Name);
     playlistItem.AdditionalProperties[Consts.KEY_PLAYLIST_AV_TYPE] = avType.Value;
     playlistItem.AdditionalProperties[Consts.KEY_PLAYLIST_NUM_ITEMS] = playlistData.NumItems;
     playlistItem.AdditionalProperties[Consts.KEY_PLAYLIST_DATA] = playlistData;
     PlaylistBase plCopy = playlistData;
     playlistItem.Command = new MethodDelegateCommand(() => ShowPlaylistInfo(plCopy));
     if (selectPlaylist)
     {
       selectPlaylist = false;
       playlistItem.Selected = true;
     }
     playlistItem.SelectedProperty.Attach(OnPlaylistItemSelectionChanged);
     lock (_syncObj)
       list.Add(playlistItem);
   }
   list.FireChange();
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:27,代码来源:ManagePlaylistsModel.cs

示例9: ChoosePlaybackOptions

		public void ChoosePlaybackOptions(string defaultUrl, Action<string> resultHandler, bool skipDialog = false)
		{
			// with no options set, return the VideoUrl field
			if (VideoInfo.PlaybackOptions == null || VideoInfo.PlaybackOptions.Count == 0)
				resultHandler(defaultUrl);
			// with just one option set, resolve it and call handler
			else if (VideoInfo.PlaybackOptions.Count == 1)
			{
				BackgroundTask.Instance.Start<string>(
					() =>
					{
						return VideoInfo.GetPlaybackOptionUrl(VideoInfo.PlaybackOptions.First().Key);
					},
					(success, url) =>
					{
						if (success)
							resultHandler(url);
					},
					Translation.Instance.GettingPlaybackUrlsForVideo);
			}
			else
			{
				if (skipDialog)
				{
					var defaultOption = VideoInfo.PlaybackOptions.FirstOrDefault(p => p.Value == defaultUrl).Key;
					if (string.IsNullOrEmpty(defaultOption)) defaultOption = VideoInfo.PlaybackOptions.First().Key;
					BackgroundTask.Instance.Start<string>(
						() =>
						{
							return VideoInfo.GetPlaybackOptionUrl(defaultOption);
						},
						(success, url) =>
						{
							if (success)
								resultHandler(url);
						},
						Translation.Instance.GettingPlaybackUrlsForVideo);
				}
				else
				{
					var playbackOptionsItems = new ItemsList();
					foreach (var item in VideoInfo.PlaybackOptions)
					{
						var listItem = new ListItem(Consts.KEY_NAME, item.Key);
						listItem.AdditionalProperties.Add(Constants.KEY_HANDLER, resultHandler);
						listItem.Selected = item.Value == defaultUrl;
						playbackOptionsItems.Add(listItem);
					}

					ServiceRegistration.Get<IWorkflowManager>().NavigatePushTransient(
						WorkflowState.CreateTransientState("PlaybackOptions", VideoInfo.Title, true, "ovsDialogGenericItems", false, WorkflowType.Dialog),
						new NavigationContextConfig()
						{
							AdditionalContextVariables = new Dictionary<string, object>
						{
							{ Constants.CONTEXT_VAR_ITEMS, playbackOptionsItems },
							{ Constants.CONTEXT_VAR_COMMAND, new CommandContainer<ListItem>(SelectPlaybackOption) }
						}
						});
				}
			}
		}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:62,代码来源:VideoViewModel.cs

示例10: UpdateRepeatModes

    protected void UpdateRepeatModes()
    {
      _repeatModeItems = new ItemsList();
      ListItem noneItem = new ListItem(Consts.KEY_NAME, Consts.RES_REPEATMODE_NONE)
        {
            Command = new MethodDelegateCommand(() => SetRepeatMode(RepeatMode.None))
        };
      noneItem.AdditionalProperties[Consts.KEY_REPEATMODE] = RepeatMode.None;
      _repeatModeItems.Add(noneItem);

      ListItem allItem = new ListItem(Consts.KEY_NAME, Consts.RES_REPEATMODE_ALL)
        {
            Command = new MethodDelegateCommand(() => SetRepeatMode(RepeatMode.All))
        };
      allItem.AdditionalProperties[Consts.KEY_REPEATMODE] = RepeatMode.All;
      _repeatModeItems.Add(allItem);

      ListItem oneItem = new ListItem(Consts.KEY_NAME, Consts.RES_REPEATMODE_ONE)
        {
            Command = new MethodDelegateCommand(() => SetRepeatMode(RepeatMode.One))
        };
      oneItem.AdditionalProperties[Consts.KEY_REPEATMODE] = RepeatMode.One;
      _repeatModeItems.Add(oneItem);
    }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:24,代码来源:ShowPlaylistModel.cs

示例11: UpdatePlayModes

    protected void UpdatePlayModes()
    {
      _playModeItems = new ItemsList();
      ListItem continuousItem = new ListItem(Consts.KEY_NAME, Consts.RES_PLAYMODE_CONTINUOUS)
        {
            Command = new MethodDelegateCommand(() => SetPlayMode(PlayMode.Continuous))
        };
      continuousItem.AdditionalProperties[Consts.KEY_PLAYMODE] = PlayMode.Continuous;
      _playModeItems.Add(continuousItem);

      ListItem shuffleItem = new ListItem(Consts.KEY_NAME, Consts.RES_PLAYMODE_SHUFFLE)
        {
            Command = new MethodDelegateCommand(() => SetPlayMode(PlayMode.Shuffle))
        };
      shuffleItem.AdditionalProperties[Consts.KEY_PLAYMODE] = PlayMode.Shuffle;
      _playModeItems.Add(shuffleItem);
    }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:17,代码来源:ShowPlaylistModel.cs

示例12: FillChannelGroupList

    protected void FillChannelGroupList()
    {
      if (_channelGroups == null)
        return;

      _channelGroupList = new ItemsList();
      for (int idx = 0; idx < _channelGroups.Count; idx++)
      {
        IChannelGroup group = _channelGroups[idx];
        int selIdx = idx;
        ListItem channelGroupItem = new ListItem(UiComponents.Media.General.Consts.KEY_NAME, group.Name)
        {
          Command = new MethodDelegateCommand(() => SetGroup(selIdx)),
          Selected = selIdx == _webChannelGroupIndex
        };
        _channelGroupList.Add(channelGroupItem);
      }
      _channelGroupList.FireChange();
    }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:19,代码来源:SlimTvModelBase.cs

示例13: GetProgramsList

        protected ItemsList GetProgramsList(IChannel channel, DateTime referenceStart, DateTime referenceEnd)
        {
            ItemsList channelPrograms = new ItemsList();
              if (_tvHandler.ProgramInfo.GetPrograms(channel, referenceStart, referenceEnd, out _programs))
              {
            foreach (IProgram program in _programs)
            {
              // Use local variable, otherwise delegate argument is not fixed
              ProgramProperties programProperties = new ProgramProperties(GuideStartTime, GuideEndTime);
              IProgram currentProgram = program;
              programProperties.SetProgram(currentProgram);

              ProgramListItem item = new ProgramListItem(programProperties)
                                   {
                                     Command = new MethodDelegateCommand(() => ShowProgramActions(currentProgram))
                                   };
              item.AdditionalProperties["PROGRAM"] = currentProgram;

              channelPrograms.Add(item);
            }
              }
              else
            channelPrograms.Add(NoProgramPlaceholder());
              return channelPrograms;
        }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-2,代码行数:25,代码来源:SlimTvMultiChannelGuideModel.cs

示例14: ShowLoadThemeDialog

 public static void ShowLoadThemeDialog()
 {
   IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>();
   SkinManager skinManager = ServiceRegistration.Get<ISkinResourceManager>() as SkinManager;
   if (skinManager == null)
     return;
   string currentSkinName = screenManager.CurrentSkinResourceBundle.SkinName;
   Skin currentSkin;
   if (!skinManager.Skins.TryGetValue(currentSkinName, out currentSkin))
     return;
   ItemsList themeItems = new ItemsList();
   foreach (Theme theme in currentSkin.Themes.Values)
   {
     if (!theme.IsValid)
       continue;
     string themeName = theme.Name;
     ListItem themeItem = new ListItem(Consts.KEY_NAME, themeName)
       {
           Command = new MethodDelegateCommand(() => screenManager.SwitchSkinAndTheme(null, themeName))
       };
     themeItems.Add(themeItem);
   }
   ShowDialog(Consts.RES_LOAD_THEME_TITLE, themeItems);
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:24,代码来源:LoadSkinThemeModel.cs

示例15: contextCommandDelegate

        void contextCommandDelegate()
        {
            Importer importer = ServiceRegistration.Get<IEmulatorsService>().Importer;
            RomMatchStatus status = romMatch.Status;
            ItemsList items = new ItemsList();
            if ((status == RomMatchStatus.Approved || status == RomMatchStatus.NeedsInput) && romMatch.PossibleGameDetails != null && romMatch.PossibleGameDetails.Count > 0)
            {
                items.Add(new ListItem(Consts.KEY_NAME, "[Emulators.Import.Approve]")
                {
                    Command = new MethodDelegateCommand(() => { importer.Approve(romMatch); })
                });
            }

            items.Add(new ListItem(Consts.KEY_NAME, "[Emulators.Import.ManualSearch]")
            {
                Command = new MethodDelegateCommand(() => 
                {
                    TextInputModel.Instance().ShowDialog("[Emulators.Import.Search]", romMatch.Filename, "[Emulators.Import.Search]", t => 
                    {
                        if (t != romMatch.SearchTitle)
                        {
                            romMatch.SearchTitle = t;
                            importer.ReProcess(romMatch);
                        }
                    });
                })
            });

            items.Add(new ListItem(Consts.KEY_NAME, "[Emulators.Import.AddAsBlankGame]")
            {
                Command = new MethodDelegateCommand(() => { importer.Ignore(romMatch); })
            });

            items.Add(new ListItem(Consts.KEY_NAME, "[Emulators.Import.Delete]")
            {
                Command = new MethodDelegateCommand(() => 
                {
                    Game game = romMatch.Game;
                    foreach (GameDisc disc in game.Discs)
                        EmulatorsCore.Options.AddIgnoreFile(disc.Path);
                    game.Delete();
                })
            });

            ListDialogModel.Instance().ShowDialog(romMatch.Filename, items);
        }
开发者ID:ministerkrister,项目名称:Emulators,代码行数:46,代码来源:RomMatchViewModel.cs


注:本文中的ItemsList.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。