public Organizer(Callback DoneCallback) : base() { TrackWriter.Stop(); done = DoneCallback; invalidPath = Localization.Get(UI_Key.Organize_Invalid_Path); sample = Localization.Get(UI_Key.Organize_Sample); tokenMyMusic = Localization.Get(UI_Key.Organize_Token_My_Music); tokenMyDocuments = Localization.Get(UI_Key.Organize_Token_My_Documents); tokenDesktop = Localization.Get(UI_Key.Organize_Token_Desktop); font = Styles.FontSmaller; boldFont = new Font(font, FontStyle.Bold); btnOK = new QButton(Localization.OK, false, true); btnCancel = new QButton(Localization.CANCEL, false, true); btnHelp = new QButton(Localization.Get(UI_Key.Organize_Help), false, true); AddButton(btnHelp, help); lblTitle = new QLabel(Localization.Get(UI_Key.Organize_Title), font); this.Controls.Add(lblTitle); lblTitle.Location = new System.Drawing.Point(MARGIN, MARGIN); lblDirectory = new QLabel(Localization.Get(UI_Key.Organize_Top_Folder), font); lblDirectory.ShowAccellerator(); this.Controls.Add(lblDirectory); txtDirectory = new QTextBox(); txtDirectory.Font = font; this.Controls.Add(txtDirectory); if (Setting.TopLevelDirectory.Length == 0) { Setting.TopLevelDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); } oldRoot = Setting.TopLevelDirectory; txtDirectory.Text = simplify(oldRoot); btnBrowse = new QButton(Localization.Get(UI_Key.Organize_Browse), false, false); btnBrowse.ShowAccellerator(Keys.B); AddButton(btnBrowse, browse); lblSubdirectory = new QLabel(Localization.Get(UI_Key.Organize_Folder_Structure), font); lblSubdirectory.ShowAccellerator(); this.Controls.Add(lblSubdirectory); cboSubdirectory = new QComboBox(false); cboSubdirectory.Font = font; cboSubdirectory.Items.AddRange(TrackWriter.GetDirFormats().ToArray()); string sub = TrackWriter.GetDirFormat(Setting.DefaultDirectoryFormat); if (cboSubdirectory.Items.Contains(sub)) { cboSubdirectory.SelectedIndex = cboSubdirectory.FindStringExact(sub); } else { cboSubdirectory.SelectedIndex = 0; } this.Controls.Add(cboSubdirectory); cboSubdirectory.AutoSetWidth(); lblRename = new QLabel(Localization.Get(UI_Key.Organize_Rename), font); lblRename.ShowAccellerator(); this.Controls.Add(lblRename); cboRename = new QComboBox(false); cboRename.Font = font; string[] renames = TrackWriter.GetRenames().ToArray(); renames[0] = Localization.Get(UI_Key.Organize_Dont_Change); cboRename.Items.AddRange(renames); string ren = TrackWriter.GetRenameFormat(Setting.DefaultRenameFormat); if (cboRename.Items.Contains(ren)) { cboRename.SelectedIndex = cboRename.FindStringExact(ren); } else { cboRename.SelectedIndex = 0; } this.Controls.Add(cboRename); cboRename.AutoSetWidth(); chkKeepOrganized = new QCheckBox(Localization.Get(UI_Key.Organize_Keep_Organized), this.BackColor); chkKeepOrganized.ShowAccellerator(); chkKeepOrganized.Font = font; chkKeepOrganized.Checked = Setting.KeepOrganized; this.Controls.Add(chkKeepOrganized); chkMoveIntoTopFolder = new QCheckBox(Localization.Get(UI_Key.Organize_Move_Into_Top_Folder), this.BackColor); chkMoveIntoTopFolder.Font = font; chkMoveIntoTopFolder.Checked = Setting.MoveNewFilesIntoMain; this.Controls.Add(chkMoveIntoTopFolder); btnOK.Text = Localization.Get(UI_Key.Organize_Organize); btnCancel.Text = Localization.Get(UI_Key.Organize_Dont_Organize); btnOK.ShowAccellerator(Keys.O); btnCancel.ShowAccellerator(Keys.D); AddButton(btnOK, ok); AddButton(btnCancel, cancel); sampleTrack = new Track(-1, Localization.Get(UI_Key.Organize_Sample_Track_Path), Track.FileType.MP3, Localization.Get(UI_Key.Organize_Sample_Track_Title), Localization.Get(UI_Key.Organize_Sample_Track_Album), Localization.Get(UI_Key.Organize_Sample_Track_Artist), String.Empty, String.Empty, Localization.Get(UI_Key.Organize_Sample_Track_Grouping), Localization.Get(UI_Key.Organize_Sample_Track_Genre), (6 * 60 + 24) * 1000, 5, 0, 1973, 0, 5, 320000, 0, false, DateTime.Today, DateTime.Today, DateTime.Today, String.Empty, 2, 44100, ChangeType.None, null, float.MinValue, float.MinValue); resize(); this.Height = chkKeepOrganized.Bottom + MARGIN; cboSubdirectory.SelectedIndexChanged += (s, e) => { updateSample(); }; cboRename.SelectedIndexChanged += (s, e) => { updateSample(); }; txtDirectory.TextChanged += (s, e) => { updateSample(); }; updateSample(); int tabIndex = 0; lblDirectory.TabIndex = tabIndex++; txtDirectory.TabIndex = tabIndex++; btnBrowse.TabIndex = tabIndex++; lblSubdirectory.TabIndex = tabIndex++; cboSubdirectory.TabIndex = tabIndex++; lblRename.TabIndex = tabIndex++; cboRename.TabIndex = tabIndex++; chkKeepOrganized.TabIndex = tabIndex++; chkMoveIntoTopFolder.TabIndex = tabIndex++; btnHelp.TabIndex = tabIndex++; btnCancel.TabIndex = tabIndex++; btnOK.TabIndex = tabIndex++; setWrapAroundTabControl(tabIndex, txtDirectory, null); initialized = true; }