/// <summary> /// Initializes this instance. /// </summary> /// <returns>Task.</returns> public async Task Initialize() { _timer = new System.Windows.Forms.Timer(); _timer.Tick += Timer_Elapsed; _timer.Interval = 90000; await RelayBoard.InitializeAsync(); }
/// <summary> /// Initializes this instance. /// </summary> /// <returns>Task.</returns> public async Task Initialize() { _timer = new DispatcherTimer(); _timer.Tick += Timer_Elapsed; _timer.Interval = TimeSpan.FromMilliseconds(90000); await RelayBoard.InitializeAsync(); }
public async void Initialize() { try { await RelayBoard.InitializeAsync(); } catch (RelayBoardException ex) { MessageBox.Show(ex.Message, "RelayBoardException", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Handles the Click event of the ResetRelaysButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private async void ResetRelaysButton_Click(object sender, RoutedEventArgs e) { try { await RelayBoard.InitializeAsync(true); } catch (RelayBoardException) { LampToggleButton.IsEnabled = false; FanToggleButton.IsEnabled = false; LoadButton.IsEnabled = false; } }