private void lstVRules_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lstVRules.SelectedIndex != -1) { RuleFile ruleSelected = (RuleFile)lstVRules.SelectedValue; NewRule ruleDetail = new NewRule(ruleSelected); ruleDetail.ShowDialog(); ruleSelected = ruleDetail.rule; using (var db = new DataContext()) { db.PersistEntity(ruleSelected); db.SaveChanges(); } App.Single.UpdateWork(inspector); List <RuleFile> lstRules = (List <RuleFile>)lstVRules.ItemsSource; lstVRules.ItemsSource = null; lstVRules.ItemsSource = lstRules; } }
private void pnlNewRule_MouseUp(object sender, MouseButtonEventArgs e) { NewRule newRule = new NewRule(); newRule.ShowDialog(); if (newRule.rule != null) { RuleFile rule = newRule.rule; using (var db = new DataContext()) { db.AttachEntity(inspector); inspector.Rules.Add(rule); Boolean exist = true; if (inspector.InspectorId == 0) { inspector.Name = txtName.Text; inspector.Path = txtPath.Text; if (rbtMoveSubDir.IsChecked.HasValue && rbtMoveSubDir.IsChecked.Value) { inspector.Action = (int)Inspector.TypeActions.MoveSubDir; inspector.SubDirAction = txtPathAction.Text; } else { inspector.Action = (int)Inspector.TypeActions.DeleteFiles; inspector.SubDirAction = String.Empty; } db.PersistEntity(inspector); exist = false; } db.SaveChanges(); if (!exist) { App.Single.AddWork(inspector); } else { App.Single.UpdateWork(inspector); } } RulesRefresh(rule, true); } }
private void pnlNewRule_MouseUp(object sender, MouseButtonEventArgs e) { var newRule = new NewRule(); newRule.ShowDialog(); if (newRule.Rule != null) { RuleFile rule = newRule.Rule; Inspector.Rules.Value.Add(rule); RulesRefresh(rule, true); } }
private void lstVRules_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lstVRules.SelectedIndex != -1) { var ruleSelected = (RuleFile)lstVRules.SelectedValue; var ruleDetail = new NewRule(ruleSelected); ruleDetail.ShowDialog(); if(ruleDetail.Rule != null) { ruleSelected = ruleDetail.Rule; var lstRules = (List<RuleFile>)lstVRules.ItemsSource; lstVRules.ItemsSource = null; lstVRules.ItemsSource = lstRules; } } }
private void pnlNewRule_MouseUp(object sender, MouseButtonEventArgs e) { NewRule newRule = new NewRule(); newRule.ShowDialog(); if (newRule.rule != null) { RuleFile rule = newRule.rule; using (var db = new DataContext()) { db.AttachEntity(inspector); inspector.Rules.Add(rule); Boolean exist = true; if (inspector.InspectorId == 0) { inspector.Name = txtName.Text; inspector.Path = txtPath.Text; if (rbtMoveSubDir.IsChecked.HasValue && rbtMoveSubDir.IsChecked.Value) { inspector.Action = (int)Inspector.TypeActions.MoveSubDir; inspector.SubDirAction = txtPathAction.Text; } else { inspector.Action = (int)Inspector.TypeActions.DeleteFiles; inspector.SubDirAction = String.Empty; } db.PersistEntity(inspector); exist = false; } db.SaveChanges(); if(!exist) { App.Single.AddWork(inspector); } else { App.Single.UpdateWork(inspector); } } RulesRefresh(rule, true); } }
private void lstVRules_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lstVRules.SelectedIndex != -1) { RuleFile ruleSelected = (RuleFile)lstVRules.SelectedValue; NewRule ruleDetail = new NewRule(ruleSelected); ruleDetail.ShowDialog(); ruleSelected = ruleDetail.rule; using (var db = new DataContext()) { db.PersistEntity(ruleSelected); db.SaveChanges(); } App.Single.UpdateWork(inspector); List<RuleFile> lstRules = (List<RuleFile>)lstVRules.ItemsSource; lstVRules.ItemsSource = null; lstVRules.ItemsSource = lstRules; } }