Ejemplo n.º 1
0
        //constructor for the main window
        public MainWindow()
        {
            //Initializes classes
            AppWindow        = this;
            attendanceWriter = new AttendanceWriter();

            //the following lines update the database
            //comment them out if you dont want to update on startup
            //uncomment them if you want to update on startup

            //SQLPuller sqlPuller = new SQLPuller();
            //sqlPuller.pullAuthorizedCheckers();
            //sqlPuller.pullEvents();
            //sqlPuller.pullStudents();

            pcProxDLLAPI.USBDisconnect();

            //displays main window and goes to the sign in page
            InitializeComponent();

            //uncomment the page you want to go to on startup for testing?
            //sign in page is the normal process for the app
            GoToSignInPage();
            //GoToEventsPage();
            //GoToScanPage();
            //GoToResultsPage();

            textBox1.Text = "Updated: " + attendanceWriter.getDate();

            //attempts connecting the usb reader device
            long DeviceID = 0;

            if (pcProxDLLAPI.usbConnect() == 1)
            {
                DeviceID = pcProxDLLAPI.GetDID();
                ushort proxDevice = pcProxDLLAPI.writeDevCfgToFile("prox_device_configuration");
                MainWindow.AppWindow.textBox2.Text = "Connected to DeviceID: " + DeviceID;
                this.deviceConnected = true;
                //if the device's scan time does not match the constant set, write new
                //settings to device with the constant's scan time
                if (pcProxDLLAPI.getTimeParms_iIDHoldTO() != SCANOFFSETTIME || pcProxDLLAPI.getTimeParms_iIDLockOutTm() != SCANOFFSETTIME)
                {
                    pcProxDLLAPI.setTimeParms_iIDHoldTO(SCANOFFSETTIME);
                    pcProxDLLAPI.setTimeParms_iIDLockOutTm(SCANOFFSETTIME);
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDHoldTO());
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDLockOutTm());
                    Console.Out.WriteLine("WRITING CONFIG TO DEVICE");
                    Console.Out.WriteLine(pcProxDLLAPI.WriteCfg());
                    pcProxDLLAPI.ReadCfg();
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDHoldTO());
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDLockOutTm());
                }
            }
            else
            {
                MainWindow.AppWindow.textBox2.Text = "No device found";
            }
        }
Ejemplo n.º 2
0
        //constructor for the main window
        public MainWindow()
        {
            //Initializes classes
            AppWindow = this;
            attendanceWriter = new AttendanceWriter();

            //the following lines update the database
            //comment them out if you dont want to update on startup
            //uncomment them if you want to update on startup

            //SQLPuller sqlPuller = new SQLPuller();
            //sqlPuller.pullAuthorizedCheckers();
            //sqlPuller.pullEvents();
            //sqlPuller.pullStudents();

            pcProxDLLAPI.USBDisconnect();
            
            //displays main window and goes to the sign in page
            InitializeComponent();

            //uncomment the page you want to go to on startup for testing?
            //sign in page is the normal process for the app
            GoToSignInPage();
            //GoToEventsPage();     
            //GoToScanPage();
            //GoToResultsPage();

            textBox1.Text = "Updated: " + attendanceWriter.getDate();

            //attempts connecting the usb reader device
            long DeviceID = 0;
            if (pcProxDLLAPI.usbConnect() == 1)
            {
                DeviceID = pcProxDLLAPI.GetDID();
                ushort proxDevice = pcProxDLLAPI.writeDevCfgToFile("prox_device_configuration");
                MainWindow.AppWindow.textBox2.Text = "Connected to DeviceID: " + DeviceID;
                this.deviceConnected = true;
                //if the device's scan time does not match the constant set, write new
                //settings to device with the constant's scan time
                if (pcProxDLLAPI.getTimeParms_iIDHoldTO() != SCANOFFSETTIME || pcProxDLLAPI.getTimeParms_iIDLockOutTm() != SCANOFFSETTIME)
                {
                    pcProxDLLAPI.setTimeParms_iIDHoldTO(SCANOFFSETTIME);
                    pcProxDLLAPI.setTimeParms_iIDLockOutTm(SCANOFFSETTIME);
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDHoldTO());
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDLockOutTm());
                    Console.Out.WriteLine("WRITING CONFIG TO DEVICE");
                    Console.Out.WriteLine(pcProxDLLAPI.WriteCfg());
                    pcProxDLLAPI.ReadCfg();
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDHoldTO());
                    Console.Out.WriteLine(pcProxDLLAPI.getTimeParms_iIDLockOutTm());
                }
            }
            else
            {
                MainWindow.AppWindow.textBox2.Text = "No device found";
            }     
        }