public void Update(IEnumerable <IWirelessNetwork> networks) { Dispatcher.InvokeAsync(() => { NetworksStackPanel.Children.Clear(); foreach (var network in networks) { var button = new TaskbarWirelessNetworkButton(network); var isCurrent = network.Status == WirelessNetworkStatus.Connected; button.IsCurrent = isCurrent; button.NetworkName = network.Name; button.SignalStrength = network.SignalStrength; button.NetworkSelected += (id) => NetworkSelected?.Invoke(id); if (isCurrent) { NetworkStatus = network.Status; SignalStrengthIcon.Child = GetIcon(network.SignalStrength); } NetworksStackPanel.Children.Add(button); } }); }
private void InitializeNetworkButton() { Button.Click += (o, args) => NetworkSelected?.Invoke(this, EventArgs.Empty); IsCurrentTextBlock.Visibility = network.Status == WirelessNetworkStatus.Connected ? Visibility.Visible : Visibility.Hidden; NetworkNameTextBlock.Text = network.Name; SignalStrengthTextBlock.Text = $"{network.SignalStrength}%"; }
private async Task CheckRunnerStatus() { var runnerIsAlreadyRunning = await CheckIsProcessRunningAsync(); if (runnerIsAlreadyRunning) { NetworkSelected?.Invoke(this, string.Empty); } }
private void InitNetworks() { var mainnetButton = new Button(PositionX, 1, "Mainnet"); var goerliButton = new Button(PositionX, 2, "Goerli"); var quitButton = new Button(PositionX, 4, "Quit"); mainnetButton.Clicked = () => { _network = "mainnet"; NetworkSelected?.Invoke(this, _network); }; goerliButton.Clicked = () => { _network = "goerli"; NetworkSelected?.Invoke(this, _network); }; quitButton.Clicked = Quit; _window.Add(mainnetButton, goerliButton, quitButton); }
private void InitializeEvents() { Button.Click += (o, args) => NetworkSelected?.Invoke(network.Id); }