Beispiel #1
0
 public static ToolsManager GetManager()
 {
     if (manager == null)
     {
         manager = new ToolsManager();
     }
     return(manager);
 }
        private void btnOk_Click(object sender, EventArgs e)
        {
            string folderFormat = cmbFolderFormat.Text;

            Microsoft.Win32.RegistryKey key2 = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ToolsManager.REGISTRY_KEY, true);
            if (key2 == null)
            {
                key2 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(ToolsManager.REGISTRY_KEY);
            }
            key2.SetValue("File Name Format", folderFormat);
            ToolsManager.GetManager().FileFormat = folderFormat;
            //ToolsManager.GetManager().GroupBy = cmbGroupBy.Text;
            ToolsManager.GetManager().GenrePriority     = (int)nudGenrePriority.Value;
            ToolsManager.GetManager().ArtistPriority    = (int)nudArtistPriority.Value;
            ToolsManager.GetManager().AlbumPriority     = (int)nudAlbumPriority.Value;
            ToolsManager.GetManager().AllowRepeat       = !chkRepeat.Checked;
            ToolsManager.GetManager().UseRepeatPriority = chkUseRepeatPriority.Checked;
            ToolsManager.GetManager().RepeatPriority    = (int)nudRepeatPriority.Value;
            this.Close();
        }
        private void frmOption_Load(object sender, EventArgs e)
        {
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ToolsManager.REGISTRY_KEY, false);
            string fileNameFormat           = "";

            if (key != null)
            {
                if (key.GetValue("File Name Format") != null)
                {
                    fileNameFormat = key.GetValue("File Name Format").ToString();
                }
            }
            int index = 0;

            if (fileNameFormat != "")
            {
                index = cmbFolderFormat.FindString(fileNameFormat);
                if (index >= 0)
                {
                    cmbFolderFormat.SelectedIndex = index;
                }
            }
            else
            {
                cmbFolderFormat.SelectedIndex = 0;
            }
            //index = cmbGroupBy.FindString(ToolsManager.GetManager().GroupBy);
            //if (index >= 0)
            //    cmbGroupBy.SelectedIndex = index;
            //else
            //    cmbGroupBy.SelectedIndex = 0;
            nudGenrePriority.Value       = ToolsManager.GetManager().GenrePriority;
            nudArtistPriority.Value      = ToolsManager.GetManager().ArtistPriority;
            nudAlbumPriority.Value       = ToolsManager.GetManager().AlbumPriority;
            chkRepeat.Checked            = !ToolsManager.GetManager().AllowRepeat;
            chkUseRepeatPriority.Checked = ToolsManager.GetManager().UseRepeatPriority;
            nudRepeatPriority.Value      = ToolsManager.GetManager().RepeatPriority;
        }