Пример #1
0
        /// <summary>
        ///     Display dialog browser for user to locate top level music directory.
        /// </summary>
        /// <returns>
        /// </returns>
        public string FindMusicDirectoryBrowser()
        {
            _msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var musicDirectory = DisplayFileBrowser.SelectToplevelMusicDirectory();
            var validate       = new ValidationClass();


            if (!validate.ValidateStringIsNotNull(musicDirectory))
            {
                _msgBox.Msg = "You need to set your music directory.";
                _msgBox.ShowInformationMessageBox();

                return(string.Empty);
            }

            var retVal = validate.ValidateDirectoryExists(musicDirectory);

            if (retVal)
            {
                SongRecordProperties.MusicDirectoryPath = UserEnviormentInfoProperties.UserMusicDirectoryPath;
                SongRecordProperties.MusicDirectoryName =
                    new DirectoryInfo(UserEnviormentInfoProperties.UserMusicDirectoryPath).Name;

                return(musicDirectory);
            }

            _msgBox.Msg = "Found no music files in this directory. Use browser"
                          + Environment.NewLine + "to select your music directory.";
            _msgBox.ShowErrorMessageBox();
            return(string.Empty);
        }
Пример #2
0
        /// <summary>
        ///     Display file browser for user to find home directory.
        /// </summary>
        /// <exception cref="DirectoryNotFoundException" />
        public void FindUserHomeDirectoryBrowser()
        {
            var validate = new ValidationClass();

            var home = DisplayFileBrowser.SelectUserHomeDirectory();

            if (!validate.ValidateStringIsNotNull(home) || !validate.ValidateStringHasLength(home))
            {
                _msgBox.Msg = "Unable to locate your home directory. "
                              + "You will need to click on Set location menu and select home to set this.";
                _msgBox.ShowErrorMessageBox();
            }


            UserEnviormentInfoProperties.UserHomeDirectoryPath = home;
        }