private void ParsersGenerateRuleControl_Done(object sender, RuleRoutedEventArgs e) { IsBusy = true; try { if (e.Rule != null) { var parserExisted = (Parsers.Parsers.Where(p => p.Url == e.Parser.Url).FirstOrDefault()); if (parserExisted == null) { parserExisted = new Parser() { Url = e.Parser.Url }; Parsers.Parsers.Add(parserExisted); } foreach (var r in parserExisted.Rules.Where(r => r.Label == e.Rule.Label).ToArray()) { parserExisted.Rules.Remove(r); } ParseRule newRule = new ParseRule(); e.Rule.CopyObject(newRule); parserExisted.Rules.Add(newRule); if (AllowClearUrlsAfterImport) { foreach (var url in Urls.Where(i => Helper.IsWellFormedUriString(i.Value, UriKind.Absolute) && Helper.StringLikes(new Uri(i.Value).Host, e.Parser.Url)).ToArray()) { Urls.Remove(url); } } } } finally { SelectImportRuleTabCommand.Execute(null); IsBusy = false; } }
private void ParsersGenerateRuleControl_Hide(object sender, RuleRoutedEventArgs e) { ChangeAddMode(false); }
private void ParsersGenerateRuleControl_Cancel(object sender, RuleRoutedEventArgs e) { SelectImportRuleTabCommand.Execute(null); }