示例#1
0
 private void OnRemoveExtension()
 {
     if (!string.IsNullOrEmpty(ComboBoxText) && ExtensionList.Contains(ComboBoxText))
     {
         ExtensionList.Remove(ComboBoxText);
     }
 }
示例#2
0
        protected void RemoveItem()
        {
            var index = DisplayFileInfoList.IndexOf(SelectedFileInfo);

            FileInfoList.Remove(SelectedFileInfo);
            DisplayFileInfoList.Remove(SelectedFileInfo);

            //選択アイテムの更新
            if (DisplayFileInfoList.Count == 0)
            {
                //表示対象がない
                index = -1;
            }
            else if (DisplayFileInfoList.Count <= index)
            {
                index = DisplayFileInfoList.Count - 1;
            }
            else
            {
                //何もしない
            }

            if (index >= 0)
            {
                DisplayFileInfoList.ElementAt(index).IsSelected = true;
            }

            //フィルタの更新
            var missingKeywordList = new List <Extension>();

            foreach (var item in ExtensionList)
            {
                missingKeywordList.Add(item);
            }
            missingKeywordList.RemoveAt(0);
            foreach (var item in DisplayFileInfoList)
            {
                var extension      = Path.GetExtension(item.FilePath);
                var extensionItems = ExtensionList.Where(x => x.Name == extension);

                if (extensionItems.Any())
                {
                    foreach (var extItem in extensionItems)
                    {
                        missingKeywordList.Remove(extItem);
                    }
                }
            }

            foreach (var item in missingKeywordList)
            {
                ExtensionList.Remove(item);
            }

            HasItem = FileInfoList.Any();
        }
示例#3
0
        /// <summary>
        /// Deletes all Extensions from the Extension list that match
        /// a localName and a Namespace.
        /// </summary>
        /// <param name="localName">the local name to find</param>
        /// <param name="ns">the namespace to match, if null, ns is ignored</param>
        /// <returns>int - the number of deleted extensions</returns>
        public int DeleteExtensions(string localName, string ns)
        {
            // Find them first
            ExtensionList arr = FindExtensions(localName, ns);

            foreach (IExtensionElementFactory ob in arr)
            {
                _extensions.Remove(ob);
            }

            return(arr.Count);
        }
        /// <summary>
        /// Handles the Click event of the buttonRemoveExtension control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-10</remarks>
        private void buttonRemoveExtension_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < SettingsManagerLogic.LearningModule.Extensions.Count; i++)
            {
                if (SettingsManagerLogic.LearningModule.Extensions[i].Id == (listViewExtensions.SelectedItem as IExtension).Id)
                {
                    SettingsManagerLogic.LearningModule.Extensions.RemoveAt(i);
                    break;
                }
            }

            ExtensionList.Remove(listViewExtensions.SelectedItem as IExtension);                    //remove from listview
            listViewExtensions.ItemsSource = ExtensionList;
        }
示例#5
0
 ///////////////////////////////////////////////////////////////////////
 /// <summary>Remove a specific attribute, if it's there.</summary>
 /// <param name="attribute">attribute to remove</param>
 ///////////////////////////////////////////////////////////////////////
 public void Remove(GBaseAttribute attribute)
 {
     extensionElements.Remove(attribute);
 }