private static void Check(WiFiSignal signal, TextBlock tbSignalStrength, TextBlock tbEncryption) { CurrentColorSchemeWifiInfo colorScheme = CurrentColorSchemeWifiInfo.GetInstance(); if (signal.SignalStrength <= colorScheme.BadSignal) { tbSignalStrength.Foreground = colorScheme.BadSignalForeground; tbSignalStrength.Text = colorScheme.BadSignalSymbol; } else if (signal.SignalStrength > colorScheme.BadSignal && signal.SignalStrength <= colorScheme.NormalSignal) { tbSignalStrength.Foreground = colorScheme.NormalSignalForeground; tbSignalStrength.Text = colorScheme.NormalSignalSymbol; } else { tbSignalStrength.Foreground = colorScheme.GoodSignalForeground; tbSignalStrength.Text = colorScheme.GoodSignalSymbol; } if (signal.Encryption != "None") { tbEncryption.Foreground = colorScheme.BadSignalForeground; } else { tbEncryption.Foreground = colorScheme.GoodSignalForeground; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { CurrentColorSchemeWifiInfo colorScheme = CurrentColorSchemeWifiInfo.GetInstance(); mainGrid.Background = colorScheme._colorSchemeForWifiInfo.GridColor; RefreshWifiListButton_Click(RefreshWifiListButton, new RoutedEventArgs()); }
public static CurrentColorSchemeWifiInfo GetInstance() { if (_uniq == null) { _uniq = new CurrentColorSchemeWifiInfo(); } return(_uniq); }
private void AddVisualInfo(IEnumerable <WiFiSignal> signals) { CurrentColorSchemeWifiInfo colorScheme = CurrentColorSchemeWifiInfo.GetInstance(); int count = 0; foreach (WiFiSignal s in signals) { count++; WrapPanel panel = new WrapPanel(); TextBlock tbSSID = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.NameForeground, "SSID: "); TextBlock tbSignalStrength = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockSymbolFontSize, colorScheme.SymbolFontFamily, colorScheme._colorSchemeForWifiInfo.NameForeground, colorScheme.NormalSignalSymbol); TextBlock tbEncryption = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockSymbolFontSize, colorScheme.SymbolFontFamily, colorScheme._colorSchemeForWifiInfo.NameForeground, colorScheme.EncriptionSymbol); TextBlock tbMAC = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.NameForeground, "BSSID:"); TextBlock tbSSIDValue = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.ValueForeground, " " + s.SSID); TextBlock tbSignalStrengthValue = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.ValueForeground, " " + s.SignalStrength); TextBlock tbEncryptionValue = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.ValueForeground, " " + s.Encryption); TextBlock tbMACValue = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.ValueForeground, " " + s.BSSID); Check(s, tbSignalStrength, tbEncryption); panel.Children.Add(tbSSID); panel.Children.Add(tbSSIDValue); panel.Children.Add(tbSignalStrength); panel.Children.Add(tbSignalStrengthValue); panel.Children.Add(tbEncryption); panel.Children.Add(tbEncryptionValue); panel.Children.Add(tbMAC); panel.Children.Add(tbMACValue); Grid grid = new Grid { Height = 1, Background = colorScheme._colorSchemeForWifiInfo.GridColorForRowDelimiter, Opacity = 0.3 }; stackPanelInfo.Children.Add(panel); stackPanelInfo.Children.Add(grid); } if (count == 0) { TextBlock tb = GetTextBlockInFormat(colorScheme.TextBlockLineHeight, colorScheme.TextBlockFontSize, colorScheme.FontFamily, colorScheme._colorSchemeForWifiInfo.NameForeground, "Нет информации для отображения!"); stackPanelInfo.Children.Add(tb); } }
private void IconsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (WifiListBoxItem.IsSelected) { BackButton.Visibility = Visibility.Visible; MyFrame.Navigate(typeof(WiFiInfo)); TitleTextBlock.Text = "Список Wi-Fi"; } else if (MapListBoxItem.IsSelected) { BackButton.Visibility = Visibility.Collapsed; MyFrame.Navigate(typeof(Map)); TitleTextBlock.Text = "Карта"; } else if (Theme.IsSelected) { var applicationView = ApplicationView.GetForCurrentView(); var titleBar = applicationView.TitleBar; MapData mapData = MapData.GetInstance(); CurrentColorSchemeWifiInfo currentColorSchemeWifi = CurrentColorSchemeWifiInfo.GetInstance(); var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; if (RequestedTheme == ElementTheme.Light) { RequestedTheme = ElementTheme.Dark; mapData.Scheme = MapColorScheme.Dark; titleBar.ButtonForegroundColor = Colors.DeepPink; currentColorSchemeWifi.ChangeValues(new NightSchemeForWifiInfo()); localSettings.Values["Theme"] = "Dark"; } else if (RequestedTheme == ElementTheme.Dark) { RequestedTheme = ElementTheme.Light; mapData.Scheme = MapColorScheme.Light; titleBar.ButtonForegroundColor = Colors.Black; currentColorSchemeWifi.ChangeValues(new WhiteSchemeForWifiInfo()); localSettings.Values["Theme"] = "Light"; } MapListBoxItem.IsSelected = true; } }