//zamykanie po sobie private void wyjdzM() { if (lniepoprawne != 0) { //MessageBox.Show("zapisuje"); status.ramka.zapis(status.poziom, status.nrPodejscia, tickToDsec(czas) / 10, (double)lpoprawne / (double)lniepoprawne * 100.0, (double)tickToDsec(sCzasReakcji) / (double)lniepoprawne); } lpoprawne = 0; lniepoprawne = 0; sCzasReakcji = 0; czaszm = 0; timer1.Stop(); licznik = 0; czas = 0; iKroki = 0; licznikZP = 0; vCale.settings.setMode("loop", false); kontrNogi.stop(); kontrCale.stop(); czytaniec = false; this.pbG.Image = global::WindowsFormsApplication1.Properties.Resources.gora; this.pbD.Image = global::WindowsFormsApplication1.Properties.Resources.dol; this.pbP.Image = global::WindowsFormsApplication1.Properties.Resources.prawo_z; this.pbL.Image = global::WindowsFormsApplication1.Properties.Resources.lewo; this.pbGL.Image = global::WindowsFormsApplication1.Properties.Resources.x; this.pbDL.Image = global::WindowsFormsApplication1.Properties.Resources.t; this.pbDP.Image = global::WindowsFormsApplication1.Properties.Resources.k; this.pbGP.Image = global::WindowsFormsApplication1.Properties.Resources.o; }
public void stopMedia() { WMPLib.IWMPControls3 controls = (WMPLib.IWMPControls3)mediaPlayer.Ctlcontrols; // Check first to be sure the operation is valid. if (controls.get_isAvailable("stop")) { controls.stop(); } }
string d; //we will save the path that is to be deleted private void button1_Click(object sender, EventArgs e) //delete { if (listView1.FocusedItem != null) //if there is a chosen item { try //there may be an error if we delete a song taht it is also played by the windows media player { d = listView1.FocusedItem.SubItems[1].Text; WMPLib.IWMPControls3 controls = (WMPLib.IWMPControls3)axWindowsMediaPlayer1.Ctlcontrols; controls.stop(); //we stop the music listView1.Items.Remove(listView1.FocusedItem); //we remove the item from the listview //and we delete the item from the database string connectionstring = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=Music.mdb"; OleDbConnection conn = new OleDbConnection(connectionstring); conn.Open(); string query = "Delete from Table1 where Path='" + d + "'"; OleDbCommand cmd = new OleDbCommand(query, conn); int i = cmd.ExecuteNonQuery(); conn.Close(); axWindowsMediaPlayer1.Ctlenabled = true; }catch {} } }