예제 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text        = string.Format(WindowTitle, Songs.Count(o => ((ListViewItemData)o.Tag).State == ListViewItemData._State.Processed), Songs.Count, CurrentOffset);
            LabelOffset.Text = string.Format(labelText, CurrentOffset);
            isShown          = true;
            CustomSongs      = CustomSongsDialog.GetDirectoryInfo();

            #region ToolStripInit
            JumpCheck = new CheckBox {
                Text = "Jump to Latest Download"
            };
            ToolStripControlHost host = new ToolStripControlHost(JumpCheck);
            ToolStrip.Items.Add(host);

            ToolStripFileButton.DropDownItems.AddRange(new[] {
                ButtonCustomSongs = new ToolStripButton("CustomSongs", null, ButtonCustomSongs_Click, "ButtonCustomSongs")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                },
                ButtonDownloads = new ToolStripButton("Downloads", null, ButtonDownloads_Click, "ButtonDownloads")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                }
            });
            ToolStripFileButton.DropDownItems.Remove(HOLDER);
            HOLDER.Dispose();

            if (!IsLatestVersion)
            {
                ToolStripAboutButton.DropDownItems.Add(ButtonUpdate = new ToolStripButton("Update", null, ButtonUpdate_Click, "ButtonUpdate")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                });
            }
            ToolStripAboutButton.DropDownItems.AddRange(new[] {
                ButtonGithub = new ToolStripButton("Github", null, ButtonGithub_Click, "ButtonGithub")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                },
                ButtonWiki = new ToolStripButton("Wiki", null, ButtonWiki_Click, "ButtonWiki")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                },
                ButtonCredits = new ToolStripButton("Credits", null, ButtonCredits_Click, "ButtonCredits")
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                }
            });
            #endregion

            if (CustomSongs == null)
            {
                MessageBox.Show("You did not set a correct path for the CustomSongs directory.");
                Application.Exit();
            }
            run = true;
        }
        public static DirectoryInfo GetDirectoryInfo()
        {
            var x = new CustomSongsDialog();

            if (x.ShowDialog() == DialogResult.OK)
            {
                return(new DirectoryInfo(x.textBox1.Text));
            }
            return(null);
        }