public static RuleConfigDialog GetInstance()
 {
     if (_instance == null)
     {
         _instance = new RuleConfigDialog();
     }
     return(_instance);
 }
예제 #2
0
        public void TestRuleOptions()
        {
            //m_editor.WriteMessage("Run Test Rule Options command\n");
            System.Windows.MessageBox.Show("step3");
            RuleConfigDialog dialog = RuleConfigDialog.GetInstance();

            System.Windows.MessageBox.Show("step4");
            dialog.Show();
        }
예제 #3
0
        public void ConfigureRule()
        {
            InitializeRule();

            ((RuleLibrary)RuleManagerInstance.Storage).Load();

            // Create a default rule
            RulePoint rp = RuleManagerInstance.GetRulePoint("/PipeRule");

            if (!rp.HasActivity)
            {
                rp.CreateDefaultWorkflow();
            }

            System.Windows.Application app    = new System.Windows.Application();
            RuleConfigDialog           dialog = RuleConfigDialog.GetInstance();

            dialog.SelectedRulePath = "/PipeRule";
            app.Run(dialog);

            ((RuleLibrary)RuleManagerInstance.Storage).Save();
        }
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            // If users accept (e.g. click on 'OK' button) and the rules have been changed, save rules.
            if (this.DialogResult == true && _ruleConfigContext.IsDirty)
            {
                _ruleConfigContext.CommitWorkingSet();
            }
            // If users cancelled the dialog and the rules have been changed, ask users if they want to save changes.
            else if (_ruleConfigContext.IsDirty)
            {
                MessageBoxResult result = MessageBox.Show(
                    Properties.Resources.PreClosingPrompt,
                    Properties.Resources.Warning,
                    MessageBoxButton.YesNoCancel,
                    MessageBoxImage.Warning);
                if (result == MessageBoxResult.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        _ruleConfigContext.CommitWorkingSet();
                    }
                }
            }

            DetachDesigner();
            DataContext        = null;
            _ruleConfigContext = null;
            _instance          = null;

            GC.Collect();
        }