private void showLrcFrm() { if (lrcFrm == null) { lrcFrm = new LrcFrm(this.axWmplayer, this.tmrNow); //lrcFrm.mainFrm = this; lrcFrm.Show(); } else { if (lrcFrm.Visible == false) { lrcFrm.Visible = true; lrcFrm.Activate(); } else { lrcFrm.Visible = false; } } }
private void Player_Load(object sender, EventArgs e) { Point p = new Point(105, 80); this.DesktopLocation = p; try { picSound.Left = Convert.ToInt32(Config.GetValue("sound")); axWmplayer.settings.volume = Convert.ToInt32(Config.GetValue("sound")); ; string playlist = Application.StartupPath + @"\configure\playlist"; if (File.Exists(playlist)) { FileStream fsplaylist = new FileStream(playlist, FileMode.Open); BinaryFormatter bfplaylist = new BinaryFormatter(); strTemp = (List<string>)(bfplaylist.Deserialize(fsplaylist)); fsplaylist.Close(); for (int i = 0; i < strTemp.Count; i++) { string path = strTemp[i]; int temp = path.Length; int lastIndex = path.LastIndexOf("\\") + 1; lbPlayerList.Items.Add(path.Substring(lastIndex, temp - lastIndex)); } int a = new Random().Next(strTemp.Count); // axWmplayer.URL = strTemp[a]; lbPlayerList.SelectedIndex = a; } lrcFrm = new LrcFrm(this.axWmplayer, this.tmrNow); lrcFrm.Show(); LrcConnections.GetLrc(axWmplayer.URL); playState = Convert.ToInt32(Config.GetValue("playState")); lblSinger.Visible = false; lblTime.Visible = false; if (playState == 0) { tsmiPlayOrder.Checked = true; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 1) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = true; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 2) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = true; tsmiPlayOne.Checked = false; } else if (playState == 3) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = true; } } catch { return; } }
private void MainFrm_Load(object sender, EventArgs e) { //RegistryKey key; //RegistryKey subkey; try { //if (this.args[0].Length != 0) //{ // string path = this.args[0]; // int temp = path.Length; // int lastIndex = path.LastIndexOf("\\") + 1; // strTemp.Add(path); // lbPlayerList.Items.Add(path.Substring(lastIndex, temp - lastIndex)); // isRun = true; // axWmplayer.URL = path; // axWmplayer.Ctlcontrols.play(); // tmrNow.Start(); // lblSinger.Text = "歌曲:" + axWmplayer.currentMedia.name; // lblTime.Text = axWmplayer.Ctlcontrols.currentPositionString + "/" + axWmplayer.currentMedia.durationString; // lblSinger.Visible = true; // lblTime.Visible = true; //} //string expath = Application.ExecutablePath; //key = Registry.ClassesRoot.CreateSubKey("QQMusic." + "mp3" + ""); //key.SetValue("", "QQMusic-" + "mp3" + ""); //key = key.CreateSubKey("DefaultIcon"); //key.SetValue("", expath + "," + 0); //key = Registry.ClassesRoot.CreateSubKey("QQMusic." + "mp3" + ""); //// //key = key.CreateSubKey("shell"); //subkey = key; //key = subkey.CreateSubKey("Enqueue"); //key.SetValue("", "添加到QQMusic播放列表(&Q)"); //key = key.CreateSubKey("command"); //key.SetValue("", '"' + expath + '"' + "/ADD" + '"' + "%1" + '"'); //key = subkey; //key = key.CreateSubKey("open"); //key = key.CreateSubKey("command"); //key.SetValue("", '"' + expath + '"' + '"' + " %1" + '"'); picSound.Left = Convert.ToInt32(Config.GetValue("sound")); axWmplayer.settings.volume = Convert.ToInt32(Config.GetValue("sound"));; string playlist = Application.StartupPath + @"\configure\playlist"; if (File.Exists(playlist)) { FileStream fsplaylist = new FileStream(playlist, FileMode.Open); BinaryFormatter bfplaylist = new BinaryFormatter(); strTemp = (List <string>)(bfplaylist.Deserialize(fsplaylist)); fsplaylist.Close(); for (int i = 0; i < strTemp.Count; i++) { string path = strTemp[i]; int temp = path.Length; int lastIndex = path.LastIndexOf("\\") + 1; lbPlayerList.Items.Add(path.Substring(lastIndex, temp - lastIndex)); } int a = new Random().Next(strTemp.Count); axWmplayer.URL = strTemp[a]; lbPlayerList.SelectedIndex = a; } lrcFrm = new LrcFrm(this.axWmplayer, this.tmrNow); //lrcFrm.mainFrm = this; lrcFrm.Show(); LrcConnections.GetLrc(axWmplayer.URL); playState = Convert.ToInt32(Config.GetValue("playState")); lblSinger.Visible = false; lblTime.Visible = false; if (playState == 0) { tsmiPlayOrder.Checked = true; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 1) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = true; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 2) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = true; tsmiPlayOne.Checked = false; } else if (playState == 3) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = true; } } catch { return; } }
private void MainFrm_Load(object sender, EventArgs e) { //RegistryKey key; //RegistryKey subkey; try { //if (this.args[0].Length != 0) //{ // string path = this.args[0]; // int temp = path.Length; // int lastIndex = path.LastIndexOf("\\") + 1; // strTemp.Add(path); // lbPlayerList.Items.Add(path.Substring(lastIndex, temp - lastIndex)); // isRun = true; // axWmplayer.URL = path; // axWmplayer.Ctlcontrols.play(); // tmrNow.Start(); // lblSinger.Text = "歌曲:" + axWmplayer.currentMedia.name; // lblTime.Text = axWmplayer.Ctlcontrols.currentPositionString + "/" + axWmplayer.currentMedia.durationString; // lblSinger.Visible = true; // lblTime.Visible = true; //} //string expath = Application.ExecutablePath; //key = Registry.ClassesRoot.CreateSubKey("QQMusic." + "mp3" + ""); //key.SetValue("", "QQMusic-" + "mp3" + ""); //key = key.CreateSubKey("DefaultIcon"); //key.SetValue("", expath + "," + 0); //key = Registry.ClassesRoot.CreateSubKey("QQMusic." + "mp3" + ""); //// //key = key.CreateSubKey("shell"); //subkey = key; //key = subkey.CreateSubKey("Enqueue"); //key.SetValue("", "添加到QQMusic播放列表(&Q)"); //key = key.CreateSubKey("command"); //key.SetValue("", '"' + expath + '"' + "/ADD" + '"' + "%1" + '"'); //key = subkey; //key = key.CreateSubKey("open"); //key = key.CreateSubKey("command"); //key.SetValue("", '"' + expath + '"' + '"' + " %1" + '"'); picSound.Left = Convert.ToInt32(Config.GetValue("sound")); axWmplayer.settings.volume = Convert.ToInt32(Config.GetValue("sound")); ; string playlist = Application.StartupPath + @"\configure\playlist"; if (File.Exists(playlist)) { FileStream fsplaylist = new FileStream(playlist, FileMode.Open); BinaryFormatter bfplaylist = new BinaryFormatter(); strTemp = (List<string>)(bfplaylist.Deserialize(fsplaylist)); fsplaylist.Close(); for (int i = 0; i < strTemp.Count; i++) { string path = strTemp[i]; int temp = path.Length; int lastIndex = path.LastIndexOf("\\") + 1; lbPlayerList.Items.Add(path.Substring(lastIndex, temp - lastIndex)); } int a = new Random().Next(strTemp.Count); axWmplayer.URL = strTemp[a]; lbPlayerList.SelectedIndex = a; } lrcFrm = new LrcFrm(this.axWmplayer, this.tmrNow); //lrcFrm.mainFrm = this; lrcFrm.Show(); LrcConnections.GetLrc(axWmplayer.URL); playState = Convert.ToInt32(Config.GetValue("playState")); lblSinger.Visible = false; lblTime.Visible = false; if (playState == 0) { tsmiPlayOrder.Checked = true; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 1) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = true; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = false; } else if (playState == 2) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = true; tsmiPlayOne.Checked = false; } else if (playState == 3) { tsmiPlayOrder.Checked = false; tsmiPlayRand.Checked = false; tsmiPlayAll.Checked = false; tsmiPlayOne.Checked = true; } } catch { return; } }