in sources/Google.Solutions.IapDesktop.Application/Windows/Options/NetworkOptionsViewModel.cs [43:77]
public NetworkOptionsViewModel(
IRepository<IApplicationSettings> settingsRepository,
IHttpProxyAdapter proxyAdapter)
: base("Network", settingsRepository)
{
this.proxyAdapter = proxyAdapter;
var settings = settingsRepository.GetSettings();
this.IsProxyEditable =
!settings.ProxyUrl.IsReadOnly &&
!settings.ProxyPacUrl.IsReadOnly;
if (!string.IsNullOrEmpty(settings.ProxyUrl.Value) &&
Uri.TryCreate(settings.ProxyUrl.Value, UriKind.Absolute, out var proxyUrl))
{
this.proxyServer = proxyUrl.Host;
this.proxyPort = proxyUrl.Port.ToString();
}
if (settings.ProxyPacUrl.Value != null &&
!string.IsNullOrEmpty(settings.ProxyPacUrl.Value) &&
IsValidProxyAutoConfigurationAddress(settings.ProxyPacUrl.Value))
{
this.proxyPacAddress = settings.ProxyPacUrl.Value;
}
if (this.proxyServer != null || this.proxyPacAddress != null)
{
this.proxyUsername = settings.ProxyUsername.Value;
this.proxyPassword = settings.ProxyPassword.GetClearTextValue();
}
base.OnInitializationCompleted();
}