static void Main(string[] args)
        {
            string appName = "System Monitor";

            //Data class to get system info
            Model model = new Model();

            //Handles LCD drawing
            View view = new View(model, appName);
            view.Type = 1; //Set default view to first button
            //Releases the graphics object on close
            AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(sender, e, view);

            //Timer to poll system data every second
            //If decreasing this time keep in mind its effect on system resources
            TimerCallback mTcb = new TimerCallback(model.queueData);
            Timer modelTimer = new Timer(mTcb, null, 0, 1000);

            ////New timer thread to poll whether an LCD button has been clicked
            ButtonHandler btnhd = new ButtonHandler(view);
            TimerCallback tcb = new TimerCallback(btnhd.buttonListener);
            Timer btnTimer = new Timer(tcb, null, 0, 100);

            //Draw the screen once a second
            while (true)
            {
                view.drawScreen();
                Thread.Sleep(1000);
            }
        }
 public View(Model model, string appName)
 {
     //Assign a reference to the model class. This is is where the system data will be retrieved from
     data = model;
     //Attemp to initialise an instance of the Logitech LCD library
     uint initialiseResult = DMcLgLCD.LcdInit();
     //If the initialization fails it will return an unsigned int other than the constant ERROR_SUCCUSS
     if (initialiseResult != DMcLgLCD.ERROR_SUCCESS) Console.WriteLine("LCD Failed to Initialise");
     //Connect to the Logitech device with LCD with LcdConnect. It's return value will be used to open a connection with LcdOpenByType
     device = DMcLgLCD.LcdOpenByType(DMcLgLCD.LcdConnect(appName, 0, 1), DMcLgLCD.LGLCD_DEVICE_BW);
     //Set this app to as the current LCD app
     DMcLgLCD.LcdSetAsLCDForegroundApp(device, DMcLgLCD.LGLCD_FORE_YES);
     //Initialize the Graphics object
     gfx = Graphics.FromImage(LCD);
 }