Пример #1
0
        internal static bool ToggleHeld(SQLiteConnection dbConnection, String imagePath)
        {
            bool isHeld = HoldTools.IsHeld(dbConnection, imagePath);

            dbConnection.Open();

            if (isHeld == false)
            {
                // Not held - hold it in the database
                String sql = "INSERT INTO held_images (timestamp, name) VALUES (CURRENT_TIMESTAMP, @name)";

                SQLiteCommand insertHeld = new SQLiteCommand(sql, dbConnection);
                insertHeld.Parameters.Add(new SQLiteParameter("@name", imagePath));
                insertHeld.ExecuteNonQuery();
            }
            else
            {
                // Already held - remove it from the database
                String        sql        = "DELETE FROM held_images WHERE name = @name";
                SQLiteCommand deleteHeld = new SQLiteCommand(sql, dbConnection);
                deleteHeld.Parameters.Add(new SQLiteParameter("@name", imagePath));
                deleteHeld.ExecuteNonQuery();
            }

            dbConnection.Close();
            return(!isHeld);
        }
 internal void ToggleHeld(SQLiteConnection dbConnection)
 {
     HoldTools.ToggleHeld(dbConnection, this.panelId);
 }
 internal bool IsHeld(SQLiteConnection dbConnection)
 {
     return(HoldTools.IsHeld(dbConnection, this.panelId));
 }
 internal bool IsHeld(SQLiteConnection dbConnection)
 {
     return(HoldTools.IsHeld(dbConnection, this.imagePath));
 }