Beispiel #1
0
        /// <summary>Handles the <c>DirectoryPathChanged</c> event of the <see cref="AutoFolderBrowser"/> control.
        /// <para/>Searches through the newly-selected path for all available .osu beatmap files, calling <see cref="IndivListView"/>.<see cref="AppendableListView.Set(List{object})"/> with the relevant parent folders.</summary>
        /// <param name="Sender">The source of the event.</param>
        /// <param name="E">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        void AutoFolderBrowser_DirectoryPathChanged(object Sender, RoutedEventArgs E)
        {
            DirectoryInfo Folder = ((FolderBrowser)Sender).SelectedPath;

            if (Folder != null)
            {
                List <object>    F  = new List <object>();
                HashSet <string> Fn = new HashSet <string>();
                // ReSharper disable once LoopCanBeConvertedToQuery
                foreach (FileInfo Beatmap in Folder.GetFiles("*.osu", SearchOption.AllDirectories))
                {
                    DirectoryInfo Dir = Beatmap.Directory;
                    if (Dir.Parent.FullName.Equals(Folder.FullName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        string N = Dir.FullName.ToLowerInvariant();
                        if (!Fn.Contains(N))
                        {
                            Fn.Add(N);
                            F.Add(Beatmap.Directory);
                        }
                    }
                }

                //F.Sort();
                IndivListView.Set(F);
                StartButton.IsEnabled = F.Count > 0;
            }
        }
Beispiel #2
0
        /// <summary>Handles the <c>DirectoryPathChanged</c> event of the <see cref="IndivFolderBrowser"/> control.
        /// <para/>Calls <see cref="IndivListView"/>.<see cref="AppendableListView.Set(List{object})"/>, showing the newly-selected folders.</summary>
        /// <param name="Sender">The source of the event.</param>
        /// <param name="E">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        void IndivFolderBrowser_DirectoryPathChanged(object Sender, RoutedEventArgs E)
        {
            ReadOnlyCollection <DirectoryInfo> Folders = ((FolderMultiBrowser)Sender).SelectedPaths;

            if (Folders != null)
            {
                LogWindow.Log("Folder-space Updated.");

                List <object> F = Folders.Cast <object>().ToList();
                //F.Sort();

                //IndivListView.Clear();
                IndivListView.Set(F);
                //IndivListView.Items.Clear();
                StartButton.IsEnabled = F.Count > 0;
            }
        }