public MainPage() { this.InitializeComponent(); m_trafficManager = new YaTrafficManager(); m_trafficManager.OnDataChanged += OnTrafficDataChanged; try { m_rgbLed = new RGBLed(RED_PIN, GREED_PIN, BLUE_PIN); } catch(RGBLedException rgbLedEx) { switch(rgbLedEx.ErrorType) { case RGBLedError.E_GPIO_NOT_FOUND: tbErrorMessage.Text = @"GPIO does not found on this device!"; break; case RGBLedError.E_OPEN_PIN_ERROR: tbErrorMessage.Text = @"Opening pin error!"; break; default: goto case RGBLedError.E_GPIO_NOT_FOUND; } tbErrorMessage.Visibility = Visibility.Visible; m_rgbLed = null; } m_timer = new DispatcherTimer(); m_timer.Interval = TimeSpan.FromMinutes(5.0); m_timer.Tick += OnTimerTick; m_timer.Start(); m_trafficManager.UpdateData(); // First run async }
public MainPage() { this.InitializeComponent(); m_trafficManager = new YaTrafficManager(); m_trafficManager.OnDataChanged += OnTrafficDataChanged; try { m_rgbLed = new RGBLed(RED_PIN, GREED_PIN, BLUE_PIN); } catch (RGBLedException rgbLedEx) { switch (rgbLedEx.ErrorType) { case RGBLedError.E_GPIO_NOT_FOUND: tbErrorMessage.Text = @"GPIO does not found on this device!"; break; case RGBLedError.E_OPEN_PIN_ERROR: tbErrorMessage.Text = @"Opening pin error!"; break; default: goto case RGBLedError.E_GPIO_NOT_FOUND; } tbErrorMessage.Visibility = Visibility.Visible; m_rgbLed = null; } m_timer = new DispatcherTimer(); m_timer.Interval = TimeSpan.FromMinutes(5.0); m_timer.Tick += OnTimerTick; m_timer.Start(); m_trafficManager.UpdateData(); // First run async }