Beispiel #1
0
        void btnAddLibrary_Click(object sender, RoutedEventArgs e)
        {
            string libraryRoot;
            string libraryName;

            InputDialog iDialog = new InputDialog("Please give this library a name: ", "");
            if (iDialog.ShowDialog() == true)
            {
                libraryName = iDialog.Answer;

                FolderBrowser fb = new FolderBrowser();
                fb.IncludeFiles = false;
                fb.Description = "Please select root folder for library";
                if (fb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    libraryRoot = fb.SelectedPath;
                    MusicLibrary ml = new MusicLibrary(libraryName, libraryRoot);
                    ml.StatusChangedEvent += HandleStatusChangedEvent;

                    Thread MyNewThread = new Thread(new ThreadStart(() =>
                    {
                        ml.CreateLibrary();

                    }));
                    MyNewThread.Start();

                    libraries.Add(ml);
                    lstLibraries.Items.Refresh();
                    lstLibraries.SelectedItem = ml;
                    selectedLibrary = ml;
                }
            }
        }