Ejemplo n.º 1
0
 public static IEnumerable <System.Windows.Forms.ListViewItem> AsEnumerable(this System.Windows.Forms.ListView.ListViewItemCollection col)
 {
     foreach (System.Windows.Forms.ListViewItem i in col)
     {
         yield return(i);
     }
 }
Ejemplo n.º 2
0
 static void EnsureLastItemVisible(ItemCollection collection)
 {
     var item = collection[collection.Count - 2];
     var bottom = item.ListView.Bottom;
     var top = item.Bounds.Top;
     if (top < bottom)
     {
         collection[collection.Count - 1].EnsureVisible();
     }
 }
Ejemplo n.º 3
0
        public static List <System.Windows.Forms.ListViewItem> ToList(this System.Windows.Forms.ListView.ListViewItemCollection list)
        {
            var retval = new List <System.Windows.Forms.ListViewItem>();

            foreach (System.Windows.Forms.ListViewItem item in list)
            {
                retval.Add(item);
            }
            return(retval);
        }
Ejemplo n.º 4
0
        List <string> ToStringList(System.Windows.Forms.ListView.ListViewItemCollection oc)
        {
            List <string> sList = new List <string>();

            foreach (ListViewItem lvi in oc)
            {
                sList.Add(lvi.Text);
            }
            return(sList);
        }
Ejemplo n.º 5
0
        public void ExecFilter()
        {
            //フィルターに値をセット
            PrimaryAttribute att = new PrimaryAttribute();

            //filter.set

            //フィルターを実行
            System.Windows.Forms.ListView.ListViewItemCollection col = heroListView.Items;
            //filter.ExecFilter();
        }
Ejemplo n.º 6
0
        void WriteWorksheet(WorksheetPart workSheetPart, System.Windows.Forms.ListView.ListViewItemCollection list)
        {
            List <OpenXmlAttribute> attributes;
            OpenXmlWriter           writer;

            writer = OpenXmlWriter.Create(workSheetPart);
            writer.WriteStartElement(new Worksheet());
            writer.WriteStartElement(new SheetData());

            int currentRow = 1;

            attributes = new List <OpenXmlAttribute>();
            attributes.Add(new OpenXmlAttribute("r", null, currentRow.ToString()));
            writer.WriteStartElement(new Row(), attributes);
        }
Ejemplo n.º 7
0
 public static System.Windows.Forms.ListView.ListViewItemCollection getListViewItems(System.Windows.Forms.ListView lstview)
 {
     System.Windows.Forms.ListView.ListViewItemCollection temp = new System.Windows.Forms.ListView.ListViewItemCollection(new System.Windows.Forms.ListView());
     if (!lstview.InvokeRequired)
     {
         foreach (ListViewItem item in lstview.Items)
         {
             temp.Add((ListViewItem)item.Clone());
         }
         return(temp);
     }
     else
     {
         return(temp);
     }
 }
Ejemplo n.º 8
0
        private void UpdateFileDownloadedStatus(int percentage, string fileName)
        {
            System.Windows.Forms.ListView.ListViewItemCollection Items = this.listViewDownStatus.Items;
            int itemsNo = Items.Count;

            for (int i = 0; i < itemsNo; i++)
            {
                if (fileName == Items[i].Text)
                {
                    Items[i].SubItems[1].Text = percentage.ToString() + "%";
                }
                else
                {
                    Items[i].SubItems[1].Text = "0 %";
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// returns the computed track order to play from playlist
        /// </summary>
        /// <param name="items">the items in the playlist</param>
        /// <returns></returns>
        public static List <PlayListEntry> ComputedRandomOrder(System.Windows.Forms.ListView.ListViewItemCollection items)
        {
            List <PlayListEntry> pltems = null;

            if (items != null)
            {
                int listSize = items.Count;
                if (listSize > 0)
                {
                    pltems = new List <PlayListEntry>();
                    List <int>    order    = new List <int>();
                    PlayListEntry entry    = new PlayListEntry();
                    Random        _rand    = new Random(DateTime.Now.Millisecond);
                    var           possible = Enumerable.Range(0, listSize).ToList();

                    /*var possible = Enumerable.Range(0, listSize)
                     *      .Select(r => _rand.Next(listSize))
                     *      .ToList();*/
                    //List<int> listNumbers = new List<int>();
                    for (int i = 0; i < listSize; i++)
                    {
                        int index = _rand.Next(0, possible.Count);
                        order.Add(possible[index]);
                        possible.RemoveAt(index);
                    }
                    foreach (int pos in order)
                    {
                        if (items[pos].Text != "")
                        {
                            AudioFileInfo afInfo = new AudioFileInfo(items[pos].SubItems[0].Text, items[pos].SubItems[2].Text);

                            PlayListEntry plIt = new PlayListEntry
                            {
                                FileName      = afInfo.FullPath,
                                HasPlayedOnce = false,
                                PosInPlayList = pos
                            };
                            pltems.Add(plIt);
                        }
                    }
                }
            }
            return(pltems);
        }
        }     // end method PopulateTreeView

        public void GetContent(string path, System.Windows.Forms.ListView.ListViewItemCollection items)
        {
            try
            {
                if (Directory.Exists(path))
                {
                    string[] subfolders       = Directory.GetDirectories(path);
                    var      sortedSubfolders = subfolders.OrderBy(x => x).Select(x => x);
                    foreach (string folder in sortedSubfolders)
                    {
                        items.Add(folder);
                    }
                    string[] files = Directory.GetFiles(path);
                    foreach (string file in files.OrderBy(x => x))
                    {
                        items.Add(file);
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                items.Add("Access denied");
            }
        }
Ejemplo n.º 11
0
 public static IEnumerable <System.Windows.Forms.ListViewItem> AsEnumerable(
     this System.Windows.Forms.ListView.ListViewItemCollection source)
 {
     TypeCheckEnumerable(source, (s) => s.AsEnumerable(), (s) => s[0]);
     return(source.Cast <System.Windows.Forms.ListViewItem>());
 }