Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Models.Network;

namespace NETworkManager.Converters;

public sealed class WiFiChannelCenterFrequencyToChannelStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not int channelCenterFrequencyInKilohertz
? "-/-"
: $"{WiFi.GetChannelFromChannelFrequency(channelCenterFrequencyInKilohertz)}";
return value is not int channel ? "-/-" : $"{channel}";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Models.Network;

namespace NETworkManager.Converters;

public sealed class WiFiChannelCenterFrequencyToFrequencyStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not int channelCenterFrequencyInKilohertz
? "-/-"
: $"{WiFi.ConvertChannelFrequencyToGigahertz(channelCenterFrequencyInKilohertz)} GHz";
return value is not double frequency ? "-/-" : $"{frequency} GHz";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
Loading