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


C# ItemsList.Clear方法代码示例

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


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

示例1: Filter

    public void Filter(ItemsList filterList, ItemsList originalList, string search)
    {
      // Handle external filter
      if (string.IsNullOrEmpty(search))
        return;

      // Handle given search as single key
      KeyPress(search[0]);

      // List will not be replaced, as the instance is already bound by screen, we only filter items.
      filterList.Clear();
      foreach (NavigationItem item in originalList.OfType<NavigationItem>())
      {
        var simpleTitle = item.SimpleTitle;

        // Filter
        if (_listFilterAction == FilterAction.StartsWith)
        {
          if (simpleTitle.ToLower().StartsWith(_listFilterString))
            filterList.Add(item);
        }
        else
        {
          if (NumPadEncode(simpleTitle).Contains(_listFilterString))
            filterList.Add(item);
        }
      }
      filterList.FireChange();
    }
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:29,代码来源:RemoteNumpadFilter.cs

示例2: UpdateSharesList_NoLock

 protected void UpdateSharesList_NoLock(ItemsList list, List<Share> shareDescriptors, ShareOrigin origin, bool selectFirstItem)
 {
   list.Clear();
   bool selectShare = selectFirstItem;
   shareDescriptors.Sort((a, b) => a.Name.CompareTo(b.Name));
   foreach (Share share in shareDescriptors)
   {
     ListItem shareItem = new ListItem(Consts.KEY_NAME, share.Name);
     shareItem.AdditionalProperties[Consts.KEY_SHARE] = share;
     try
     {
       string path = origin == ShareOrigin.Local ?
           LocalShares.GetLocalResourcePathDisplayName(share.BaseResourcePath) :
           ServerShares.GetServerResourcePathDisplayName(share.BaseResourcePath);
       if (string.IsNullOrEmpty(path))
         // Error case: The path is invalid
         path = LocalizationHelper.Translate(Consts.RES_INVALID_PATH, share.BaseResourcePath);
       shareItem.SetLabel(Consts.KEY_PATH, path);
       Guid? firstResourceProviderId = SharesProxy.GetBaseResourceProviderId(share.BaseResourcePath);
       if (firstResourceProviderId.HasValue)
       {
         ResourceProviderMetadata firstResourceProviderMetadata = origin == ShareOrigin.Local ?
             LocalShares.GetLocalResourceProviderMetadata(firstResourceProviderId.Value) :
             ServerShares.GetServerResourceProviderMetadata(firstResourceProviderId.Value);
         shareItem.AdditionalProperties[Consts.KEY_RESOURCE_PROVIDER_METADATA] = firstResourceProviderMetadata;
       }
       string categories = StringUtils.Join(", ", share.MediaCategories);
       shareItem.SetLabel(Consts.KEY_MEDIA_CATEGORIES, categories);
       Share shareCopy = share;
       shareItem.Command = new MethodDelegateCommand(() => ShowShareInfo(shareCopy, origin));
     }
     catch (NotConnectedException)
     {
       throw;
     }
     catch (Exception e)
     {
       ServiceRegistration.Get<ILogger>().Warn("Problems building share item '{0}' (path '{1}')", e, share.Name, share.BaseResourcePath);
     }
     if (selectShare)
     {
       selectShare = false;
       shareItem.Selected = true;
     }
     shareItem.SelectedProperty.Attach(OnShareItemSelectionChanged);
     lock (_syncObj)
       list.Add(shareItem);
   }
   list.FireChange();
 }
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:50,代码来源:SharesConfigModel.cs

示例3: 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

示例4: FillList

    protected void FillList(IContentDirectory contentDirectory, Guid[] necessaryMIAs, ItemsList list, MediaItemToListItemAction converterAction)
    {
      MediaItemQuery query = new MediaItemQuery(necessaryMIAs, null)
      {
        Limit = (uint)QueryLimit, // Last 5 imported items
        SortInformation = new List<SortInformation> { new SortInformation(ImporterAspect.ATTR_DATEADDED, SortDirection.Descending) }
      };

      var items = contentDirectory.Search(query, false);
      list.Clear();
      foreach (MediaItem mediaItem in items)
      {
        PlayableMediaItem listItem = converterAction(mediaItem);
        listItem.Command = new MethodDelegateCommand(() => PlayItemsModel.CheckQueryPlayAction(listItem.MediaItem));
        list.Add(listItem);
      }
      list.FireChange();
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:18,代码来源:LatestMediaModel.cs

示例5: RefreshResourceProviderPathList

 protected void RefreshResourceProviderPathList(ItemsList items, ResourcePath path)
 {
   items.Clear();
   IEnumerable<ResourcePathMetadata> res = GetChildDirectoriesData(path);
   if (res != null)
     AddResources(res, items);
   if (_enumerateFiles)
   {
     res = GetFilesData(path);
     if (res != null)
       AddResources(res, items);
   }
   items.FireChange();
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:14,代码来源:PathBrowserService.cs

示例6: RebuildMenuEntries

 /// <summary>
 /// Rebuilds all items of the current menu in the given <paramref name="context"/>.
 /// </summary>
 /// <remarks>
 /// This method locks the synchronization object of the <paramref name="menuItems"/> list and thus must not call
 /// change handlers.
 /// After executing this method, the returned <see cref="ItemsList"/>'s <see cref="ItemsList.FireChange"/>
 /// method must be called.
 /// </remarks>
 /// <param name="context">Workflow navigation context the menu should be built for.</param>
 /// <param name="menuItems">Menu items list to rebuild.</param>
 /// <param name="newActions">Preprocessed list (sorted etc.) of actions to be used for the new menu.</param>
 protected void RebuildMenuEntries(NavigationContext context, ItemsList menuItems, IList<WorkflowAction> newActions)
 {
   UnregisterActionChangeHandlers(context);
   lock (menuItems.SyncRoot)
   {
     menuItems.Clear();
     foreach (WorkflowAction action in newActions)
     {
       RegisterActionChangeHandler(context, action);
       if (!action.IsVisible(context))
         continue;
       ListItem item = new ListItem("Name", action.DisplayTitle)
           {
             Command = new MethodDelegateCommand(action.Execute),
             Enabled = action.IsEnabled(context),
           };
       item.AdditionalProperties[Consts.KEY_ITEM_ACTION] = action;
       menuItems.Add(item);
     }
   }
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:33,代码来源:MenuModel.cs

示例7: BuildCategoriesTree

 protected void BuildCategoriesTree(ItemsList contents, TreeItem parentItem, ICollection<string> categories, ICollection<string> allSelectedCategories,
     IDictionary<string, ICollection<string>> categories2Children, IDictionary<string, MediaCategory> allCategories)
 {
   contents.Clear();
   List<string> categoriesSorted = new List<string>(categories);
   categoriesSorted.Sort();
   foreach (string mediaCategory in categoriesSorted)
   {
     TreeItem categoryItem = new TreeItem(Consts.KEY_NAME, mediaCategory);
     categoryItem.AdditionalProperties[Consts.KEY_MEDIA_CATEGORY] = allCategories[mediaCategory];
     categoryItem.AdditionalProperties[Consts.KEY_PARENT_ITEM] = parentItem;
     if (allSelectedCategories.Contains(mediaCategory))
       categoryItem.Selected = true;
     PropertyChangedHandler handler = (property, oldValue) => OnMediaCategoryItemSelectionChanged(categoryItem);
     categoryItem.SelectedProperty.Attach(handler);
     categoryItem.AdditionalProperties["HandlerStrongReference"] = handler; // SelectedProperty only manages weak references to its handlers -> avoid handler to be removed
     ICollection<string> childCategories;
     if (!categories2Children.TryGetValue(mediaCategory, out childCategories))
       childCategories = new List<string>();
     BuildCategoriesTree(categoryItem.SubItems, categoryItem, childCategories, allSelectedCategories, categories2Children, allCategories);
     contents.Add(categoryItem);
   }
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:23,代码来源:ShareProxy.cs

示例8: RefreshResourceProviderPathList

 protected void RefreshResourceProviderPathList(ItemsList items, ResourcePath path)
 {
   items.Clear();
   IEnumerable<ResourcePathMetadata> res = GetChildDirectoriesData(path);
   if (res != null)
   {
     List<ResourcePathMetadata> directories = new List<ResourcePathMetadata>(res);
     directories.Sort((a, b) => a.ResourceName.CompareTo(b.ResourceName));
     foreach (ResourcePathMetadata childDirectory in directories)
     {
       TreeItem directoryItem = new TreeItem(Consts.KEY_NAME, childDirectory.ResourceName);
       directoryItem.AdditionalProperties[Consts.KEY_RESOURCE_PATH] = childDirectory.ResourcePath;
       directoryItem.SetLabel(Consts.KEY_PATH, childDirectory.HumanReadablePath);
       if (ChoosenResourcePath == childDirectory.ResourcePath)
         directoryItem.Selected = true;
       directoryItem.SelectedProperty.Attach(OnTreePathSelectionChanged);
       directoryItem.AdditionalProperties[Consts.KEY_EXPANSION] = new ExpansionHelper(directoryItem, this);
       items.Add(directoryItem);
     }
   }
   items.FireChange();
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:22,代码来源:ShareProxy.cs

示例9: InitList

 private void InitList(ItemsList targetList, string selectedEffect, SimpleStringDelegate command)
 {
   targetList.Clear();
   IGeometryManager geometryManager = ServiceRegistration.Get<IGeometryManager>();
   string standardEffectFile = geometryManager.StandardEffectFile;
   foreach (KeyValuePair<string, string> nameToEffect in geometryManager.AvailableEffects)
   {
     string file = nameToEffect.Key;
     string effectFile = selectedEffect ?? standardEffectFile;
     string effectName = nameToEffect.Value;
     ListItem item = new ListItem(Consts.KEY_NAME, effectName)
     {
       Command = new MethodDelegateCommand(() => command(effectName, file)),
       Selected = file == effectFile,
     };
     targetList.Add(item);
   }
   targetList.FireChange();
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:19,代码来源:VideoEffectSetupModel.cs


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