示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SqlCeCommand cmd = db.conn.CreateCommand();

            db.cmd.Parameters.AddWithValue("@usrCmds", txtCommand.Text);
            db.cmd.Parameters.AddWithValue("@jrvsRspns", txtResponse.Text);
            db.cmd.Parameters.AddWithValue("@shellLoc", txtShellLoc.Text);
            db.cmd.CommandText = "INSERT INTO tblUserCommands(usrCmds,jrvsRspns,shellLoc) VALUES(@usrCmds, @jrvsRspns, @shellLoc)";
            try
            {
                if (db.conn.State != System.Data.ConnectionState.Open)
                {
                    db.conn.Open();
                }

                db.cmd.ExecuteNonQuery();
                R_Speech.SpeakAsync("new commands added");
            }
            catch (Exception ex) {
                Program.UISpeak("An error occured while trying to add custom commands.\r\n" + ex.Message);
            }
            finally { db.conn.Close(); }
            loadUserCommands();
        }
示例#2
0
 public static void UISpeak(string msg)
 {
     R_Speech.SpeakAsync(msg);
     MessageBox.Show(msg);
 }