Beispiel #1
0
    private void runRuleset(string id, bool newSession)
    {
        string path, ans;

        try
        {
            // Determine where we are
            path = Request.PhysicalApplicationPath + "bin\\";

            // Load the ARulesXL engine and ruleset file
            log("Opening ARulesXL Engine");
            arxl.OpenRules(path + RulesetFilename.Text, path);

            // Load the user inputs, first clear the .in vector, then load it up
            arxl.ClearVector("ShaftRules", ".in");
            arxl.AddToVector("ShaftRules", ".in", "Favor", Favor.SelectedItem.ToString());
            arxl.AddToVector("ShaftRules", ".in", "Swing Speed", SwingSpeed.Text);
            arxl.AddToVector("ShaftRules", ".in", "Club Type", ClubType.SelectedItem.ToString());
            arxl.AddToVector("ShaftRules", ".in", "Ball Flight", BallFlight.SelectedItem.ToString());

            // Query the rule set
            ans = arxl.QueryRules(Ruleset.Text, Query.Text);

            // Display the answer
            AnswerText.Text = ans;

#if (ARULESXL_DEBUG)
            // If we need to append the debug log, do that
            AnswerText.Text = AnswerText.Text + "\n\nARulesXL Debug Log" + "\n" + debugLog;
#endif
            // Close the ARulesXL engine
            arxl.CloseRules();
        }
        catch (Exception ex)
        {
            AnswerText.Text = "runRuleset / " + ex.Message;
            arxl.CloseRules();
        }
    }
Beispiel #2
0
        private void GoButton_Click(object sender, EventArgs e)
        {
            string path;
            string ans;

            // Determine where we are
            path = Application.StartupPath + "\\";

            try
            {
                // Get an ARulesXL engine
                ARulesXL arxl = new ARulesXL();

                // Load the ARulesXL engine and ruleset file
                arxl.OpenRules(path + "advice.axl", path);

                // Load the user inputs, first clear the .in vector, then load it up
                arxl.ClearVector("ShaftRules", ".in");
                arxl.AddToVector("ShaftRules", ".in", "Favor", Favor.SelectedItem.ToString());
                arxl.AddToVector("ShaftRules", ".in", "Swing Speed", SwingSpeed.Text);
                arxl.AddToVector("ShaftRules", ".in", "Club Type", ClubType.SelectedItem.ToString());
                arxl.AddToVector("ShaftRules", ".in", "Ball Flight", BallFlight.SelectedItem.ToString());

                // Query the rule set
                ans = arxl.QueryRules("ShaftRules", "FIND .advice");

                // Display the answer
                Advice.Text = ans;

                arxl.CloseRules();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR");
            }
        }