Exemple #1
0
        private bool InsertButton(mButton btn, string path)
        {
            //if (string.IsNullOrWhiteSpace(DB.ExecuteValue<string>(string.Format("select ID from Buttons where ID = '{0}'", btn.Name))))
            //{
            //    //insert
            //    if (DB.ExecuteNonQuery(string.Format("insert into Buttons Values('{0}', '{1}')", btn.Name, path)) < 1)
            //        return false;
            //}
            //else
            //{
            //    //update
            //    if (DB.ExecuteNonQuery(string.Format("update Buttons set Path = '{0}' Where ID = '{1}'", path, btn.Name)) < 1)
            //        return false;
            //}

            if (DB.ExecuteNonQuery(string.Format("insert or replace into Buttons Values('{0}', '{1}')", btn.Name, path)) < 1)
            {
                return(false);
            }

            btn.Image = IconManager.ToBitmap(path);
            btn.Title = Path.GetFileName(path);
            return(true);
        }