示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new CommonOpenFileDialog();

            if (!Directory.Exists(directory))
            {
                directory = Directory.GetCurrentDirectory();
            }

            dlg.Title            = "Select folder with mp3 files";
            dlg.IsFolderPicker   = true;
            dlg.InitialDirectory = directory;
            dlg.DefaultDirectory = directory;

            dlg.AddToMostRecentlyUsedList = false;
            dlg.AllowNonFileSystemItems   = false;
            dlg.EnsureFileExists          = true;
            dlg.EnsurePathExists          = true;
            dlg.EnsureReadOnly            = false;
            dlg.EnsureValidNames          = true;
            dlg.Multiselect    = false;
            dlg.ShowPlacesList = true;

            if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
            {
                directory = dlg.FileName;
                DirectoryPathLabel.Content = directory;

                DataContext = new ViewModel(Mp3Editor.GetMp3Files(directory));

                GenerateColumn(DirectoryFiles);
            }
        }
示例#2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                EnableUI(false);
                LastFMClient fMClient = new LastFMClient(TextBoxToken.Text);

                Dispatcher.Invoke(async() => { await Mp3Editor.FillTags(fMClient, (DataContext as ViewModel).Mp3FilesToFill); EnableUI(true); });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                EnableUI(true);
            }
        }