Ejemplo n.º 1
0
        WATR_PacketHandler packetHandler; //Handles direct communication with hardware; translates it into software-level information and vice versa

        #endregion Fields

        #region Constructors

        public WATR_BackEndSS()
        {
            //Intitialize components on the form itself by the visual studio designer
            InitializeComponent();

            //Initialize the timeout timer
            deviceLocateTimeout = new Timer();
            deviceLocateTimeout.Interval = 3000;    //3s
            deviceLocateTimeout.Tick += deviceLocateTimeout_Tick;   //Event handler

            //Instantiate components
            configurator = new WATR_Configurator();
            database = new WATR_Database();
            deviceList = new Dictionary<ulong, WATR_XBeeDevice>();
            customPacker = new WATR_CustomPacketHandler();

            //Show the form
            this.Show();

            //Begin basic startup procedures
            startupOperation();

            //Main Form
            mainForm = new WATR_MainForm();
            mainForm.refreshButton.Click += refreshButton_Click;
            mainForm.FormClosed += emergencyExit;
            mainForm.SetDeviceList(deviceList);
            mainForm.Show();

            //I hate this crap
            hideThisDamnForm = new Timer();
            hideThisDamnForm.Interval = 100;
            hideThisDamnForm.Tick += hideThisDamnForm_Tick;
            hideThisDamnForm.Enabled = true;
        }
Ejemplo n.º 2
0
        public WATR_PacketHandler(string serialPortName, WATR_Database db)
        {
            //Instantiate hardware packet handler
            xbeePacketHandler = new WATR_XBeePacketHandler(serialPortName);

            //Assign the DB
            this.db = db;
        }
Ejemplo n.º 3
0
        //This is used for a first-time setup
        //We need to pass the DB so that we have access to it's functions
        public void firstRunSetup(WATR_Database db)
        {
            //Draw a configuration form for the user to fill out
            //configForm = new WATR_ConfigurationForm();
            //configForm.Show();

            //Retrieve com port from the form that was made
            //configurattionFIleStrings.add(comPortString, configForm.SelectedComPort);

            //Dispose of the form
            //configForm.dispose();

            //Create the DB file
            db.executeRawSQL(File.ReadAllText(startupRawSql));
            configurationFileStrings.Add(dbCreationString, true.ToString());

            //Our setup is now complete; the user can now begin using the program
            configurationFileStrings.Add(firstRunString, false.ToString());

            //Generate the configuration file
            writeConfigFile();
        }