Пример #1
0
        private void newButton_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowser2 directoryFolderBrowser = new FolderBrowser2();

            directoryFolderBrowser.ShowDialog(null);

            if (directoryFolderBrowser.DirectoryPath != null)
            {
                ResetUI();
                presetNameBox.Text     = "New Preset";
                musicPreset            = new MusicPreset(directoryFolderBrowser.DirectoryPath);
                musicPreset.presetName = presetNameBox.Text;
                PopulateCustomTracks(directoryFolderBrowser.DirectoryPath);
                saveButton.IsEnabled = true;
            }
        }
Пример #2
0
        private void loadButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog presetDialog = new OpenFileDialog();

            presetDialog.Title            = "Open preset.xml file";
            presetDialog.Filter           = "XML files|*.xml";
            presetDialog.InitialDirectory = Environment.CurrentDirectory;
            presetDialog.ShowDialog();

            if (System.IO.Path.GetFileName(presetDialog.FileName) == "preset.xml")
            {
                ResetUI();
                saveButton.IsEnabled = true;
                musicPreset          = new MusicPreset(Constants.PresetsPath + new DirectoryInfo(System.IO.Path.GetDirectoryName(presetDialog.FileName)).Name);

                if (!musicPreset.Load())
                {
                    Application.Current.Shutdown();
                    return;
                }

                PopulateCustomTracks(musicPreset.customTrackDirectory);
                TagFromLoad();
                presetNameBox.Text = musicPreset.presetName;
            }

            else
            {
                Dictionary <Characters, string> messageDict = new Dictionary <Characters, string>()
                {
                    { Characters.Alphys, "S-s-sorry. but you're g-g-going to have to navigate to a valid preset folder." },
                    { Characters.Asgore, "I'm afraid you shall have to navigate to a valid preset folder human." },
                    { Characters.Asriel, "I'm real sorry, but please navigate to a valid preset folder." },
                    { Characters.Flowey, "Oh come on you idiot! Can't you navigate to a valid preset folder?" },
                    { Characters.Papyrus, "I AM SORRY MY FRIEND, BUT I NEED YOU TO NAVIGATE TO A VALID PRESET FOLDER." },
                    { Characters.Sans, "heyo, come on pal. navigate to a valid preset folder would ya?" },
                    { Characters.Toriel, "I'm sorry child, but please navigate to a valid preset folder." },
                    { Characters.Undyne, "HEY! Can you navigate to a valid preset folder already?" },
                    { Characters.None, "Invalid preset folder selected, please navigate to a valid preset folder!" }
                };

                UTMessageBox.Show(messageDict, Constants.CharacterReactions.Negative, MessageBoxButton.OK);
            }
        }