public MainPage()
        {
            this.InitializeComponent();

            // Initilize data
            errorCounterTransfer = 0;
            mcpExecutorCounter = 0;
            firstStart = true;
            startSequenceIsActive = false;
            stopSequenceIsActive = false;
            globalDataSet = new GlobalDataSet(); // Get things like mcp2515, logic_Mcp2515_Sender, logic_Mcp2515_Receiver
            serverComm = new ServerComm(globalDataSet);
            diagnose = new Diagnose(globalDataSet);
            mcp2515 = globalDataSet.Mcp2515;

            // USER CONFIGURATION
            globalDataSet.DebugMode = false;
            getProgramDuration = false;

            // Inititalize raspberry pi and gpio
            init_raspberry_pi_gpio();
            init_raspberry_pi_spi();

            // Inititalize mcp2515
            Task task_initMcp2515 = new Task(globalDataSet.init_mcp2515_task);
            task_initMcp2515.Start();
            task_initMcp2515.Wait();

            // Start executor service
            task_mcpExecutorService = new Task(mcpExecutorService_task);
            task_mcpExecutorService.Start();

            // Inititalize background tasks
            stateTimer = new Timer(this.StateTimer, null, 0, DELTA_T_TIMER_CALLBACK); // Create timer to display the state of message transmission
            errorTimer = new Timer(this.ErrorTimer, null, 0, DELTA_T_ERROR_TIMER); // Create timer to display the state of message transmission

            // Inititalize server
            Task<bool> serverStarted = serverComm.StartServer();
        }
 public Logic_Mcp2515_Receiver(GlobalDataSet globalDataSet)
 {
     this.globalDataSet    = globalDataSet;
     mcp2515               = globalDataSet.Mcp2515;
     data_MCP2515_Receiver = new Data_MCP2515_Receiver();
 }
 public ServerComm(GlobalDataSet globalDataSet)
 {
     this.globalDataSet = globalDataSet;
 }
 public Logic_Mcp2515_Receiver(GlobalDataSet globalDataSet)
 {
     this.globalDataSet = globalDataSet;
     mcp2515 = globalDataSet.Mcp2515;
     data_MCP2515_Receiver = new Data_MCP2515_Receiver();
 }
 public Diagnose(GlobalDataSet globalDataSet)
 {
     this.globalDataSet = globalDataSet;
 }
 public Logic_Mcp2515_Sender(GlobalDataSet globalDataSet)
 {
     this.globalDataSet  = globalDataSet;
     mcp2515             = new MCP2515();
     data_MCP2515_Sender = new Data_MCP2515_Sender();
 }
 public Logic_Mcp2515_Sender(GlobalDataSet globalDataSet)
 {
     this.globalDataSet = globalDataSet;
     mcp2515 = new MCP2515();
     data_MCP2515_Sender = new Data_MCP2515_Sender();
 }