private async void OnEditorClosed(IDialogResult result) { if (result.Result != ButtonResult.OK) { return; } if (!result.Parameters.ContainsKey("id")) { return; } var id = result.Parameters.GetValue <int>("id"); if (id == 0) { return; } var savedItem = await _domains.GetItem(id); var oldItem = Domains.FirstOrDefault(d => d.Model.Id == id); if (oldItem != null) { Domains.Remove(oldItem); } Domains.Add(new BindableEntity(savedItem)); }
protected override void ApplyPreferences(UserSettings userPreferences) { if (UserPreferences.TryGet <TagHelperOptions>(ModuleKey, "tag-helpers", out TagHelperOptions options)) { TagHelpers = options; } else { TagHelpers = TagHelperOptions.None; } if (UserPreferences.TryGet <bool>(ModuleKey, "enable-content-schemas", out bool isEnableContentSchemas)) { IsEnableContentSchemas = isEnableContentSchemas; } if (UserPreferences.TryGet <string>(ModuleKey, "disable-comain-content-schemas", out string disabled)) { foreach (var domain in disabled.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var found = Domains.FirstOrDefault(x => x.Id.Equals(domain, StringComparison.OrdinalIgnoreCase)); if (found != null) { found.IsShowSchema = false; } } } }
public void AddDomain(Domain domain) { var exists = Domains.FirstOrDefault(k => k.Name == domain.Name); if (exists != null) { throw new Exception("Domain with name arelady repated"); } Domains.Add(domain); }
public async Task RefreshCollections() { OperationResult <string[]> domains = await _interactor.GetDomainsAsync(); if (domains.WasSuccessful) { await Perform.CollectionRehydrationAsync(Domains, domains.Result); Domain = Domains.FirstOrDefault(); } }
public Domain GetDomain(long id) { var domain = Domains.FirstOrDefault(x => x.DomainId == id); if (domain != null) { var scans = DomainScansQuery(timeAgo: null, id).FirstOrDefault(); domain.LatestDomainScan = scans?.LatestDomainScan; domain.LatestValidDomainScan = scans?.LatestValidDomainScan; } return domain; }
public Domain GetDomain(string name) { return(Domains.FirstOrDefault(k => k.Name == name)); }
public static void Unload(string domainName) { var domain = Domains.FirstOrDefault(d => d.FriendlyName == domainName); Unload(domain); }