Example #1
0
        public void UpdateListViewItem()
        {
            this.Text       = Name;
            this.ImageIndex = IconId;

            while (SubItems.Count > 1)
            {
                SubItems.RemoveAt(1);
            }

            if (Price > 0)
            {
                double rounded = Math.Round(Price, 2);
                this.SubItems.Add(String.Format("{0} €", rounded));
            }
            else
            {
                this.SubItems.Add("");
            }

            this.SubItems.Add(NumberOfDiscs.ToString());

            if (BoughtOn.Year > 1980)
            {
                this.SubItems.Add(BoughtOn.ToShortDateString());
            }
            else
            {
                this.SubItems.Add("");
            }

            this.SubItems.Add(Errors());
        }
Example #2
0
 public LVI_Ex(IExposable value) : base()
 {
     Value = value;
     //SubItems are always at least 1
     SubItems.AddRange(value.TextValues().Select((t, i) => new LVSI_Ex(this, Value, i)).ToArray());
     SubItems.RemoveAt(0);
 }
Example #3
0
        public void RefreshValues()
        {
            // What's a better method? lol
            SubItems.RemoveAt(SubItems.Count - 1);
            SubItems.RemoveAt(SubItems.Count - 1);
            SubItems.RemoveAt(SubItems.Count - 1);

            if (Video.Feeds.Count > 1)
            {
                string s = null;
                foreach (Feed f in Video.Feeds)
                {
                    if (s != null)
                    {
                        s = s + ", " + f.Name;
                    }
                    else
                    {
                        s = f.Name;
                    }
                }
                SubItems.Add(s);
            }
            else if (Video.Feeds.Count == 1)
            {
                SubItems.Add(Video.Feeds[0].ToString());
            }
            else
            {
                SubItems.Add("None Set");
            }

            if (Video.GameProfile != null)
            {
                SubItems.Add(Video.GameProfile.Name);
            }
            else
            {
                SubItems.Add("Not Set");
            }

            SubItems.Add(Video.IsSynced() ? "✔" : "");
        }
Example #4
0
        /// <summary>
        /// Reads all the sub-directories below the current folder
        /// </summary>
        public void ReadSubItemsForFolder()
        {
            if (SubItems.Count == 1 && SubItems[0] == null)
            {
                // Clear the dummy item out
                SubItems.Clear();

                try
                {
                    // Read the directories below
                    foreach (string dir in Directory.GetDirectories(Path, "*", SearchOption.TopDirectoryOnly))
                    {
                        SubItems.Add(new Folder(dir, this));
                    }

                    // Get any links in the directory
                    foreach (string file in Directory.GetFiles(Path, "*.lnk", SearchOption.TopDirectoryOnly))
                    {
                        SubItems.Add(new Folder(LinkConverter.GetLnkTarget(file), this));
                    }

                    // Remove any inaccessible folders
                    for (int i = SubItems.Count - 1; i >= 0; i--)
                    {
                        if (SubItems[i].IsInaccessible)
                        {
                            SubItems.RemoveAt(i);
                        }
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    // This means we don't have access, don't worry about it
                }
            }
        }