public static bool StartEditing(Window parent, CrawlingConfig config, CrawlingRule rule) { CrawlingRuleEditor view = new CrawlingRuleEditor(config, rule); view.Owner = parent; view.ShowDialog(); return(view.ApplyChanges); }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { CrawlingConfig config = (CrawlingConfig)DataContext; CrawlingRule rule = (CrawlingRule)((Control)sender).DataContext; CrawlingRule clone = CrawlingConfigurationSerializer.Clone(rule); if (CrawlingRuleEditor.StartEditing(Window.GetWindow(this), config, clone)) { int index = config.Rules.IndexOf(rule); config.Rules[index] = clone; } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { CrawlingConfig config = (CrawlingConfig)DataContext; CrawlingRule rule = new CrawlingRule { Guid = Guid.NewGuid(), Name = "New rule", Description = "", TargetBucket = config.Buckets.FirstOrDefault() }; if (CrawlingRuleEditor.StartEditing(Window.GetWindow(this), config, rule)) { config.Rules.Add(rule); } }