1
Fork 0

split the initProgram function

This commit is contained in:
Jake Howard 2014-08-02 10:48:14 +01:00
parent 213b4eb226
commit b9dbfe96fa

View file

@ -1,21 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data.SqlServerCe;
using System.Windows.Forms;
namespace Saviour_Backup_System
{
class setup
{
internal static void initProgram(){
string databaseName = databaseTools.databaseName;
if (File.Exists(databaseName)) { return; } // If the program has been run before, then the database will exist, so use that to test it.
internal static NotifyIcon notifyIcon;
internal static ContextMenu contextMenu;
static string databaseName = databaseTools.databaseName;
internal static void initProgram()
{
//if (!File.Exists(databaseName)) { setupDatabase(); } // If the program has been run before, then the database will exist, so use that to test it.
notificationIcon.init();
}
private static void setupDatabase(){
SqlCeEngine SQLEngine = new SqlCeEngine("Data Source = " + databaseName);
SQLEngine.CreateDatabase(); //Creates the database if it doesnt exist already
@ -31,6 +40,8 @@ namespace Saviour_Backup_System
fillDatabase(cmd, conn);
}
private static void fillDatabase(SqlCeCommand cmd, SqlCeConnection conn)
{
cmd.CommandText = "INSERT INTO Properties VALUES (?,?);";
@ -46,5 +57,12 @@ namespace Saviour_Backup_System
cmd.ExecuteNonQuery();
}
internal static void closeProgram(object sender, FormClosingEventArgs e)
{
notificationIcon.notifyIcon.Dispose(); //
}
}
}