public SiteViewModel(site site) { _site = site; var bvm = _site.bindings.Select(b => new BindingViewModel(b)); _bindings = new ObservableCollection<BindingViewModel>(bvm); _configurationService = SimpleIoc.Default.GetInstance<IConfigurationService>(); var binding = this.bindings.Where(b => b.Host.Contains("ngrok.com")).FirstOrDefault(); var replaced = Regex.Replace(_site.name, "[^A-Za-z0-9_]", ""); this.Subdomain = (binding == null || string.IsNullOrWhiteSpace(binding.Subdomain)) ? replaced : binding.Subdomain; _hasApplicationBinding = binding != null; _urlAclDataService = SimpleIoc.Default.GetInstance<IUrlAclDataService>(); _hasUrlAcl = _urlAclDataService.UrlAcls.Any(u=>u.Port==this.LocalhostPort && u.UrlPrefix.Contains("ngrok.com")); }
public SiteViewModel(site site, bool hasUrlAcl) : this(site) { _hasUrlAcl = hasUrlAcl; }