示例#1
0
        //Run button Click
        private void RunButton_Click(object sender, EventArgs e)
        {
            int nslot = 0;
            int nsong = 0;
            //List selected songs
            List <SongItem> selectedsongs = new List <SongItem>();

            //Check how many songs has been selected
            for (int i = 0; i <= (DBView.Rows.Count - 1); i++)
            {
                if (Global.database.Itens[i].isChecked == true)
                {
                    nsong++;
                    nslot++;
                    //If has Ura add one more slot
                    if (Global.database.Itens[i].starUra > 0)
                    {
                        nslot++;
                    }
                    selectedsongs.Add(Global.database.Itens[i]);
                }
            }
            string ms1 = Global.MsgSongSl1 + nsong + Global.MsgSongSl2 + nslot + Global.MsgSongSl3;
            string ms2 = Global.MsgSongSl4 + (Global.tslot - nslot) + Global.MsgSongSl3;

            //No song selected
            if (nslot == 0)
            {
                MessageBox.Show(Global.MsgSongSl7, Global.TlSongSl);
            }
            else if (nslot > Global.tslot)    //More songs selected than limit
            {
                MessageBox.Show(ms1 + Global.MsgSongSl6, Global.TlSongSl);
            }
            else if (nsong > Global.tsong)  //More songs selected than limit
            {
                MessageBox.Show(ms1 + Global.MsgSongSl8, Global.TlSongSl);
            }
            else
            {
                //Confirm song selection
                string       message = ms1 + ms2 + Global.MsgSongSl5;
                DialogResult result  = MessageBox.Show(message, Global.TlSongSl, MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    DLCHandler.InitializeDLC(RunPBar, selectedsongs);
                }
            }
        }
示例#2
0
        private void DLCSelector_Load(object sender, EventArgs e)
        {
            //Check if file exist
            if (!File.Exists(Global.PathJSON))
            {
                MessageBox.Show(Global.MsgJSON);
                System.Environment.Exit(1);
            }
            RunPBar.Visible = false;
            //Parse songdata.json to object
            string jsonfile = File.ReadAllText(Global.PathJSON);

            Global.database = JsonConvert.DeserializeObject <SongList>(jsonfile);
            //Sort by genre
            Global.database = DLCHandler.organizebyGenre(Global.database);
            BindingSource sorce = new BindingSource();

            sorce.DataSource  = Global.database.Itens;
            DBView.AutoSize   = true;
            DBView.DataSource = sorce;
            DBView.Refresh();
            IntroLabel.Text = Global.WlcmTxt;
        }