Example #1
0
        internal ViewRuleDialog(ExistingRuleViewModel rule)
        {
            m_rule = rule;

            InitializeComponent();
            DataContext = m_rule;
        }
Example #2
0
        private void resolveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Button button = sender as Button;
                Debug.Assert(button != null);

                ExistingRuleViewModel rule = button.DataContext as ExistingRuleViewModel;
                if (rule != null)
                {
                    IEnumerable <ConflictResolutionResult> results = rule.SaveToDB();

                    if (results.Where(x => !x.Resolved).Count() > 0)
                    {
                        ResultsDialog resultsDialog = new ResultsDialog(results);
                        resultsDialog.Owner = Window.GetWindow(this);
                        resultsDialog.ShowDialog();
                    }
                }
            }
            catch (Exception exception)
            {
                Utilities.HandleException(exception);
            }
        }
Example #3
0
 internal NewRuleView(ApplicationViewModel appViewModel, ExistingRuleViewModel basedOnRule)
 {
     InitializeComponent();
     m_newRule              = new NewRuleViewModel(appViewModel, basedOnRule);
     DataContext            = m_newRule;
     m_applicationViewModel = appViewModel;
 }
Example #4
0
        private void DisplayRule(FrameworkElement element)
        {
            try
            {
                if (element != null)
                {
                    ExistingRuleViewModel rule = element.DataContext as ExistingRuleViewModel;
                    Debug.Assert(rule != null);

                    ViewRuleDialog dialog = new ViewRuleDialog(rule);
                    dialog.Owner = Window.GetWindow(this);
                    dialog.ShowDialog();
                }
            }
            catch (Exception exception)
            {
                Utilities.HandleException(exception);
            }
        }
Example #5
0
        public NewRuleViewModel(ApplicationViewModel appViewModel, ExistingRuleViewModel basedOnRule)
            : base(appViewModel)
        {
            m_basedOnRule        = basedOnRule;
            SessionGroupUniqueId = appViewModel.SessionGroupUniqueId;

            if (m_basedOnRule != null)
            {
                SelectedSession      = Sessions.FirstOrDefault(x => x.UniqueId.Equals(m_basedOnRule.ScopeId));
                SelectedSource       = Sources.FirstOrDefault(x => x.UniqueId.Equals(m_basedOnRule.SourceId));
                SelectedConflictType = ConflictTypes.FirstOrDefault(x => x.ReferenceName.Equals(m_basedOnRule.ConflictType.ReferenceName));
                Scope       = m_basedOnRule.Scope;
                Description = m_basedOnRule.Description;
                SelectedResolutionAction = ResolutionActions.FirstOrDefault(x => x.ReferenceName.Equals(m_basedOnRule.ResolutionAction.ReferenceName));
            }
            else
            {
                SelectedSession = Sessions.FirstOrDefault();
                Scope           = string.Empty;
            }
        }
Example #6
0
 public void RemoveSelectedRule(ExistingRuleViewModel rule)
 {
     rule.RemoveFromDB();
     Rules.Remove(rule);
 }